Selecting audio device from command line

*nix specific usage questions
Padowan
New Cone
New Cone
Posts: 3
Joined: 27 May 2016 14:10

Selecting audio device from command line

Postby Padowan » 27 May 2016 14:36

I am trying to start VLC from the command line on a Raspberry Pi and play on a bluetooth speaker. I have tried using this:
vlc music.mp3 --aout="My Speaker"

Unfortunately it doesn't work but is playing on the analog output. Inside the VLC GUI I can see My Speaker in the Audio|Audio Device menu. And it works if I select the speaker in the menu, but I want to select it from the command line.

I now realize that I might have misunderstood the --aout argument, as it seems to specify module and not device. But I cannot figure out how to specify the device from the command line.

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Selecting audio device from command line

Postby Rémi Denis-Courmont » 27 May 2016 17:31

Whether it's possible and how, depends on the audio output plugin.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

kmf31
Cone that earned his stripes
Cone that earned his stripes
Posts: 308
Joined: 11 Mar 2007 21:47

Re: Selecting audio device from command line

Postby kmf31 » 27 May 2016 19:15

If the different devices correspond to alsa devices the correct command line is:

vlc music.mp3 --aout=alsa --alsa-audio-device="alsa device"

where "alsa device" may be a typical alsa hardware device or some virtual alsa device a user may have defined in ~/.asoundrc (google: "asoundrc" for some information how this works).

If you want to you use pulse audio you can use:

vlc music.mp3 --aout=pulse

and then afterwards "pavucontrol" to select different devices within pulse (which may be more convenient). The "--aout" option may be omitted if the corresponding audio module is selected as default in the preferences (typically either alsa or pulse).

Padowan
New Cone
New Cone
Posts: 3
Joined: 27 May 2016 14:10

Re: Selecting audio device from command line

Postby Padowan » 28 May 2016 10:50

Thanks a lot for the answer, kmf31. My knowledge about this is very limited, but it looks like alsa does not work with the bluetooth stack.

Selecting the speaker inside pavucontrol seems to work. Do you know how to do this from the command line? I need to do this from a script running on the Raspberry Pi without mouse or keyboard.

kmf31
Cone that earned his stripes
Cone that earned his stripes
Posts: 308
Joined: 11 Mar 2007 21:47

Re: Selecting audio device from command line

Postby kmf31 » 28 May 2016 11:48

You can try to get some ideas from here:
http://ubuntuforums.org/showthread.php?t=1132200

Apart from this you need to search how bluetooth speakers are accessed/configured inside pluse-audio. Apparently this is possible and there seems to be some information, tutorials on the net.

Padowan
New Cone
New Cone
Posts: 3
Joined: 27 May 2016 14:10

Re: Selecting audio device from command line

Postby Padowan » 31 May 2016 08:28

Thanks for the help. I ended up disabling the internal analog output with pavucontrol. This made vlc always use the bluetooth speaker.

aitte
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 28 Feb 2012 00:26

Re: Selecting audio device from command line

Postby aitte » 14 Apr 2017 11:10

Hi! have the same problem but on windows!
I got a multichannel audiocard, it works through DirectX if i choose manually, but how could i do it in command line? I write somithing like

Code: Select all

vlc --aout "directsound" --directx-audio-device="Realtek Digital Output" 1.avi
in different combinations? but it does not seem to work.
How can i get a list of correct values for these options?
The command "adev" on rc interface should give some devices, but it does not (returned 0 it said)

mrblue1234
Blank Cone
Blank Cone
Posts: 21
Joined: 12 May 2017 19:53

Re: Selecting audio device from command line

Postby mrblue1234 » 20 Jun 2017 02:17

Did you ever get this working to select the audio device?


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 8 guests