6

I need to play video files by the ffplay (or the ffmpeg if is it possible) and display current play time.

Please tell me how can I see the current play time (as H:M:S) with ffplay?

OS = MS Windows 7

3 Answers 3

8

rgbtestsrc filter

ffplay -vf "drawtext=text='%{pts\:hms}':box=1:x=(w-tw)/2:y=h-(2*lh)" input.mp4
  • If your build does not support fontconfig, then you'll have to add the fontfile option with the path to the font. See drawtext filter docs for more info.

  • In Windows you may have to first set the FONTCONFIG_PATH variable (and/or other related variables).

  • You can add boxborderw=4 if you want more padding in the box, but you'll need a relatively recent build. See the FFmpeg Download page.

3
  • I could only get a second timecode using %{pts}, but not hh:mm:ss via {pts:hms}, not until I got all my quoting exactly correct (single, double, backslash), exactly as shown; i.e., ffplay -vf "...text='{pts\:hms}' ..."
    – michael
    Commented Nov 13, 2017 at 5:50
  • Is it possible to remove the miliseconds and let only HH:MM:SS? Commented Nov 1, 2021 at 16:20
  • 1
    @RicardoBohner stackoverflow.com/a/67409424
    – llogan
    Commented Nov 1, 2021 at 18:07
1

For more options, there's this tip, direct from FFMPEG on Twitter:

-vf "drawtext=text='%{pts\:hms}':fontsize=48:fontcolor=white:box=1:boxborderw=6:[email protected]:x=(w-text_w)/2:y=h-text_h-20"
1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Mar 9, 2022 at 13:34
0

How to use drawtext displays the current localtime on windows

ffmpeg.exe -re -i "c:\aaa.avi" -vf drawtext="fontfile=simhei.ttf:fontsize=14:fontcolor=white:shadowcolor=black:shadowx=2:shadowy=1:x=8:y=8:text='???'" -q 5 -s 720*405 -aspect 16:9 -r 15 -threads 4 -vcodec flv -acodec libmp3lame -ar 44100 -ab 64k -ac 2 -f flv "rtmp://127.0.0.1/aaa/flv"

Maybe this helps

4
  • Thanks ,But I get this error : RTMP_Connect0, failed to connect socket. 10061 (Unknown error) rtmp://127.0.0.1/aaa/flv: Unknown error occurred
    – user476650
    Commented Sep 5, 2015 at 12:40
  • Also I need to display current play time of video.( no current localtime)
    – user476650
    Commented Sep 5, 2015 at 12:47
  • Did you follow the link "Maybe this helps" in the comment?
    – Gio_sof
    Commented Sep 5, 2015 at 16:10
  • Yes I did , but it doesn't work for me.
    – user476650
    Commented Sep 5, 2015 at 18:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .