ffmpeg filter to add timestamp on video
6,843
Solution 1
try this command:
ffmpeg -y -i input.mp4 -vf "drawtext=fontfile=roboto.ttf:fontsize=36:fontcolor=yellow:text='%{pts\:gmtime\:1575526882\:%A, %d, %B %Y %I\\\:%M\\\:%S %p}'" -preset ultrafast -f mp4 output.mp4
made changes in command as per your need.
also refer below links it will give you more idea about timestamp:
strftime - format date and time
Solution 2
I use the following filter:
-vf drawtext=fontfile=/usr/share/fonts/truetype/freefont/FreeMonoBold.ttf:text='%{localtime}':[email protected]:x=7:y=7
I put this filter between the input specifications and the output specifications.
You just have to adapt:
-
x=XX
andy=YY
depending on the wished position. -
fontfile=
depending on the fonts available on your system.
Related videos on Youtube
Author by
Lea... FFmpeg
Updated on September 18, 2022Comments
-
Lea... FFmpeg over 1 year
I have a problem displaying the timer on the video. I have consulted a few examples, but it does not show success. Help me fix it.
-
Elisa Cha Cha over 4 yearsCopy and paste your ffmpeg command into your question so we can try it ourselves.
-
Lea... FFmpeg over 4 yearsYou can see the image I have attached to the above
-
Elisa Cha Cha over 4 yearsYes, but I could not copy and paste your command to easily debug it, and there are too many other questions to answer for me to look at the image and re-type it.
-
-
Lea... FFmpeg over 4 yearsI tried but having trouble displaying. they don't show the time, they are just characters.
-
John Smith over 3 yearsThanks, this worked perfectly for me on the first try. I removed the "fontfile=/...ttf" part completely and it used a default font. Adding :fontsize=24 before :fontcolor made it bigger, too.