Burn 29.97 Drop-Frame Timecode with FFmpeg

This article provides a step-by-step guide on how to overlay a dynamic, accurate SMPTE timecode onto a 29.97 fps drop-frame video using FFmpeg. You will learn the exact command-line syntax, how FFmpeg handles the drop-frame format, and how to customize the appearance and position of the burnt-in timecode.

The FFmpeg Command

To burn a dynamic 29.97 drop-frame (DF) timecode into a video, you must use the drawtext video filter. In drop-frame timecode, a semicolon (;) is traditionally used as the separator before the frame number to distinguish it from non-drop-frame timecode.

Below is the standard command to burn the timecode:

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

Parameter Breakdown

Understanding how each parameter functions allows you to customize the overlay to fit your specific production needs:

  • fontfile: The absolute path to a TrueType (.ttf) or OpenType (.otf) font on your system. This is required for the text to render. (On Windows, this might be C\:/Windows/Fonts/arial.ttf; on macOS/Linux, /Library/Fonts/Arial.ttf or /usr/share/fonts/...).
  • timecode='00\:00\:00\;00': Sets the starting timecode. Note the escaped colons (\:) and the escaped semicolon (\;) before the frame count. The semicolon tells FFmpeg to render the timecode in drop-frame format.
  • rate=30000/1001: Specifies the frame rate for the timecode calculation. For 29.97 fps video, using the precise fraction 30000/1001 ensures perfect synchronization and accurate drop-frame calculations over long durations. You can also use 29.97.
  • fontsize=48: Sets the size of the timecode text.
  • fontcolor=white: Sets the color of the text.
  • box=1 and boxcolor=black@0.6: Enables a background bounding box behind the text to ensure readability. @0.6 sets the opacity of the black background to 60%.
  • x=(w-tw)/2: Centers the timecode horizontally on the screen (w is video width, tw is text width).
  • y=h-th-50: Places the timecode 50 pixels from the bottom of the video frame (h is video height, th is text height).
  • -c:a copy: Copies the audio stream without re-encoding, preserving the original audio quality and saving processing time.

Customizing the Start Time

If you need the timecode to start at a specific hour, minute, or second (for example, starting at 01:00:00;00 for tape standard), simply update the timecode parameter:

timecode='01\:00\:00\;00'