DEV Community

Milan Tejani
Milan Tejani

Posted on

How to drawtext colon with pts gmtime using ffmpeg?

I am adding timestamp to video using FFMPEG where i am using below command:

ffmpeg -y -i input.mp4 -vf "drawtext=fontfile=roboto.ttf:fontsize=36:fontcolor=yellow:text='%{pts:gmtime:1575526882:%d/%m/%y %H:%M}'" -preset ultrafast -f mp4 output.mp4

in this command i am using : between %H and %M in text attribute of drawtext

like this:
text='%{pts:gmtime:1575526882:%d/%m/%y %H:%M}'

because i want to print time like this 06:25

it show me this error: Unterminated %{} near '{pts:gmtime:1575526882:%d/%m/%y %H'

how can i print : between %H and %M where %H is for hours and %M is for minutes?

Top comments (1)

Collapse
 
shadowfwm profile image
Hashan Madhubhashana

Looks like the colon (:) is used for seperating params there. Therefore, you may want to use text='%{pts:gmtime:1575526882:%d/%m/%y %H}:%{pts:gmtime:1575526882:%M}'