[FFmpeg-user] Combining videos with small offset. Got a 2 pass solution, can it be done in one?

Mike Grommet mgrommet at techfriends.com
Tue Jan 17 18:05:32 EET 2017


Hi list -- it's been a while!  Happy (late) New Year!

So,   I've got two recordings.  One was recorded slightly offset from 
the other of the same event.  They both have audio that I need to merge 
/ preserve.   I'm looking to display the videos side by side, and have 
been using filter_complex with good results.

I've been experimenting with itsoffset to get the videos / audio in sync.


This command synchs up the videos.   The audio from both recordings is 
in sync with themselves, but is not quite in synch with the video.  
Close but no cigar.

ffmpeg -itsoffset 0.51 -i test1.mp4 -i test2.mp4 -filter_complex 
"[0:v]scale=iw/2:ih/2,pad=2*iw:ih[left];[1:v]scale=iw/2:ih/2[right];[left][right]overlay=main_w/2:0[out],[0:a]adelay=0551[a0];[a0][1:a]amerge=inputs=2 
[a]"  -map [out] -map "[a]" testout.mp4


However, this two step solution works perfectly:

ffmpeg -i test1.mp4 -i test2.mp4 -filter_complex 
"[0:a]adelay=0551[a0];[a0][1:a]amerge=inputs=2 [a]" -map "[a]" blah.wav

ffmpeg -itsoffset 0.51 -i test1.mp4 -i test2.mp4 -i blah.wav 
-filter_complex 
"[0:v]scale=iw/2:ih/2,pad=2*iw:ih[left];[1:v]scale=iw/2:ih/2[right];[left][right]overlay=main_w/2:0[out]" 
-map [out] -map 2:a testout.mp4


It seems like I should be able to combine this into a one pass solution, 
but apparently I'm doing something dumb.



Any thoughts, or advice?



M.





More information about the ffmpeg-user mailing list