DEV Community


How to drawtext colon with pts gmtime using ffmpeg?

Milan Tejani
I Love Code I am Android Developer and Python enthusiast
・1 min read

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?

Discussion (1)

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}'