9

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.

and then control the volume and other features through netcat or some other command remotely. is it possible?

Shrouk Khan
  • 1,440
  • 6
  • 27
  • 53

4 Answers4

12

The script player control from exic's answer is just a wrapper for some dbus commands. To use them without the script, try the following:

dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause

The last PlayPause can be replaced with, e.g., Play, Pause, Previous, Next.

If you have qdbus installed, it can be used as an alternative to 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
Scz
  • 650
  • 7
  • 13
  • It seems that setting the volume with `qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Volume 0.5` always sets the volume to `0` due to a bug, though. – Scz Jul 17 '17 at 11:28
  • Easy, simple and usable. – shgnInc Jun 09 '19 at 06:00
11

Have you looked at the rc (remote control) interface ? It controls a VLC process via a Unix Domain Socket. See here and here for more info.

O1G
  • 71
  • 1
  • 7
Brian Agnew
  • 268,207
  • 37
  • 334
  • 440
  • Always bring the relevant information into your answer because links break. As your (first one) has and your second one eventually will too. – fivedogit Feb 09 '21 at 15:10
3

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.

With the HTTP interface enabled, you can also use wget or curl commands to send commands.

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:

Curl Prefix

For brevity I will show the first part of the curl command here (the IP will most likely be your localhost, but the 8080 port is the default:

 curl -s -o /dev/null -u :password http://192.168.1.11:8080

then combine with the actions:

To pause:

.../requests/status.xml?command=pl_pause

To play:

.../requests/status.xml?command=pl_play

To play a specific playlist entry number:

.../requests/status.xml?command=pl_play&id=22

To change volume:

.../requests/status.xml?command=volume&val=133

Other command info: https://wiki.videolan.org/VLC_HTTP_requests/

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
dye46
  • 31
  • 3
1

I'm controlling it remotely using dbus. VLC has implemented the MPRIS2 specification:

exic
  • 2,220
  • 1
  • 22
  • 29