使 MPlayer 在输出中显示所有播放状态更改消息
我目前在从属模式下使用 MPlayer 作为我正在制作的视频播放器。
截至目前,媒体播放器在暂停时会显示 ==== PAUSED ====
,我可以读取此状态的输出以了解视频何时暂停。
我现在使用的命令行参数是 msglevel recognize=6:statusline=-1
(我禁用了 statusline,因为它产生了 A: 0.7 V: 0.6 AV: 0.068 ...< /code> 和不必要的东西)
我需要什么来设置 msglevel (或其他任何内容),以便它也显示 ==== PLAYING ====
或任何开始播放、停止、媒体结束、加载的指示, ETC?
I'm currently using MPlayer in slave mode for a video player im making.
As of currently, the media player shows ==== PAUSED ====
when it's paused and I can read the output for this status to know when the video is paused.
The command line arg i am using as of now is msglevel identify=6:statusline=-1
(i disabled statusline as it produced A: 0.7 V: 0.6 A-V: 0.068 ...
and unneccessary stuff)
What do I need to set the msglevel (or anything else) so that it will also show ==== PLAYING ====
or any indication that it started playing, stopped, media ended, loading, etc?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了如何获取视频是否暂停的信息。
通过向 mplayer 发送命令
pausing_keep_force get_propertypause
,如果未暂停,则返回ANS_pause=no
;如果暂停,则返回ANS_pause=yes
。问题解决了。I found out how to get if the video is paused.
By sending command
pausing_keep_force get_property pause
to mplayer, it responds withANS_pause=no
if not paused, andANS_pause=yes
if paused. Problem solved.根据我从 OP 对他/她自己的问题的回答中可以解读的内容,他/她正在寻找一种方法来确定 mplayer 是暂停还是播放。我编写了一个小 bash 脚本,可以通过一些简单的函数调用来处理此任务。
您实际上可以检查 mplayer 输出的最后几行来查看 mplayer 是否已暂停。我整理了一个小型 bash 库,可用于查询有关 mplayer 的一些状态信息。查看我的 GitHub。有将我的脚本与其他 bash 脚本集成的说明。
如果您实现我的脚本,您将需要使用
playMediaFile
函数播放媒体文件。然后您可以简单地调用 isPaused 函数作为 bash 中的条件,如下所示:Based on what I can decipher from the OP's answer to his/her own question, he/she was looking for a way to determine whether mplayer was paused or playing. I've written a little bash script that can handle this task with some simple function calls.
You can actually inspect the last couple lines of mplayer's output to see if mplayer is paused. I put together a little bash library that can be used to query some status information about mplayer. Take a look on my GitHub. There are instructions for integrating my script with other bash scripts.
If you implement my script, you will need to play your media file using the
playMediaFile
function. Then you can simply call theisPaused
function as a condition in bash like this: