Skip to content

Instantly share code, notes, and snippets.

@vadimkantorov
Last active November 16, 2023 23:14
Show Gist options
  • Save vadimkantorov/1ac694cd849a70d128f93759e93e6374 to your computer and use it in GitHub Desktop.
Save vadimkantorov/1ac694cd849a70d128f93759e93e6374 to your computer and use it in GitHub Desktop.
Postprocess a Zoom recording video, deleting some intro, overlaying text and lightboxes (to hide participants' faces) and optionally freezing a frame near the end
# unanswered so far :(
# https://video.stackexchange.com/questions/36992/concat-a-video-and-an-audio-using-ffmpeg-freezing-the-last-video-frame-without
# https://superuser.com/questions/1816897/freeze-a-frame-using-ffmpeg
# here are two different approaches:
# 1: boxoverlay #
# - drawtext on video top for the whole video
# - two different box overlays at different video intervals
ffmpeg -i video.mp4 -ss 00:03:10 -vf "drawtext=fontsize=30:fontcolor=pink:x=w*0.4:y=h*0.01:text='https\://exil-solidaire.fr',drawbox=x=0.83*in_w:y=0.48*in_h:w=0.17*in_w:h=0.35*in_h:color=lightblue:t=fill:enable='gt(t,189)',drawbox=y=0.045*in_h:w=in_w:h=in_h:color=lightblue:t=fill:enable='gt(t,1570)'" intro_and_qa_boxoverlay.mp4
# 2: framefreeze #
# - process first part of video
# - extract audio from the second part of the video
# - extract a frame 3 seconds before the end of the first part
# - loop this frame and add audio
# - concat the two resulting parts
ffmpeg -i video.mp4 -ss 00:03:10 -t 00:22:55 -vf "drawtext=fontsize=30:fontcolor=pink:x=w*0.4:y=h*0.01:text='https\://exil-solidaire.fr',drawbox=x=0.83*in_w:y=0.48*in_h:w=0.17*in_w:h=0.35*in_h:color=lightblue:t=fill" -y intro.mp4
ffmpeg -i video.mp4 -ss 00:26:10 -vn -acodec copy -y qa.aac
ffmpeg -sseof -3 -i intro.mp4 -q:v 1 -frames:v 1 -y frame.jpg
ffmpeg -loop 1 -i frame.jpg -i qa.aac -shortest -y qa.mp4
printf "file 'intro.mp4'\nfile 'qa.mp4'" > concat.txt
ffmpeg -f concat -i concat.txt -c copy -y intro_and_qa_framefreeze.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment