Vlc list of ouput devices

0
import vlc

Instance = vlc.Instance(['--no-xlib'])
player = Instance.media_player_new()

output_devices = []
mods = player.audio_output_device_enum()
if mods:
    mod = mods
    while mod:
        mod = mod.contents
        output_devices.append(mod.device)
        mod = mod.next
        
print(output_devices)

When i run the code in ubuntu 20.04, i get:

[b'surround21', b'surround40', b'surround41', b'surround50', b'surround51', b'surround71', b'null', b'samplerate', b'speexrate', b'jack', b'oss', b'pulse', b'upmix', b'vdownmix', b'default', b'hdmi:CARD=NVidia,DEV=0', b'hdmi:CARD=NVidia,DEV=1', b'dmix:CARD=NVidia,DEV=3', b'dmix:CARD=NVidia,DEV=7', b'dsnoop:CARD=NVidia,DEV=3', b'dsnoop:CARD=NVidia,DEV=7', b'hw:CARD=NVidia,DEV=3', b'hw:CARD=NVidia,DEV=7', b'plughw:CARD=NVidia,DEV=3', b'plughw:CARD=NVidia,DEV=7', b'usbstream:CARD=NVidia', b'sysdefault:CARD=PCH', b'front:CARD=PCH,DEV=0', b'surround21:CARD=PCH,DEV=0', b'surround40:CARD=PCH,DEV=0', b'surround41:CARD=PCH,DEV=0', b'surround50:CARD=PCH,DEV=0', b'surround51:CARD=PCH,DEV=0', b'surround71:CARD=PCH,DEV=0', b'dmix:CARD=PCH,DEV=0', b'dmix:CARD=PCH,DEV=2', b'dsnoop:CARD=PCH,DEV=0', b'dsnoop:CARD=PCH,DEV=2', b'hw:CARD=PCH,DEV=0', b'hw:CARD=PCH,DEV=2', b'plughw:CARD=PCH,DEV=0', b'plughw:CARD=PCH,DEV=2', b'usbstream:CARD=PCH']

When i run the code in Windows 10 output is:

[b'', b'{0.0.0.00000000}.{f5afeef6-6697-4507-882a-0b60be862f53}']

Strange output i think? How can i get the output devices in python using vlc module?

Also in cmd i saw this: [000002734e26e560] mmdevice audio output error: cannot initialize COM (error 0x80010106) but only in certain times.

python
vlc
asked on Stack Overflow Jul 12, 2020 by Chris P • edited Sep 27, 2020 by Chris P

1 Answer

0

I just change mod.device to mod.description and now i can see the human readable devices titles.

answered on Stack Overflow Sep 28, 2020 by Chris P

User contributions licensed under CC BY-SA 3.0