[FFmpeg-user] Float formatting in drawtext

Wolfgang Hugemann Auto at Hugemann.de
Fri Jan 27 12:05:04 EET 2017


OK, maybe I put my question the wrong way:

I would like to display a stop watch starting at an arbitrary time in 
the video (usually the collision of two cars for accident reconstruction 
purposes). This can obviously be done via drawtext and pts, but the 
result looks nasty, and I seem to have no control on the formatting of 
the string displayed.

So possibly there is another way to acchieve this? Could I for example 
store a string in a user-defined frame-wise variable and display its 
value by drawtext as is done when deciphering the VITC:

ffmpeg -i sample-vitc.avi -filter:v 
"readvitc,drawtext=fontfile=FreeMono.ttf:fontcolor=white:text=%{metadata\\:lavfi.readvitc.tc_str}:x=(w-tw)/2:y=400-ascent" 
-f avi -codec:v huffyuv test.avi

(Code by Tobias Rapp)

Any help would be appreciated.

Wolfgang Hugemann



Am 23.01.2017 um 16:13 schrieb Wolfgang Hugemann:
> Hey,
>
> seems to be an easy question, but I have been searching for the answer
> quite a while without success:
>
> If I perform a float calculation via
>    text=%{expr\:whatever}
> is there any way to format the output the printf way?
>
> I know, the result could be converted to integer and be formatted via
>    text=%{eif\:whatever\:d}
> but this is restricted to integer results.
>
> Wolfgang Hugemann


More information about the ffmpeg-user mailing list