diff options
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 | } |