ffplay: Show timestamp (When paused)

Viewed 1413

It's possible to show the timestamp with ffplay like this:

ffplay -vf "drawtext=text='%{pts\:hms}':fontcolor=white:shadowcolor=black:shadowx=3:shadowy=3:fontsize=48:x=(w-tw)/2:y=h-(2*lh)" video.mp4

However, I would like to show the timestamp only when the video is paused.

Is this possible with ffplay? Additionally, I'd like the timestamp to show temporarily when seeking through the video, if possible.

2 Answers

Not exactly what you're requesting but try mpv with bookmarker.lua.

After creating a config file, as described on https://github.com/nimatrueway/mpv-[bookmark-lua-script][1], you'll be able to use the following shortcuts to save/retrieve timestamp bookmarks (saved in a JSON file):

Ctrl+1 script_message bookmark-set  1       #  `Ctrl+1` will "save current filePath and seekPos to bookmark #1 slot"
Alt+1  script_message bookmark-load 1       #  `Alt+2` will "restore current filePath and seekPos from bookmark #1 slot"
Alt+Ctrl+1  script_message bookmark-peek 1  #  `Alt+Ctrl+2` will give you a "peek of the filename, its immediate parent directory and seek-pos saved in the bookmark #1 slot"
Ctrl+2 script_message bookmark-set  2
Alt+2  script_message bookmark-load 2
Alt+Ctrl+2  script_message bookmark-peek 2
s script_message bookmark-update            # `s` will update last saved/restored bookmark
d script_message bookmark-peek-current      # `d` will peek last saved/restored bookmark (lastest saved/restored bookmark is only considered if current file is in the same directory as the bookmark file)
u script_message bookmark-set-undo          # `u` will undo/revert last save or update action 

I don't think this is possible as ffplay doesn't send any event when paused and doesn't support drawing the text only on certain time.

You should use a different software like suggested (mpv for example), to have more control on what you render on top of the video.

An alternative is to also create a Python script that manages the video and displays the timestamp on top of it, with OpenCV for example.

Related