batch-fileffmpegffplay

Issues with adding the current timestamp of a video when using FFPLAY


Hi i am trying to add to display the current time of the video as an overlay. i have tried to do follow the answer of this previous post: https://superuser.com/questions/968685/how-to-display-current-time-with-the-ffplay-exe but with no luck.

This is my line of code:

"./ffmpeg-2023-01-25-git-2c3107c3e9-full_build/bin/ffplay.exe" -vf "drawtext=fontfile=./consola.ttf:text='%{pts:hms}':fontsize=48:fontcolor=white:box=1:boxborderw=6:boxcolor=black@0.75:x=(w-text_w)/2:y=h-text_h-20" -i "%shadowplays_folder%\%NEWEST_FOLDER%\%NEWEST_FILE%" -autoexit -x "1000" -alwaysontop

This will display the text "hms}" not the time.

the above code works fine if i replace it with a simple string:

"./ffmpeg-2023-01-25-git-2c3107c3e9-full_build/bin/ffplay.exe" -vf "drawtext=fontfile=./consola.ttf:text='test':fontsize=48:fontcolor=white:box=1:boxborderw=6:boxcolor=black@0.75:x=(w-text_w)/2:y=h-text_h-20" -i "%shadowplays_folder%\%NEWEST_FOLDER%\%NEWEST_FILE%" -autoexit -x "1000" -alwaysontop

This will display the text "test"

what am i missing?


Solution

  • Try '%%{pts:hms}' in place of '%{pts:hms}'

    % needs to be escaped by another % to be interpreted literally.