Getting Exception while merging two file with ffmp

2019-08-17 15:38发布

I am trying to merge two mp4 files using ffmpeg command. My input files are not in same encoding so they are not merge with normal command. I have use below command but got exception. Command: -

ffmpeg -i File_1.mp4 -i File_2.mp4 -filter_complex "[0:v]setsar=1[0v];[1:v]scale=720:576:force_original_aspect_ratio=decrease,setsar=1,pad=720:576:(ow-iw)/2:(oh-ih)/2[1v];[0v][0:a][1v][1:a]concat=n=2:v=1:a=1[outv][outa]" -map "[outv]" -map "[outa]" -c:v libx264 -crf 23 ffmpeg1.mp4

Exception I have got: -

[Parsed_concat_4 @ 00000000067ea380] Input link in1:v0 parameters (size 720x576, SAR 1:1) do not match the corresponding
output link in0:v0 parameters (320x240, SAR 1:1)
[Parsed_concat_4 @ 00000000067ea380] Failed to configure output pad on 
Parsed_concat_4
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #1:0
Conversion failed!

Please tell me what is the solution for that or any command which can help me out with merge any two mp4 file in windows using cmd.

1条回答
劳资没心,怎么记你
2楼-- · 2019-08-17 16:26

The concat filter requires all its video inputs to have the same resolution and sample aspect ratio. The framerate and pixel format can differ, though the output may not be what you want.

So, in this command, alter the filtering of the first video input to match the second.

ffmpeg -i File_1.mp4 -i File_2.mp4 -filter_complex "[0:v]scale=720:576:force_original_aspect_ratio=decrease,setsar=1,pad=720:576:(ow-iw)/2:(oh-ih)/2[0v];[1:v]scale=720:576:force_original_aspect_ratio=decrease,setsar=1,pad=720:576:(ow-iw)/2:(oh-ih)/2[1v];[0v][0:a][1v][1:a]concat=n=2:v=1:a=1[outv][outa]" -map "[outv]" -map "[outa]" -c:v libx264 -crf 23 ffmpeg1.mp4
查看更多
登录 后发表回答