bash Linux 通过命令行控制一个正在运行的 vlc 进程
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 
原文地址: http://stackoverflow.com/questions/14256193/
Warning: these are provided under cc-by-sa 4.0 license.  You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Linux control a running vlc process through command line
提问by Shrouk Khan
is there any way to control an already running VLC player on ubuntu. For example, i am trying to start a vlc video full screen with a default audio.
有什么方法可以控制 ubuntu 上已经运行的 VLC 播放器。例如,我正在尝试使用默认音频全屏启动 vlc 视频。
and then control the volume and other features through netcat or some other command remotely. is it possible?
然后通过netcat或其他一些命令远程控制音量和其他功能。是否可以?
回答by Brian Agnew
回答by Scz
The script player controlfrom exic's answeris just a wrapper for some dbuscommands.
To use them without the script, try the following:
该脚本player control从exic的回答仅仅是对一些包装dbus的命令。要在没有脚本的情况下使用它们,请尝试以下操作:
dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
The last PlayPausecan be replaced with, e.g., Play, Pause, Previous, Next.
最后PlayPause可以被替换,如Play,Pause,Previous,Next。
If you have qdbusinstalled, it can be used as an alternative to dbus-send:
如果您已经qdbus安装,它可以用作替代dbus-send:
qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
A list of all available calls can be obtained by leaving out the last argument:
通过省略最后一个参数可以获得所有可用调用的列表:
qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2
回答by dye46
If you enable the HTTP remote interface on VLC, you can control VLC remotely with a web browser, or even an app on your phone.
如果在 VLC 上启用 HTTP 远程接口,则可以使用 Web 浏览器甚至手机上的应用程序远程控制 VLC。
With the HTTP interface enabled, you can also use wget or curl commands to send commands.
启用 HTTP 接口后,您还可以使用 wget 或 curl 命令发送命令。
For example, enable VLC's HTTP interface (default port: 8080) with "password" for a password. Then you can issue curl commands, either remotely or locally:
例如,使用“password”作为密码启用VLC的HTTP接口(默认端口:8080)。然后您可以远程或本地发出 curl 命令:
To pause:
暂停:
curl -s -o /dev/null -u :password http://192.168.1.11:8080/requests/status.xml?command=pl_pause
To play:
玩:
curl -s -o /dev/null -u :password http://192.168.1.11:8080/requests/status.xml?command=pl_play
To play a specific playlist entry number:
要播放特定的播放列表条目编号:
curl -s -o /dev/null -u :password http://192.168.1.11:8080/requests/status.xml?command=pl_play&id=22
To change volume:
改变音量:
curl -s -o /dev/null -u :password http://192.168.1.11:8080/requests/status.xml?command=volume&val=133
Other command info: https://wiki.videolan.org/VLC_HTTP_requests/
回答by exic
I'm controlling it remotely using dbus. VLC has implemented the MPRIS2 specification:
我正在使用 dbus 远程控制它。VLC 已经实现了 MPRIS2 规范:
- Control player(e. g. run - player-control vlc toggle)
- Get current status(with argument - vlc)

