drawboxΒΆ

Watch on youtube.com
doc

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

00:00:00
#! /bin/sh
pref="`basename $0 .sh`"
#
ffmpeg -y -filter_complex "
color=black:s=1920x1080:d=12,
drawbox=x=700:y=400:w=160:h=90:color=blue:t=5[v]
" -map '[v]' -an \
  "${pref}.mp4"
00:00:12
#! /bin/sh
pref="`basename $0 .sh`"
ifn="Pexels_flowers_fast.mp4"
ifnb="`basename \"${ifn}\" .mp4`"

#
ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]
drawbox=x=700:y=400:w=640:h=360:color=red@0.5:t=10
[v]
" -map '[v]' -an \
  "${pref}_${ifnb}.mp4"
00:00:24
#! /bin/sh
pref="`basename $0 .sh`"
ifn="Pexels_flowers_fast.mp4"
ifnb="`basename \"${ifn}\" .mp4`"

#
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y \
    -i "${ifn}" -filter_complex "
[0:v]
drawbox=x=700:y=640:w=640:h=360:color=yellow@0.5:t=fill
[v]
" -map '[v]' -an \
  "${pref}_${ifnb}.mp4"
00:01:20
#! /bin/sh
pref="`basename $0 .sh`"
vleft="va_1.mp4"
vright="va_2.mp4"
#
fac=${1:-80}
cx=$((16 * ${fac}))
cy=$((9 * ${fac}))
ox=$((1920 - 16 * ${fac}))
oy=$((1080 - 9 * ${fac}))
#
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/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,drawbox=c=red@0.5:t=5,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},drawbox=c=blue@0.5:t=20[0v_c];
[1v_2]crop=${cx}-${ox}:${cy}-${oy}:0:0,drawbox=c=yellow@0.5:t=fill[1v_c];
[0v_c][1v_c]blend=all_mode=average[v_c];

[v_ov][v_c]overlay=x=${ox}:y=${oy},fade=t=out:st=27:d=3[v]" \
    -map '[v]' -to 00:00:30 -an "${pref}.mp4"