Scale2ref然后使用ffmpeg加入两个视频片段

时间:2019-01-01 12:00:17

标签: filter ffmpeg concatenation scale

我想加入两个视频(带音频)剪辑。第一个剪辑具有以下格式:

Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 358 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
  handler_name    : VideoHandler
Stream #0:1(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, stereo, fltp, 192 kb/s (default)
Metadata:
  handler_name    : SoundHandler
Side data:
  audio service type: main

第二个:

Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 320x240, 88 kb/s, 8 fps, 8 tbr, 16384 tbn, 16 tbc (default)
Metadata:
  handler_name    : VideoHandler
Stream #0:1(und): Audio: ac3 (ac-3 / 0x332D6361), 11025 Hz, mono, fltp, 96 kb/s (default)
Metadata:
  handler_name    : SoundHandler
Side data:
  audio service type: main  

我想加入两个片段;保留第二个剪辑的格式选项的同时,第一个紧跟着后者。 基于阅读文档和其他问题,我达到了以下命令:

ffmpeg -i secondClip.mp4 -i firstClip.mpg -filter_complex "[1:v:0][0:v:0]scale2ref=oh*mdar:ih[2nd][ref],[2nd][1:a:0][ref][0:a:0]concat=n=2:v=1:a=1[outv][outa]" -map "[outv]" -map "[outa]" output.mp4

这会产生以下错误:

Stream mapping:
  Stream #0:0 (h264) -> scale2ref:ref
  Stream #0:1 (ac3) -> concat:in1:a0
  Stream #1:0 (mpeg2video) -> scale2ref:default
  Stream #1:1 (mp2) -> concat:in0:a0
  concat:out:v0 -> Stream #0:0 (libx264)
  concat:out:a0 -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[Parsed_concat_1 @ 0000017896b6f400] Input link in1:v0 parameters (size 320x240, SAR 0:1) do not match the corresponding output link in0:v0 parameters (426x240, SAR 640:639)
[Parsed_concat_1 @ 0000017896b6f400] Failed to configure output pad on Parsed_concat_1
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!

0 个答案:

没有答案