Using pad, overlay and blend … (3)¶
Watch on youtube.com- doc
https://ffmpeg.org/ffmpeg-filters.html#blend, https://ffmpeg.org/ffmpeg-filters.html#pad, https://ffmpeg.org/ffmpeg-filters.html#overlay, https://ffmpeg.org/ffmpeg-filters.html#split, https://ffmpeg.org/ffmpeg-filters.html#amerge, https://ffmpeg.org/ffmpeg-filters.html#pan
In video comparison, overlapping should often be allowed.
The approach shown here is an approach that seems rather absurd than the one shown earlier. However, depending on the input, the processing performance is the best compared with the previous one and two before.
#! /bin/sh
pref="`basename $0 .sh`"
vleft="EuropeanArchive.mp4"
vright="Eduardo.mp4"
#
fac=${1:-80}
cx=$((16 * ${fac}))
cy=$((9 * ${fac}))
ox=$((1920 - 16 * ${fac}))
oy=$((1080 - 9 * ${fac}))
#
ffmpeg -y -i "${vleft}" -i "${vright}" -filter_complex "
[0:v]scale=${cx}:${cy},setsar=1,split[0v_1][0v_2];
[1:v]scale=${cx}:${cy},setsar=1,split[1v_1][1v_2];
[0v_1]pad=1920:1080:0:0[0v_p];
[0v_p][1v_1]overlay=x=W-w:y=H-h[v_ov];
[0v_2]crop=${cx}-${ox}:${cy}-${oy}:${ox}:${oy}[0v_c];
[1v_2]crop=${cx}-${ox}:${cy}-${oy}:0:0[1v_c];
[0v_c][1v_c]blend=all_mode=average[v_c];
[v_ov][v_c]overlay=x=${ox}:y=${oy}[v];
[0:a][1:a]amerge=inputs=2,pan=stereo|c0<c0+c1|c1<c2+c3[a]
" -map '[v]' -map '[a]' \
"${pref}.mp4"