Burn Local Timezone Timestamps onto Video with FFmpeg

Burning a highly accurate, localized timestamp onto a video is a crucial requirement for security footage, dashcams, and event recordings. Using FFmpeg’s powerful drawtext video filter, you can overlay the current local system time, display specific timezone abbreviations, or even synchronize a custom start time with the video’s presentation timestamp (PTS). This guide will show you how to implement these solutions using clear, production-ready FFmpeg commands.

Overlaying the System’s Local Time

To burn the current local time of the machine running the command, use FFmpeg’s localtime function inside the drawtext filter. The %Z format specifier is used to display the local timezone abbreviation (e.g., EST, CET, or UTC).

Run the following command:

ffmpeg -i input.mp4 -vf "drawtext=text='%{localtime\:%Y-%m-%d %H\\:%M\\:%S %Z}':x=10:y=10:fontsize=24:fontcolor=white:box=1:boxcolor=black@0.5" -c:a copy output.mp4

How It Works:


Specifying a Different Timezone

If you are running the command on a cloud server configured to UTC but want the video to display a specific local timezone (such as America/New_York or Europe/London), you can temporarily set the TZ environment variable before running the FFmpeg command.

On Linux and macOS:

TZ="America/New_York" ffmpeg -i input.mp4 -vf "drawtext=text='%{localtime\:%Y-%m-%d %H\\:%M\\:%S %Z}':x=10:y=10:fontsize=24:fontcolor=white:box=1:boxcolor=black@0.5" -c:a copy output.mp4

On Windows (Command Prompt):

set TZ=America/New_York
ffmpeg -i input.mp4 -vf "drawtext=text='%%{localtime\:%%Y-%%m-%%d %%H\\:%%M\\:%%S %%Z}':x=10:y=10:fontsize=24:fontcolor=white:box=1:boxcolor=black@0.5" -c:a copy output.mp4

(Note: In Windows Command Prompt, percent signs % must be doubled %% to prevent the shell from parsing them as variables).

On Windows (PowerShell):

$env:TZ="America/New_York"
ffmpeg -i input.mp4 -vf "drawtext=text='%{localtime\:%Y-%m-%d %H\\:%M\\:%S %Z}':x=10:y=10:fontsize=24:fontcolor=white:box=1:boxcolor=black@0.5" -c:a copy output.mp4

Burning a Video Start Time Linked to the Timeline

If you want the timestamp to represent the actual time the video was recorded rather than the time you are running the FFmpeg command, you must use the pts parameter. This allows the clock to start at a specific Unix epoch timestamp and increment progressively with the video’s playback.

To do this, convert your local recording start time to a Unix epoch timestamp (seconds since January 1, 1970). For example, 1706784000 represents 2024-02-01 11:00:00 UTC.

Use the following syntax:

ffmpeg -i input.mp4 -vf "drawtext=text='%{pts\:localtime\:1706784000\:%Y-%m-%d %H\\:%M\\:%S %Z}':x=10:y=10:fontsize=24:fontcolor=white:box=1:boxcolor=black@0.5" -c:a copy output.mp4

Key Parameters: