overlapping (insufficient)¶
Watch on youtube.com- doc
https://ffmpeg.org/ffmpeg-filters.html#pad, https://ffmpeg.org/ffmpeg-filters.html#overlay, https://ffmpeg.org/ffmpeg-filters.html#blend, https://ffmpeg.org/ffmpeg-filters.html#amerge, https://ffmpeg.org/ffmpeg-filters.html#pan
In video comparison, overlapping should often be allowed.
overlaying simply
00:00:00This approach is simple, and although it is functioning, you probably will not be satisfied with this as well. For the overlapping area, we do not want to give top layer priority.
#! /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},pad=1920:1080:0:0,setsar=1[v1_1];
[1:v]scale=${cx}:${cy},setsar=1[v2_1];
[v1_1][v2_1]overlay=${ox}:${oy}[v];
[0:a][1:a]amerge=inputs=2,pan=stereo|c0<c0+c1|c1<c2+c3[a]
" -map '[v]' -map '[a]' \
"${pref}.mp4"
using ‘blend’
00:00:30This approach is simple, too. And you also will not be satisfied with this. The reason why it gets dark as a whole is because it is an average with the black area (zero). Of course this should not be what you intend, I believe.
#! /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},pad=1920:1080:0:0,setsar=1[v1_1];
[1:v]scale=${cx}:${cy},pad=1920:1080:${ox}:${oy},setsar=1[v2_1];
[v1_1][v2_1]blend=average[v];
[0:a][1:a]amerge=inputs=2,pan=stereo|c0<c0+c1|c1<c2+c3[a]
" -map '[v]' -map '[a]' \
"${pref}.mp4"