User Tools

Site Tools


doc:appunti:linux:video:ffmpeg_stack_horizontally

This is an old revision of the document!


Stack two videos side-by-side with ffmpeg

I created a Unix shell script to do a side-by-side comparison between videos recorded with my two action cameras: a new SJCAM 8 Pro and the old Xiaomi Yi.

Suppose that we have two videos taken simultaneously with the two cameras:

The result will be a video like the following: the central part of each video is stacked horizontally on the final frame, two labels are overlayed on the bottom corners, the audio from the first video is mixed into the left channel of the resulting video and the audio from the second video goes to the right channel.

The script uses ffmpeg to do all the incantation. It is required that both videos share the same resolution.

The script can take into account that the videos may be out of sync: it is possible to pass two timestamps referring at the same instant captured into both videos. The script will shift the videos presentation time each-other, so that both will be synced.

doc/appunti/linux/video/ffmpeg_stack_horizontally.1635413010.txt.gz · Last modified: 2021/10/28 11:23 by niccolo