瓦苏普。
我有 shell 命令。
ffmpeg -list_devices true -f dshow -i dummy -hide_banner
当我运行该命令时,我得到输出数据(见下文)
[dshow @ 00000281450fbdc0] DirectShow video devices (some may be both video and audio devices)
[dshow @ 00000281450fbdc0] "HD WebCam"
[dshow @ 00000281450fbdc0] Alternative name "@device_pnp_\\?\usb#vid_0408&pid_a060&mi_00#6&391c16c1&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"
[dshow @ 00000281450fbdc0] DirectShow audio devices
[dshow @ 00000281450fbdc0] "Microphone (Realtek High Definition Audio)"
[dshow @ 00000281450fbdc0] Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{4727F33A-DE04-4706-8312-03696FACC791}"
[dshow @ 00000281450fbdc0] "Stereo mix (Realtek High Definition Audio)"
[dshow @ 00000281450fbdc0] Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{534A8FBC-6C02-4384-B51C-D0363BB7F8FD}"
[dshow @ 00000281450fbdc0] "Microphone (Avsoft Virtual Audio Device)"
[dshow @ 00000281450fbdc0] Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{5CE20B48-361E-4B96-B113-B3E02BA448EC}"
dummy: Immediate exit requested
我必须获取所有音频设备的列表。而且我不想解析那个字符串,我会很难的。如何使用 ffmpeg-python 模块获取所有音频设备的列表?感谢你。
UPD:我决定解析那个字符串。但是当我输入:
command = subprocess.check_output('ffmpeg -list_devices true -f dshow -i dummy -hide_banner', shell=True)
我收到此错误:
subprocess.CalledProcessError: Command 'ffmpeg -list_devices true -f dshow -i dummy -hide_banner' returned non-zero exit status 1.
我如何调用该命令并将其结果放入我的变量“命令”中?