[FFmpeg-user] Float formatting in drawtext (Stop watch)

Wolfgang Hugemann auto at hugemann.de
Mon May 29 16:10:05 EEST 2017

With a little more research (and somewhat more knowledge about ffmpeg) I 
came to the following solution for a stopwatch with a defined decimal 

* get the framerate via ffprobe and store it in a variable (i.e. !W!)
* divide the frame number by this rate
* display the result in two parts via

NOTE: I am working under Windows, therefore somewhat exotic escaping in 
batch files.

An offset could easily be accounted for by subtracting a user-provided 
integer from 'n'.

Allowing for printf-style formatting of decimals in drawtext would still 
be easier ...

The whole Windows batch code thus looks like:

SETLOCAL EnableDelayedExpansion
for /f "tokens=2 delims==/" %%i in ('C:\programme\ffmpeg\bin\ffprobe.exe 
-v error -of flat^=s^=_ -select_streams v:0 -show_entries 
stream^=r_frame_rate %1') do set W=%%~i
c:\Programme\ffmpeg\bin\ffmpeg -i %1 -y -filter:v 
-q 8 -vcodec libxvid %~dpn1_sw%~x1

Wolfgang Hugemann

More information about the ffmpeg-user mailing list