From 313921b50fda6bfd2942e45e3c9a0547ff01880b Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Thu, 15 Oct 2020 17:30:19 -0700 Subject: Fix transcoding errors in readonly docker containers ffmpeg seems to create some temporary files in the cwd. When PeerTube is run in a read-only docker container, this causes all transcoding to fail. As a workaround, we set the cwd to the configured tmp dir. --- package.json | 2 +- server/helpers/ffmpeg-utils.ts | 3 ++- yarn.lock | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 5feb9e8f9..4a571909d 100644 --- a/package.json +++ b/package.json @@ -166,7 +166,7 @@ "@types/config": "^0.0.36", "@types/express": "^4.0.35", "@types/express-rate-limit": "^5.0.0", - "@types/fluent-ffmpeg": "^2.1.8", + "@types/fluent-ffmpeg": "^2.1.16", "@types/fs-extra": "^9.0.1", "@types/libxmljs": "^0.18.0", "@types/lodash": "^4.14.64", diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts index 7bfd5d44a..02c66cd01 100644 --- a/server/helpers/ffmpeg-utils.ts +++ b/server/helpers/ffmpeg-utils.ts @@ -270,7 +270,8 @@ type TranscodeOptions = function transcode (options: TranscodeOptions) { return new Promise(async (res, rej) => { try { - let command = ffmpeg(options.inputPath, { niceness: FFMPEG_NICE.TRANSCODING }) + // we set cwd explicitly because ffmpeg appears to create temporary files when trancoding which fails in read-only file systems + let command = ffmpeg(options.inputPath, { niceness: FFMPEG_NICE.TRANSCODING, cwd: CONFIG.STORAGE.TMP_DIR }) .output(options.outputPath) if (options.type === 'quick-transcode') { diff --git a/yarn.lock b/yarn.lock index e04a94a95..3ceb4662e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -591,10 +591,10 @@ "@types/qs" "*" "@types/serve-static" "*" -"@types/fluent-ffmpeg@^2.1.8": - version "2.1.14" - resolved "https://registry.yarnpkg.com/@types/fluent-ffmpeg/-/fluent-ffmpeg-2.1.14.tgz#b21d60267fe269c2ea81fa3238a36a8349f8f2f3" - integrity sha512-nJrAX9ODNI7mUB0b7Y0Stx1a6dOpV3zXsOnWoBuEd9/woQhepBNCMeCyOL6SLJD3jn5sLw5ciDGH0RwJenCoag== +"@types/fluent-ffmpeg@^2.1.16": + version "2.1.16" + resolved "https://registry.yarnpkg.com/@types/fluent-ffmpeg/-/fluent-ffmpeg-2.1.16.tgz#63949b0cb6bc88c9157a579cdd80858a269f3a3a" + integrity sha512-1FTstm6xY/2WsJVt6ARV7CiJjNCQDlR/nfw6xuYk5ITbVjk7sw89Biyqm2DGW4c3aZ3vBx+5irZvsql4eybpoQ== dependencies: "@types/node" "*" -- cgit v1.2.3