FFmpeg Add Timecode Overlay Starting at 10:00:00:00

Adding a timecode overlay to a video is a standard practice in post-production and broadcasting for synchronization, review, and editing. In FFmpeg, this is accomplished using the drawtext video filter, which allows you to define a specific starting timecode, such as 10:00:00:00, alongside custom positioning, frame rates, and styling. This guide provides the complete FFmpeg command required to generate a timecode overlay starting at ten hours and explains how each parameter works.

The FFmpeg Command

To burn a timecode starting at 10:00:00:00 directly onto your video, run the following command in your terminal:

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

Parameter Breakdown

  • -i input.mp4: Specifies the source video file.
  • -vf "drawtext=...": Calls the drawtext video filter to render text directly onto the video frames.
  • timecode='10\:00\:00\:00': Sets the starting timecode to 10 hours. Colons must be escaped with backslashes (\:) within the filter string so FFmpeg does not interpret them as parameter delimiters.
  • rate=30: Defines the frame rate for the timecode calculation. This must match your video's frame rate (e.g., 24, 25, 29.97, 30, or 60) to prevent the timecode from drifting out of sync.
  • x=(w-tw)/2: Centers the timecode horizontally across the frame (w is video width, tw is text width).
  • y=h-th-20: Positions the timecode near the bottom of the screen, 20 pixels up from the lower edge (h is video height, th is text height).
  • fontsize=32: Sets the size of the font in pixels.
  • fontcolor=white: Sets the text color.
  • box=1:boxcolor=black@0.6:boxborderw=5: Draws a semi-transparent black background rectangle (60% opacity) with a 5-pixel padding around the timecode to ensure legibility over bright footage.
  • -c:a copy: Copies the audio stream without re-encoding, saving processing time and preserving original audio quality.

Important Considerations

  1. Specifying a Font: By default, FFmpeg looks for a default system font. If you receive a font-related error, explicitly point to a TrueType font file on your system using the fontfile option:

    fontfile=/path/to/font.ttf
  2. Drop-Frame Timecode: If your project runs at 29.97 fps and requires drop-frame timecode notation, separate the final frame delimiter with a semicolon instead of a colon:

    timecode='10\:00\:00\;00':rate=30000/1001