diff options
author | Chocobozzz <me@florianbigard.com> | 2018-10-17 13:10:58 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-10-17 13:10:58 +0200 |
commit | 0229b014e0101844df028342b8d4dd9ae4e887a4 (patch) | |
tree | 5c42c40499e4298ee241203c8e055dbbd9438739 /server/helpers/ffmpeg-utils.ts | |
parent | f365e978ed08e8fc7adf0607271c4071915629ee (diff) | |
download | PeerTube-0229b014e0101844df028342b8d4dd9ae4e887a4.tar.gz PeerTube-0229b014e0101844df028342b8d4dd9ae4e887a4.tar.zst PeerTube-0229b014e0101844df028342b8d4dd9ae4e887a4.zip |
Fix tests
Diffstat (limited to 'server/helpers/ffmpeg-utils.ts')
-rw-r--r-- | server/helpers/ffmpeg-utils.ts | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts index 17f35fe8d..a53a7bae4 100644 --- a/server/helpers/ffmpeg-utils.ts +++ b/server/helpers/ffmpeg-utils.ts | |||
@@ -118,11 +118,13 @@ function transcode (options: TranscodeOptions) { | |||
118 | return new Promise<void>(async (res, rej) => { | 118 | return new Promise<void>(async (res, rej) => { |
119 | let fps = await getVideoFileFPS(options.inputPath) | 119 | let fps = await getVideoFileFPS(options.inputPath) |
120 | // On small/medium resolutions, limit FPS | 120 | // On small/medium resolutions, limit FPS |
121 | if (options.resolution !== undefined && | 121 | // if ( |
122 | options.resolution < VIDEO_TRANSCODING_FPS.KEEP_ORIGIN_FPS_RESOLUTION_MIN && | 122 | // options.resolution !== undefined && |
123 | fps > VIDEO_TRANSCODING_FPS.AVERAGE) { | 123 | // options.resolution < VIDEO_TRANSCODING_FPS.KEEP_ORIGIN_FPS_RESOLUTION_MIN && |
124 | fps = VIDEO_TRANSCODING_FPS.AVERAGE | 124 | // fps > VIDEO_TRANSCODING_FPS.AVERAGE |
125 | } | 125 | // ) { |
126 | // fps = VIDEO_TRANSCODING_FPS.AVERAGE | ||
127 | // } | ||
126 | 128 | ||
127 | let command = ffmpeg(options.inputPath, { niceness: FFMPEG_NICE.TRANSCODING }) | 129 | let command = ffmpeg(options.inputPath, { niceness: FFMPEG_NICE.TRANSCODING }) |
128 | .output(options.outputPath) | 130 | .output(options.outputPath) |
@@ -321,12 +323,12 @@ async function presetH264 (ffmpeg: ffmpeg, resolution: VideoResolution, fps: num | |||
321 | // https://slhck.info/video/2017/03/01/rate-control.html | 323 | // https://slhck.info/video/2017/03/01/rate-control.html |
322 | // https://trac.ffmpeg.org/wiki/Limiting%20the%20output%20bitrate | 324 | // https://trac.ffmpeg.org/wiki/Limiting%20the%20output%20bitrate |
323 | const targetBitrate = getTargetBitrate(resolution, fps, VIDEO_TRANSCODING_FPS) | 325 | const targetBitrate = getTargetBitrate(resolution, fps, VIDEO_TRANSCODING_FPS) |
324 | localFfmpeg.outputOptions([`-maxrate ${ targetBitrate }`, `-bufsize ${ targetBitrate * 2 }`]) | 326 | localFfmpeg = localFfmpeg.outputOptions([`-maxrate ${ targetBitrate }`, `-bufsize ${ targetBitrate * 2 }`]) |
325 | 327 | ||
326 | // Keyframe interval of 2 seconds for faster seeking and resolution switching. | 328 | // Keyframe interval of 2 seconds for faster seeking and resolution switching. |
327 | // https://streaminglearningcenter.com/blogs/whats-the-right-keyframe-interval.html | 329 | // https://streaminglearningcenter.com/blogs/whats-the-right-keyframe-interval.html |
328 | // https://superuser.com/a/908325 | 330 | // https://superuser.com/a/908325 |
329 | localFfmpeg.outputOption(`-g ${ fps * 2 }`) | 331 | localFfmpeg = localFfmpeg.outputOption(`-g ${ fps * 2 }`) |
330 | 332 | ||
331 | return localFfmpeg | 333 | return localFfmpeg |
332 | } | 334 | } |