Page 1 of 1

Python bindings for libVLC - cannot change audio output device

Posted: 24 May 2016 16:47
by heidi666
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?

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

Posted: 24 May 2016 18:16
by RĂ©mi Denis-Courmont
Check logs and documentation.

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

Posted: 25 May 2016 11:22
by heidi666
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.

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

Posted: 13 Jun 2016 15:14
by OlivierAubert
You can increase the libvlc instance verbosity to get some more details:

Code: Select all

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