Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux Shell: VLC programming

Is there a way to manipulate VLC with a Linux shell script without the script waiting for VLC to close.

cvlc test.mp3
echo "Now playing!"
sleep 200
cvlc://pause:60

This code keeps running VLC until the file is completed, and then evidently it is to late to pause the file.

like image 432
Willem Van Onsem Avatar asked Jan 20 '12 15:01

Willem Van Onsem


People also ask

Does VLC have a CLI?

The rc module is a interactive command line interface. It allows you to type commands to make VLC do things. To start it, run vlc --intf rc . This is the default interface if no GUI environment is available.

Can I use VLC on Linux?

VLC is supported by a number of Linux distros. And much like any other software, there are different ways to install VLC on all of these different distros. Using the default package manager happens to be the most obvious choice for many Linux users.

What is VLC programming?

VLC is a free and open source cross-platform multimedia player and framework that plays most multimedia files as well as DVDs, Audio CDs, VCDs, and various streaming protocols. VLC is a free and open source cross-platform multimedia player and framework that plays most multimedia files, and various streaming protocols.


1 Answers

You need to use dbus interface of VLC.

enter image description here

Now, you can use the mpris interface of VLC. It's a standard for most players like clementine, banshee, songbird, spotify etc.

So, lets suppose you want to Pause the currently playing song.

dbus-send --print-reply --session --dest=org.mpris.vlc /Player org.freedesktop.MediaPlayer.Pause

To play a song:

dbus-send --print-reply --session --dest=org.mpris.vlc /Player org.freedesktop.MediaPlayer.Play

I generally use qdbusviewer to know about the dbus-interface available to me.

like image 66
Abhijeet Rastogi Avatar answered Nov 14 '22 03:11

Abhijeet Rastogi