Overlay Dynamic Timecode and Frame Count with FFmpeg

This article provides a step-by-step guide on how to overlay a dynamic, real-time timecode and custom frame count onto a video using FFmpeg. You will learn the exact command-line syntax to burn this metadata directly into your video files, customize the starting frame number, and format the visual output for professional video editing and QA workflows.

To overlay both a dynamic timecode and a custom frame count, you will use FFmpeg’s drawtext video filter. This filter allows you to render text on top of a video stream using various system variables, such as pts for time and n for frame numbers.

The FFmpeg Command

Below is the complete command to overlay a dynamic timecode in the top-left corner and a custom frame count (starting at a designated number) in the top-right corner:

ffmpeg -i input.mp4 -vf "drawtext=fontfile=/path/to/font.ttf:timecode='00\:00\:00\:00':rate=30:x=10:y=10:fontsize=24:fontcolor=white:box=1:boxcolor=black@0.5, drawtext=fontfile=/path/to/font.ttf:text='Frame\: %{eif\:n+1000\:d}':x=w-tw-10:y=10:fontsize=24:fontcolor=white:box=1:boxcolor=black@0.5" -c:a copy output.mp4

Parameter Breakdown

To customize this command for your specific video file, understand how the key parameters function: