Win 10 上 Debian 子系统中的 VLC 脉冲音频错误
VLC Pulse Audio Errors in Debian Subsystem on win 10
我正在 Windows 10 上的 Debian 环境中编写一个小程序。我打算稍后在 Raspberry Pi 4 上使用此代码。
该代码在一天中的特定时间通过 VLC 运行视频。
VLC 代码 (Python3) 的核心如下。底部的完整 Python 代码。
VLC代码:
import vlc;
Instance = vlc.Instance('--fullscreen');
player = Instance.media_player_new();
Media = Instance.media_new("../videos/starscape.mp4");
Media.get_mrl();
player.set_media(Media);
player.play();
但是,这会引发各种错误。
VLC media player 3.0.7 Vetinari (revision 3.0.7-0-g86cee31099)
shared memfd open() failed: Function not implemented
[00007fffdc1e0410] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
shared memfd open() failed: Function not implemented
[00007fffdc225830] dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
[00007fffdc225830] main interface error: no suitable interface module
[00007fffdc1291a0] main libvlc error: interface "dbus,none" initialization failed
[00007fffdc204440] main interface error: no suitable interface module
[00007fffdc1291a0] main libvlc error: interface "globalhotkeys,none" initialization failed
[00007fffdc1291a0] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
error: XDG_RUNTIME_DIR not set in the environment.
[00007fffdc204440] skins2 interface error: cannot initialize OSFactory
这是我尝试修复的方法:
- apt-get 更新和 apt-get 升级
- 卸载并重新安装 vlc
- 卸载并重新安装 python-vlc
- 卸载并重新安装 pulseaudio
- google 这些错误并尝试随机解决方案
我以前从未在 CLI 中使用过 VLC,所以我不知道这是我的代码错误、安装错误还是 Debian 实例错误。
谁能告诉我正确的方法?
完整代码(仍在开发中,但总体思路已经存在)
要点:https://gist.github.com/Code2Empower/7deb6e05ffd10b0ea83eaff41c8cf294
好吧,我是个白痴。在 Windows 10 上安装 Debian,创建一个完全无头的安装。
所以,VLC 当然会出错。
我也停止使用 vlc-python
调用 vlc 并使用 subprocess
模块(更干净)。
我在 Windows 环境中测试了代码,它有效。当它到达这里时,我将在 Pi 上测试它,但它应该表现相同。
这是新的 vlc 代码,以备不时之需。
import subprocess;
media = "../videos/starscape.mp4";
subprocess.Popen(["vlc.exe", media, "-f", "-L" ]);
要点:https://gist.github.com/Code2Empower/7deb6e05ffd10b0ea83eaff41c8cf294
我正在 Windows 10 上的 Debian 环境中编写一个小程序。我打算稍后在 Raspberry Pi 4 上使用此代码。
该代码在一天中的特定时间通过 VLC 运行视频。
VLC 代码 (Python3) 的核心如下。底部的完整 Python 代码。
VLC代码:
import vlc;
Instance = vlc.Instance('--fullscreen');
player = Instance.media_player_new();
Media = Instance.media_new("../videos/starscape.mp4");
Media.get_mrl();
player.set_media(Media);
player.play();
但是,这会引发各种错误。
VLC media player 3.0.7 Vetinari (revision 3.0.7-0-g86cee31099)
shared memfd open() failed: Function not implemented
[00007fffdc1e0410] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
shared memfd open() failed: Function not implemented
[00007fffdc225830] dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
[00007fffdc225830] main interface error: no suitable interface module
[00007fffdc1291a0] main libvlc error: interface "dbus,none" initialization failed
[00007fffdc204440] main interface error: no suitable interface module
[00007fffdc1291a0] main libvlc error: interface "globalhotkeys,none" initialization failed
[00007fffdc1291a0] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
error: XDG_RUNTIME_DIR not set in the environment.
[00007fffdc204440] skins2 interface error: cannot initialize OSFactory
这是我尝试修复的方法:
- apt-get 更新和 apt-get 升级
- 卸载并重新安装 vlc
- 卸载并重新安装 python-vlc
- 卸载并重新安装 pulseaudio
- google 这些错误并尝试随机解决方案
我以前从未在 CLI 中使用过 VLC,所以我不知道这是我的代码错误、安装错误还是 Debian 实例错误。
谁能告诉我正确的方法?
完整代码(仍在开发中,但总体思路已经存在) 要点:https://gist.github.com/Code2Empower/7deb6e05ffd10b0ea83eaff41c8cf294
好吧,我是个白痴。在 Windows 10 上安装 Debian,创建一个完全无头的安装。
所以,VLC 当然会出错。
我也停止使用 vlc-python
调用 vlc 并使用 subprocess
模块(更干净)。
我在 Windows 环境中测试了代码,它有效。当它到达这里时,我将在 Pi 上测试它,但它应该表现相同。
这是新的 vlc 代码,以备不时之需。
import subprocess;
media = "../videos/starscape.mp4";
subprocess.Popen(["vlc.exe", media, "-f", "-L" ]);
要点:https://gist.github.com/Code2Empower/7deb6e05ffd10b0ea83eaff41c8cf294