I am trying to capture frames using FFmpeg and add current timestamp on to it.
Below code is working fine for a Linux PC :
ffmpeg -i input -vf "drawtext=fontfile=/usr/share/fonts/TTF/Vera.ttf: text='%{localtime}': x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1" image%03d.png
But same is not working for Windows because of:
-vf
option.fontfile=/usr/share/fonts/TTF/Vera.ttf
is not valid for Windows PC.I tried editing and removing it with some other option but nothing worked.
What I have tried so far is:
text='%{localtime\:%X}%{pts\:hms}'
The above prints local time and the pts. I need to add both and print, so that I could get it exactly correct.
Any kind of help would be appreciated. I am cracking my head for this from last couple of hours.
I got it working. Just posting it here :
ffmpeg -i input -vf "drawtext=fontfile=/Windows/Fonts/Arial.ttf: text='%{localtime}': x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1: fontsize=30" -r 25 -t 5 image%03d.png
Another approach that get's you timestamps with millisecond granularity is
ffmpeg -i input.mp4 -vf drawtext="fontsize=60:fontcolor=yellow:text='%{e\:t*1000}':x=(w-text_w):y=(h-text_h)" output.mp4
User contributions licensed under CC BY-SA 3.0