How to Overlay Timecode on Video with FFmpeg

This article explains how to overlay a dynamic, real-time timecode onto a video using FFmpeg’s powerful drawtext filter. You will learn the exact command-line syntax required to burn a highly visible timecode into your video, customize its position, set the frame rate, and adjust its visual appearance for professional video editing and review workflows.

To overlay a dynamic timecode, you must use the drawtext video filter in FFmpeg. This filter reads the video’s framerate and generates an updating timecode display burned directly into the video frames.

The Basic Command

Here is the standard command to overlay a timecode at 30 frames per second (fps) in the center-bottom of your video:

ffmpeg -i input.mp4 -vf "drawtext=timecode='00\:00\:00\:00':r=30:x=(w-tw)/2:y=h-th-20:fontcolor=white:fontsize=24:box=1:boxcolor=black@0.5" -c:a copy output.mp4

Parameter Breakdown

Understanding how these parameters work allows you to customize the overlay to fit your specific needs:

Setting a Custom Font

By default, FFmpeg will use a system fallback font. If you want to use a specific font (such as Arial or Courier for monospaced numbers), you must specify the path to the font file:

ffmpeg -i input.mp4 -vf "drawtext=fontfile=/path/to/font.ttf:timecode='00\:00\:00\:00':r=23.976:x=(w-tw)/2:y=h-th-40:fontcolor=white:fontsize=32:box=1:boxcolor=black@0.6" -c:a copy output.mp4

Note: For Windows users, the font path might look like fontfile='C\:/Windows/Fonts/arial.ttf'.

Starting at a Specific Timecode

If your video starts at a specific hour or frame, you can adjust the starting value of the timecode parameter:

ffmpeg -i input.mp4 -vf "drawtext=timecode='01\:15\:30\:00':r=24:x=10:y=10:fontcolor=yellow:fontsize=20" -c:a copy output.mp4

This command starts the overlay timecode at 1 hour, 15 minutes, and 30 seconds, and places it in the top-left corner (x=10:y=10) with yellow text.