aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGirish Ramakrishnan <girish@cloudron.io>2020-10-15 17:30:19 -0700
committerChocobozzz <chocobozzz@cpy.re>2020-10-23 14:51:44 +0200
commit313921b50fda6bfd2942e45e3c9a0547ff01880b (patch)
tree6bea5d919245474b485a8d15df9212895782b42a
parente0f31bc9ce4b45fd4ee1d541a2e573497ca3253d (diff)
downloadPeerTube-313921b50fda6bfd2942e45e3c9a0547ff01880b.tar.gz
PeerTube-313921b50fda6bfd2942e45e3c9a0547ff01880b.tar.zst
PeerTube-313921b50fda6bfd2942e45e3c9a0547ff01880b.zip
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.
-rw-r--r--package.json2
-rw-r--r--server/helpers/ffmpeg-utils.ts3
-rw-r--r--yarn.lock8
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 @@
166 "@types/config": "^0.0.36", 166 "@types/config": "^0.0.36",
167 "@types/express": "^4.0.35", 167 "@types/express": "^4.0.35",
168 "@types/express-rate-limit": "^5.0.0", 168 "@types/express-rate-limit": "^5.0.0",
169 "@types/fluent-ffmpeg": "^2.1.8", 169 "@types/fluent-ffmpeg": "^2.1.16",
170 "@types/fs-extra": "^9.0.1", 170 "@types/fs-extra": "^9.0.1",
171 "@types/libxmljs": "^0.18.0", 171 "@types/libxmljs": "^0.18.0",
172 "@types/lodash": "^4.14.64", 172 "@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 =
270function transcode (options: TranscodeOptions) { 270function transcode (options: TranscodeOptions) {
271 return new Promise<void>(async (res, rej) => { 271 return new Promise<void>(async (res, rej) => {
272 try { 272 try {
273 let command = ffmpeg(options.inputPath, { niceness: FFMPEG_NICE.TRANSCODING }) 273 // we set cwd explicitly because ffmpeg appears to create temporary files when trancoding which fails in read-only file systems
274 let command = ffmpeg(options.inputPath, { niceness: FFMPEG_NICE.TRANSCODING, cwd: CONFIG.STORAGE.TMP_DIR })
274 .output(options.outputPath) 275 .output(options.outputPath)
275 276
276 if (options.type === 'quick-transcode') { 277 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 @@
591 "@types/qs" "*" 591 "@types/qs" "*"
592 "@types/serve-static" "*" 592 "@types/serve-static" "*"
593 593
594"@types/fluent-ffmpeg@^2.1.8": 594"@types/fluent-ffmpeg@^2.1.16":
595 version "2.1.14" 595 version "2.1.16"
596 resolved "https://registry.yarnpkg.com/@types/fluent-ffmpeg/-/fluent-ffmpeg-2.1.14.tgz#b21d60267fe269c2ea81fa3238a36a8349f8f2f3" 596 resolved "https://registry.yarnpkg.com/@types/fluent-ffmpeg/-/fluent-ffmpeg-2.1.16.tgz#63949b0cb6bc88c9157a579cdd80858a269f3a3a"
597 integrity sha512-nJrAX9ODNI7mUB0b7Y0Stx1a6dOpV3zXsOnWoBuEd9/woQhepBNCMeCyOL6SLJD3jn5sLw5ciDGH0RwJenCoag== 597 integrity sha512-1FTstm6xY/2WsJVt6ARV7CiJjNCQDlR/nfw6xuYk5ITbVjk7sw89Biyqm2DGW4c3aZ3vBx+5irZvsql4eybpoQ==
598 dependencies: 598 dependencies:
599 "@types/node" "*" 599 "@types/node" "*"
600 600