首页 > 解决方案 > ffplay:显示时间戳(暂停时)

问题描述

可以像这样使用 ffplay 显示时间戳:

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

但是,我只想在视频暂停时显示时间戳。

ffplay可以吗?此外,如果可能的话,我希望在浏览视频时暂时显示时间戳。

标签: videoffmpeg

解决方案


不完全符合您的要求,但请尝试mpv使用bookmarker.lua.

创建配置文件后,如https://github.com/nimatrueway/mpv-[bookmark-lua-script][1]所述,您将能够使用以下快捷方式保存/检索时间戳书签(已保存在JSON文件中):

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 

推荐阅读