[FFmpeg-user] Accurate Seeking with Multiple Parameters

Fernando Irias Escher fernandoiriase at gmail.com
Wed Mar 13 22:52:53 CET 2013

Hello everyone,

I'm trying to create a 2x2 grid video (like the one shown here http://ffmpeg.org/trac/ffmpeg/wiki/FilteringGuide#multipleinputoverlayin2x2grid), but I need to trim the first seconds of some of the videos to make them fit perfectly in the grid.

This is the command I came up with for this task:
ffmpeg -i 0.mov -ss 0.0  -i 1.mov -ss 5.0  -i 2.mov -ss 0.0 -i 3.mov -ss 5.0  -filter_complex "[0:0]pad=iw*2:ih*2[a];[a][1:0]overlay=w[x];[x][2:0]overlay=0:h[y];[y][3:0]overlay=w:h" -y -c:v libx264 -c:a copy grid.mp4

I'm aware of how accurate seeking works for -ss parameter, the problem arises when you have multiple parameters; looks like only the fast seeking option is available for the multiple inputs. 

In the previous command what I want is to cut the first five seconds for input 1.mov and input 3.mov, instead, the first five seconds for input 2.mov are trimmed and the last -ss param gets ignored.

I also tried using the sp parameter that you can set to the movie filter when trying to grab the inputs from inside the complex filter, but some digging shows that I'm loosing some frames for some videos, so my first guess (and correct me if I'm wrong) will be that it uses fast seeking as well instead of the accurate one.

Any ideas on how I could achieve accurate seeking for multiple inputs in this scenario?

Previous thanks to all of you.

Fernando Irías Escher

More information about the ffmpeg-user mailing list