user10253483
user10253483

Reputation:

ffmpeg concat two videos with different sizes encounter "do not match" error

I'm trying to concat 4 mp4 files. I'm using the command below but not able to concat

ffmpeg -i L00.mp4 -i L01.mp4 \
  -filter_complex "[0:v] [0:a] [1:v] [1:a] concat=n=2:v=1:a=1 [v] [a]" \
  -map "[v]" -map "[a]" output.mp4

Getting this error:

Input link in1:v0 parameters (size 1150x722, SAR 1:1) do not match the corresponding output link in0:v0 parameters (1158x690, SAR 1:1)

This command from this post

ffmpeg -i L00.mp4 -i L01.mp4 -filter_complex \
"[0:v]scale=1158:722:force_original_aspect_ratio=decrease,pad=1158:722:(ow-iw)/2:(oh-ih)/2[v0]; \
 [1:v]scale=1158:722:force_original_aspect_ratio=decrease,pad=1158:722:(ow-iw)/2:(oh-ih)/2[v1]; \
 [v0][0:a][1:v][1:a]concat=n=2:v=1:a=1[v][a]" \
-map "[v]" -map "[a]" -c:v libx264 -c:a aac -movflags +faststart output.mp4

getting this error:

Filter pad has an unconnected output

the dimensions of L00.mp4 is 1158 × 690, L01.mp4 is 1150 × 722.

how to fix this?

Upvotes: 2

Views: 1057

Answers (1)

minhazur
minhazur

Reputation: 4988

The output [v1] of second pad command is unused that's why you are receiving Filter pad has an unconnected output

With some modification, the FFmpeg command should be similar to this

ffmpeg -i L00.mp4 -i L01.mp4 -filter_complex "[0:v]scale=1158:722:force_original_aspect_ratio=decrease[v0];[v0]pad=1158:722:(ow-iw)/2:(oh-ih)/2:black[v1];[1:v]scale=1158:722:force_original_aspect_ratio=decrease[v2];[v2]pad=1158:722:(ow-iw)/2:(oh-ih)/2:black[v3];[v1][0:a][v3][1:a]concat=n=2:v=1:a=1[v][a]" -map "[v]" -map "[a]" -c:v libx264 -c:a aac -movflags +faststart output_force_decrease.mp4

See, I have used the output of pad [v3] in concat command.

Upvotes: 2

Related Questions