Creating an Elapsed Timer with Transparent Background using FFmpeg

Create Timer with Transparent Background (Apple ProRes codec, prores_ks)
ffmpeg -f lavfi -i color=white@0.0:s=240x96,format=rgba -ss 00:00:00 -t 00:48:00 -vf "drawtext=fontfile=/System/Library/Fonts/Monaco.dfont:text='%{pts\:gmtime\:0\:%M\\\\\:%S}':fontcolor=white:fontsize=64:x=(w-tw)/2:y=(h-th)/2" -vcodec prores_ks timer_prores.mov
Create Timer with Transparent Background (Apple Animation Codec, qtrle)
ffmpeg -f lavfi -i color=white@0.0:s=240x96,format=rgba -ss 00:00:00 -t 00:48:00 -vf "drawtext=fontfile=/System/Library/Fonts/Monaco.dfont:text='%{pts\:gmtime\:0\:%M\\\\\:%S}':fontcolor=white:fontsize=64:x=(w-tw)/2:y=(h-th)/2" -vcodec qtrle timer_qtrle.mov

Note: On Window systems, access the fonts like this: “/Windows/Fonts/arial.ttf”. You can’t use the traditional “C:\Windows\Fonts\arial.ttf” because the colon is a reserved character in the FFmpeg syntax.

Overlay Time on Picture/Video
ffmpeg -i main_video.mp4 -i timer_qtrle.mov -filter_complex "[0:v][1:v]overlay" merge.mov

FFmpeg Playlist: https://www.youtube.com/playlist?list=PLErU2HjQZ_ZOPDZ71Khzt5PX4X4j6flkg

FFmpeg notes: https://www.rickmakes.com/ffmpeg-notes/

Leave a comment

Your email address will not be published. Required fields are marked *