diff options
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/ffmpeg-utils.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts index 1d610eff2..c8d6969ff 100644 --- a/server/helpers/ffmpeg-utils.ts +++ b/server/helpers/ffmpeg-utils.ts | |||
@@ -674,7 +674,12 @@ async function presetH264 (command: ffmpeg.FfmpegCommand, input: string, resolut | |||
674 | // Constrained Encoding (VBV) | 674 | // Constrained Encoding (VBV) |
675 | // https://slhck.info/video/2017/03/01/rate-control.html | 675 | // https://slhck.info/video/2017/03/01/rate-control.html |
676 | // https://trac.ffmpeg.org/wiki/Limiting%20the%20output%20bitrate | 676 | // https://trac.ffmpeg.org/wiki/Limiting%20the%20output%20bitrate |
677 | const targetBitrate = getTargetBitrate(resolution, fps, VIDEO_TRANSCODING_FPS) | 677 | let targetBitrate = getTargetBitrate(resolution, fps, VIDEO_TRANSCODING_FPS) |
678 | |||
679 | // Don't transcode to an higher bitrate than the original file | ||
680 | const fileBitrate = await getVideoFileBitrate(input) | ||
681 | targetBitrate = Math.min(targetBitrate, fileBitrate) | ||
682 | |||
678 | localCommand = localCommand.outputOptions([ `-maxrate ${targetBitrate}`, `-bufsize ${targetBitrate * 2}` ]) | 683 | localCommand = localCommand.outputOptions([ `-maxrate ${targetBitrate}`, `-bufsize ${targetBitrate * 2}` ]) |
679 | 684 | ||
680 | // Keyframe interval of 2 seconds for faster seeking and resolution switching. | 685 | // Keyframe interval of 2 seconds for faster seeking and resolution switching. |