Python bindings for libVLC - cannot change audio output device

This forum is about all development around libVLC.
heidi666
New Cone
New Cone
Posts: 2
Joined: 24 May 2016 15:39

Python bindings for libVLC - cannot change audio output device

Postby heidi666 » 24 May 2016 16:47

VLC 2.2.3, python-vlc 1.1.2.

I have a virtual audio output and am trying to get libVLC to output on it. So far, I can see the virtual output appearing in libVLC, but selecting it makes audio play on the default output (i.e. the speakers).

This is the relevant part of what I have:

Code: Select all

self.Instance = vlc.Instance() self.player = self.Instance.media_player_new() devices = [] mods = self.player.audio_output_device_enum() if mods: mod = mods while mod: mod = mod.contents devices.append(mod.device) mod = mod.next vlc.libvlc_audio_output_device_list_release(mods) self.player.audio_output_device_set(None, devices[0]) # this is the part I change on each run of the code.
I've run the code multiple times, changing the device ID as per the code comment. However, the output device doesn't actually change. This is a headache for two reasons:

1) audio_output_device_set() doesn't return anything. I can't tell if I'm actually accomplishing anything when I run this function.
2) I can't even run audio_output_device_get() to check if the set function is doing anything as this is only for libvlc 3. I would prefer for my program to work with 2.2.3.

So, what I did next was install VLC 3.0 and run the above code with it. Now, audio_output_device_get() works and I can see that the set function is actually changing the output device to the virtual output. But sound STILL plays on the speakers.

What's going on? How do I fix this?

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

Re: Python bindings for libVLC - cannot change audio output device

Postby Rémi Denis-Courmont » 24 May 2016 18:16

Check logs and documentation.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

heidi666
New Cone
New Cone
Posts: 2
Joined: 24 May 2016 15:39

Re: Python bindings for libVLC - cannot change audio output device

Postby heidi666 » 25 May 2016 11:22

Check logs and documentation.
I have been checking the documentation. How do you think I got this far? On libVLC 3.0, I change the audio device, verify that the player is using the new device, and sound still doesn't come through the new device. How is the documentation supposed to help me here?

How do I set up logging? I know I have to pass a FILE_ptr to the logging function but I don't know how to generate one from Python.

OlivierAubert
Developer
Developer
Posts: 92
Joined: 08 Mar 2007 15:43

Re: Python bindings for libVLC - cannot change audio output device

Postby OlivierAubert » 13 Jun 2016 15:14

You can increase the libvlc instance verbosity to get some more details:

Code: Select all

i = vlc.Instance("--verbose 9")


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 19 guests