ffplay:展示时间戳(暂停时)

4

使用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是否可行?如果可能的话,我还希望在浏览视频时临时显示时间戳。


使用 mpvLua 脚本(你可能需要自己制作). - llogan
我更倾向于使用ffplay,因为我已经安装了它,并且依赖ffmpeg进行许多其他操作。但是如果我无法实现ffplay的目标,我一定会考虑安装mpv,谢谢。 - TuxForLife
2个回答

2
并不完全符合您的要求,但可以尝试使用带有“bookmarker.lua”的“mpv”播放器。按照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 

1
我认为这是不可能的,因为ffplay在暂停时不发送任何事件,并且不支持仅在特定时间绘制文本。您应该使用其他软件,如建议的(例如mpv),以更好地控制在视频顶部渲染的内容。另一种选择是创建一个Python脚本,使用OpenCV等工具管理视频并在其上方显示时间戳。

我一直使用VLC,因为我认为它是最好的,但我讨厌它在我的系统上总是很慢地浏览视频。所以我使用FFPlay,它很好而且轻量级,并且可以无问题地浏览。然后我尝试了MPV,我喜欢它比VLC和FFPlay的功能更多。这是一个巨大的生活质量改善,我一直在制作自己的脚本。感谢您的推荐! - TuxForLife

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接