# Showing the difference by lining up multiple frames at once¶

doc

https://ffmpeg.org/ffmpeg-filters.html#tile

Especially when “difference in terms of motion” is important for the difference between the two videos, we often want to line up multiple frames at once. In such a case, we can use “tile”.

It’s not that the “tile” document is confusing, so you should be able to immediately understand what it does if you only read it. But if you try to imagine a feature from just the name “tile,” you will definitely be surprised, and if you do not understand exactly what it does, you may get confused by the results. Before trying to apply it to a realistic video, first, try the following artificial examples to understand the behavior:

#! /bin/sh

#
ffmpeg -y -filter_complex "
color=black:s=1280x720:d=30
,fps=12
,drawtext='fontsize=120:fontcolor=white:text=%{frame_num}':x=50:y=100
,drawtext='fontsize=120:fontcolor=white:text=%{pts\:hms}':x=150:y=300
,drawbox=c=white
" text_only_r12.mp4

#
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y \
-i text_only_r12.mp4 -filter_complex "
[0:v]
scale=1280/4:720/4
,tile=layout=4x3
" tile_result_4x3.mp4

#
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y \
-i text_only_r12.mp4 -filter_complex "
[0:v]
scale=1280/4:720/4
,tile=layout=4x3:overlap=11
" tile_result_4x3_overlap11.mp4


As reality videos, I generated the following two videos from the video downloaded from https://www.pexels.com/video/ferry-timelapse-852328/ as input:

#! /bin/sh
ffmpeg -y -i "Ferry Timelapse.mp4" -vf "
setpts=PTS*23.98-STARTPTS,fps=1,fps=12
" -an "Ferry_Timelapse_discr.mp4"

#! /bin/sh
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y \
-i "Ferry Timelapse.mp4" -vf "
setpts=PTS*23.98-STARTPTS,fps=1
,minterpolate=mi_mode=mci:mc_mode=aobmc:fps=12
" -an "Ferry_Timelapse_minterp.mp4"


Here are two examples using these two videos:

#! /bin/sh
pref="basename $0 .sh" # "/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y \ -i "Ferry_Timelapse_discr.mp4" \ -i "Ferry_Timelapse_minterp.mp4" \ -filter_complex " [0:v]scale=1920/3:1080/3[vtl]; [1:v]scale=1920/3:1080/3[vit]; [vtl]tile=layout=3x1,pad='1920:540:0:(oh-ih)/8*7'[vtl_tile]; [vit]tile=layout=3x1,pad='1920:540:0:(oh-ih)/8*1'[vit_tile]; [vtl_tile][vit_tile]vstack,trim=0:180,setpts=PTS-STARTPTS " -an "${pref}_result.mp4"

#! /bin/sh
pref="basename $0 .sh" # "/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y \ -i "Ferry_Timelapse_discr.mp4" \ -i "Ferry_Timelapse_minterp.mp4" \ -filter_complex " [0:v]scale=1920/3:1080/3[vtl]; [1:v]scale=1920/3:1080/3[vit]; [vtl]tile=layout=3x1:overlap=2,pad='1920:540:0:(oh-ih)/8*7'[vtl_tile]; [vit]tile=layout=3x1:overlap=2,pad='1920:540:0:(oh-ih)/8*1'[vit_tile]; [vtl_tile][vit_tile]vstack,trim=0:180,setpts=PTS-STARTPTS " -an "${pref}_result.mp4"