Draw time of the current frame in seconds with just 2 digits after point

Viewed 233

I can’t find the way to draw time of the current frame in seconds with just 2 digits after point. I tried “drawtext”, and it does well, however it gives or int seconds, or float with many digits =(

1 Answers

Use the eif function in drawtext. This can be used to compute a value of an expression and print it as integer of specified number of digits. It is used once for each of hours, minutes, seconds and centiseconds.

text='%{eif\:t/3600\:d\:2}\:%{eif\:mod(t/60\,60)\:d\:2}\:%{eif\:mod(t\,60)\:d\:2}\:%{eif\:100*mod(t\,1)\:d\:2}'

Related