Dbus refused to connect to a vlc service, and audio became dithering noise.
Posted: 07 Sep 2019 10:29
I installed vlc in a headless Debian 10 server and trying to stream a webcam to localhost. When I ran cvlc directly things worked fine, but when I use a .sh file to launch cvlc as a systemd service all sounds turned into some dithering noise.
The .sh file:
The .service file:
And I got the error message with systemctl status:
I have tried several options like "-A alsa,none" and some device relative options but no luck. Some options could make the service started without the "PulseAudio server connection failure" line but still cannot get sounds other than noise.
How could I start vlc as a service and streaming video with valid sound?
The .sh file:
Code: Select all
echo "Starting camera service...";
cvlc v4l2:// :input-slave=alsa:// :v4l2-standard=1 :v4l2-dev=/dev/video0 :live-caching=1000 :sout="#transcode{vcodec=theo, vb=1000, scale=0.5, fps=5, acodec=vorb, ab=128, channels=1$, samplerate=44100}:duplicate{dst=gather:std{dst=:8080/stream.ogg,access=http}}}"
Code: Select all
[Unit]
Description=Security camera service.
[Service]
Type=simple
User=username
ExecStart=/bin/bash /location/of/securecamera.sh
[Install]
WantedBy=multi-user.target
Code: Select all
9月 07 15:54:29 verite systemd[1]: Started Security camera service..
9月 07 15:54:29 verite bash[8925]: Starting camera service...
9月 07 15:54:29 verite bash[8925]: [0000561b4b1839a0] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
9月 07 15:54:29 verite bash[8925]: [0000561b4b22e1f0] dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
9月 07 15:54:29 verite bash[8925]: [0000561b4b22e1f0] main interface error: no suitable interface module
9月 07 15:54:29 verite bash[8925]: [0000561b4b0af580] main libvlc error: interface "dbus,none" initialization failed
9月 07 15:54:29 verite bash[8925]: [0000561b4b22da70] main interface error: no suitable interface module
9月 07 15:54:29 verite bash[8925]: [0000561b4b0af580] main libvlc error: interface "globalhotkeys,none" initialization failed
9月 07 15:54:29 verite bash[8925]: [0000561b4b22da70] dummy interface: using the dummy interface module...
9月 07 15:54:29 verite bash[8925]: [00007f96384ca130] mux_ogg mux: Open
How could I start vlc as a service and streaming video with valid sound?