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

* 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
text=%%{eif\\:n/!W!\\:d}"."%%{eif\\:n/!W!*100\\:d\\:2}

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 "drawtext=fontfile=/Windows/Fonts/arial.ttf:fontcolor=yellow:fontsize=42:text=%%{eif\\:n/!W!\\:d}"."%%{eif\\:n/!W!*100\\:d\\:2}:x=15:y=50" -q 8 -vcodec libxvid %~dpn1_sw%~x1

Wolfgang Hugemann
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to