[FFmpeg-user] Issue with split filter

Dave Cleal dmc at vyclone.com
Thu Jan 24 13:57:41 CET 2013


Hi,

I'm trying to use a complex filter to replace severeal existing ffmpeg
steps with one, to get the job done faster (we do this a lot).

This

ffmpeg -y -i bottom.mp4 -i top.mp4 -i filler.mp4 -filter_complex
"[2:0]split=4[f1][f2][f3][f4];[0:0]setsar=0:1[video0];
[f1]select=lt(n\,125)[leader0]; [f2]select=lt(n\,78)[trailer0];
[leader0][video0][trailer0]concat=n=3[filled0];
[1:0]setsar=0:1[video1]; [f3]select=lt(n\,0)[leader1];
[f4]select=lt(n\,45)[trailer1];
[leader1][video1][trailer1]concat=n=3[filled1];
[filled0]pad=240:360:0:180 [large]; [large][filled1]
overlay=0:0,setsar=1:1" -r 30 -b:v 600k -vcodec libx264 looksbad.mp4

does something different to

ffmpeg -y -i bottom.mp4 -i top.mp4 -i filler.mp4 -i filler.mp4 -i
filler.mp4 -i filler.mp4 -filter_complex "[0:0]setsar=0:1[video0];
[2:0]select=lt(n\,125)[leader0]; [3:0]select=lt(n\,78)[trailer0];
[leader0][video0][trailer0]concat=n=3[filled0];
[1:0]setsar=0:1[video1]; [4:0]select=lt(n\,0)[leader1];
[5:0]select=lt(n\,45)[trailer1];
[leader1][video1][trailer1]concat=n=3[filled1];
[filled0]pad=240:360:0:180 [large]; [large][filled1]
overlay=0:0,setsar=1:1" -r 30 -b:v 600k -vcodec libx264 looksgood.mp4

As far as I can tell, the only difference between these is that the
first uses split to get four copies of an input stream, and the second
just adds it as an input four times. My understanding is that these
two should be equivalent: is there supposed to be a difference?

It seems that the second does what I expect: the first drops frames,
freezes here and there, and is 77 frames shorter than I expect it to
be.

Not too fussed as I do have a workaround, but in some realistic (and
more complex) examples, I will end up with an awful lot of "-i..."s! So
it'd be nice to use split if I can.

Thanks in advance for any advice


More information about the ffmpeg-user mailing list