简体   繁体   中英

FFmpeg concat video command error

I got following error while trying to concat two videos using ffmpeg command in my android application.

Error:

"Input link in1:v0 parameters (size 1920x1080, SAR 1:1) do not match the corresponding output link in0:v0 parameters (1280x720, SAR 1:1)"

Please help how to resolve this error.

FFmpeg can only concat inputs matching exact sizes. To concat different sized input, you have to apply some filters to match sizes. You can apply scale, pad or crop filter to resize input and then concat.

Here is an example:

ffmpeg -y -i input.mp4 -i input2.mp4 -preset ultrafast -filter_complex
"[0:v]scale=1080:608[vout];[1:v]scale=1080:608[vout2];[vout][0:a]
[vout2][1:a]concat=n=2:v=1:a=1[v][a]" -map "[v]" -map "[a]" -c:v 
libx264 -c:a aac -movflags +faststart output_test.mp4

Here applying scale to resize inputs videos to be exact size (1080:608)<=>(width:height) then concatenating.

To see details:

Concat: https://trac.ffmpeg.org/wiki/Concatenate

Scale: https://trac.ffmpeg.org/wiki/Scaling

Pad: https://ffmpeg.org/ffmpeg-filters.html#pad-1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM