Skip to content

Commit

Permalink
Fix transcoding errors in readonly docker containers
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gramakri committed Oct 16, 2020
1 parent 7f0d856 commit 7254a4a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.14",
"@types/fs-extra": "^9.0.1",
"@types/libxmljs": "^0.18.0",
"@types/lodash": "^4.14.64",
Expand Down
3 changes: 2 additions & 1 deletion server/helpers/ffmpeg-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ type TranscodeOptions =
function transcode (options: TranscodeOptions) {
return new Promise<void>(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') {
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@
"@types/qs" "*"
"@types/serve-static" "*"

"@types/fluent-ffmpeg@^2.1.8":
"@types/fluent-ffmpeg@2.1.14":
version "2.1.14"
resolved "https://registry.yarnpkg.com/@types/fluent-ffmpeg/-/fluent-ffmpeg-2.1.14.tgz#b21d60267fe269c2ea81fa3238a36a8349f8f2f3"
integrity sha512-nJrAX9ODNI7mUB0b7Y0Stx1a6dOpV3zXsOnWoBuEd9/woQhepBNCMeCyOL6SLJD3jn5sLw5ciDGH0RwJenCoag==
Expand Down

0 comments on commit 7254a4a

Please sign in to comment.