scripts:ffmpeg:side_by_side_video

Overlay videos side by side

This one I use quite often to A/B test videos or do before after runs.
This is particularly useful for example when comparing upscaled videos through say realesrgan and realsr or between two models. Or if you're comparing different interpolation methods.

Here is an example where I was comparing videos with different resolutions and had to scale them.

I also keep both audio tracks for easy comparison.

ffmpeg -i original.mp4 -i modified.mkv -filter_complex "[1:v]scale=1920x1080:flags=lanczos+full_chroma_inp+full_chroma_int[v1];[0:v][v1]hstack=inputs=2[out]" -map "[out]" -map 1:a -map 0:a -c:a copy -c:v libx264 -crf 18 comparison.mkv

You can use hstack to stack them horizontally, vstack for vertical, or even make your own grid layouts by combining. It will also handle more than 2 inputs. Fun!

  • scripts/ffmpeg/side_by_side_video.txt
  • Last modified: 2023-12-20 08:14
  • by Tony