aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/ffmpeg-utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/ffmpeg-utils.ts')
-rw-r--r--server/helpers/ffmpeg-utils.ts18
1 files changed, 7 insertions, 11 deletions
diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts
index ab29d4691..78ee5fa7f 100644
--- a/server/helpers/ffmpeg-utils.ts
+++ b/server/helpers/ffmpeg-utils.ts
@@ -287,8 +287,8 @@ async function getLiveTranscodingCommand (options: {
287 addDefaultEncoderParams({ command, encoder: builderResult.encoder, fps: resolutionFPS, streamNum: i }) 287 addDefaultEncoderParams({ command, encoder: builderResult.encoder, fps: resolutionFPS, streamNum: i })
288 288
289 logger.debug( 289 logger.debug(
290 'Apply ffmpeg live video params from %s using %s profile.', builderResult.encoder, profile, builderResult, 290 'Apply ffmpeg live video params from %s using %s profile.', builderResult.encoder, profile,
291 { fps: resolutionFPS, resolution, ...lTags() } 291 { builderResult, fps: resolutionFPS, resolution, ...lTags() }
292 ) 292 )
293 293
294 command.outputOption(`${buildStreamSuffix('-c:v', i)} ${builderResult.encoder}`) 294 command.outputOption(`${buildStreamSuffix('-c:v', i)} ${builderResult.encoder}`)
@@ -314,8 +314,8 @@ async function getLiveTranscodingCommand (options: {
314 addDefaultEncoderParams({ command, encoder: builderResult.encoder, fps: resolutionFPS, streamNum: i }) 314 addDefaultEncoderParams({ command, encoder: builderResult.encoder, fps: resolutionFPS, streamNum: i })
315 315
316 logger.debug( 316 logger.debug(
317 'Apply ffmpeg live audio params from %s using %s profile.', builderResult.encoder, profile, builderResult, 317 'Apply ffmpeg live audio params from %s using %s profile.', builderResult.encoder, profile,
318 { fps: resolutionFPS, resolution, ...lTags() } 318 { builderResult, fps: resolutionFPS, resolution, ...lTags() }
319 ) 319 )
320 320
321 command.outputOption(`${buildStreamSuffix('-c:a', i)} ${builderResult.encoder}`) 321 command.outputOption(`${buildStreamSuffix('-c:a', i)} ${builderResult.encoder}`)
@@ -368,10 +368,6 @@ function addDefaultEncoderGlobalParams (options: {
368 command.outputOption('-max_muxing_queue_size 1024') 368 command.outputOption('-max_muxing_queue_size 1024')
369 // strip all metadata 369 // strip all metadata
370 .outputOption('-map_metadata -1') 370 .outputOption('-map_metadata -1')
371 // NOTE: b-strategy 1 - heuristic algorithm, 16 is optimal B-frames for it
372 .outputOption('-b_strategy 1')
373 // NOTE: Why 16: https://github.com/Chocobozzz/PeerTube/pull/774. b-strategy 2 -> B-frames<16
374 .outputOption('-bf 16')
375 // allows import of source material with incompatible pixel formats (e.g. MJPEG video) 371 // allows import of source material with incompatible pixel formats (e.g. MJPEG video)
376 .outputOption('-pix_fmt yuv420p') 372 .outputOption('-pix_fmt yuv420p')
377} 373}
@@ -627,8 +623,8 @@ async function presetVideo (options: {
627 623
628 logger.debug( 624 logger.debug(
629 'Apply ffmpeg params from %s for %s stream of input %s using %s profile.', 625 'Apply ffmpeg params from %s for %s stream of input %s using %s profile.',
630 builderResult.encoder, streamType, input, profile, builderResult, 626 builderResult.encoder, streamType, input, profile,
631 { resolution, fps, ...lTags() } 627 { builderResult, resolution, fps, ...lTags() }
632 ) 628 )
633 629
634 if (streamType === 'video') { 630 if (streamType === 'video') {
@@ -734,7 +730,7 @@ async function runCommand (options: {
734 command.on('start', cmdline => { shellCommand = cmdline }) 730 command.on('start', cmdline => { shellCommand = cmdline })
735 731
736 command.on('error', (err, stdout, stderr) => { 732 command.on('error', (err, stdout, stderr) => {
737 if (silent !== true) logger.error('Error in ffmpeg.', { stdout, stderr, ...lTags() }) 733 if (silent !== true) logger.error('Error in ffmpeg.', { stdout, stderr, shellCommand, ...lTags() })
738 734
739 rej(err) 735 rej(err)
740 }) 736 })