FFmpeg - Add duration timestamp counter in video

By xngo on June 9, 2019

Here is the command to add duration timestamp counter on a video:

ffmpeg -y   -i wildlife-music.mp4 \
            -vf "drawtext=text='%{pts\:hms}': \
                          x=(w-tw)/2: y=h-(2*lh): \
                          fontsize=36: fontcolor=white: \
                          box=1: boxcolor=0x00000000@1" \
            ffmpeg-timestamp-counter.mp4

Output

Add duration timestamp counter

References

  • https://ffmpeg.org/ffmpeg-utils.html#Quoting-and-escaping
  • https://ffmpeg.org/ffmpeg-filters.html#Text-expansion

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.