Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wont stream RTSP Failed to connect to the D-Bus session #153

Open
icepicknz opened this issue Mar 11, 2022 · 11 comments
Open

Wont stream RTSP Failed to connect to the D-Bus session #153

icepicknz opened this issue Mar 11, 2022 · 11 comments

Comments

@icepicknz
Copy link

icepicknz commented Mar 11, 2022

Hi,

I just installed 2022-01-28-raspios-buster-armhf on a RPi4, followed the
gpu_mem=512 to your /boot/config.txt
framebuffer_width=1920' and 'framebuffer_height=1080

The demo boots fine and plays the video of the mkv and says connecting in a few other boxes.

I commented out all the streams and added mine:

    - camera_streams:
        - url: "rtsp://192.168.44.4:7447/zR4CkwuhXKsMKu2a"
#        - url: "rtsp://192.168.44.4:7447/WEPB3Jn6yz8b8sEE"
#        - url: "rtsp://192.168.44.4:7447/v15hh7bd4qAfxZnv"
#        - url: "rtsp://192.168.44.4:7447/3sjnpi31GTGL0EwF"
#        - url: "rtsp://192.168.44.4:7447/2VOOkDfwzJpXvYBy"
#        - url: "rtsp://192.168.44.4:7447/oBlKwRyQFMywVRgC"
#        - url: "rtsp://192.168.44.4:7447/jHtj9GYW9F1sFBFH"
      rtsp_over_tcp:  true
      duration: 20
      nr_of_columns: 2

Trying single stream with RTSP over TCP true or false just shows connecting to stream on the screen.

/var/log/syslog shows the following.

Mar 11 01:00:48 office-left-tv rpisurv[464]: [01706090] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
Mar 11 01:00:48 office-left-tv rpisurv[464]: [0173f850] dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Mar 11 01:00:48 office-left-tv rpisurv[464]: [0173f850] main interface error: no suitable interface module
Mar 11 01:00:48 office-left-tv rpisurv[464]: [01688b58] main libvlc error: interface "dbus,none" initialization failed
Mar 11 01:00:48 office-left-tv rpisurv[464]: [0172a630] main interface error: no suitable interface module
Mar 11 01:00:48 office-left-tv rpisurv[464]: [01688b58] main libvlc error: interface "globalhotkeys,none" initialization failed
Mar 11 01:00:48 office-left-tv rpisurv[464]: [0172a630] dummy interface: using the dummy interface module...
Mar 11 01:00:48 office-left-tv rpisurv[464]: Created new TCP socket 4 for connection
Mar 11 01:00:48 office-left-tv rpisurv[464]: [736136b0] mmal_codec decoder: VCSM init succeeded: Legacy
Mar 11 01:00:49 office-left-tv rpisurv[464]: [736136b0] main decoder error: buffer deadlock prevented

I have tried changing GL Driver in Advanced settings to all 3, and gone back to legacy now as G3 wouldn't work at all
-G1 Legacy Original non-GL desktop driver
-G2 GL (Fake KMS) OpenGL desktop driver with fake KMS
-G3 GL (Full KMS) OpenGL desktop driver with full KMS

Additional logs

root@office-left-tv:~# sudo systemctl restart rpisurv;sudo journalctl -fau rpisurv
sudo: unable to resolve host office-left-tv: Name or service not known
sudo: unable to resolve host office-left-tv: Name or service not known
-- Logs begin at Fri 2022-03-11 01:00:03 GMT. --
Mar 11 01:11:46 office-left-tv rpisurv[464]: [73a006b0] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 551 ms)
Mar 11 01:11:46 office-left-tv rpisurv[464]: [736136b0] main decoder error: buffer deadlock prevented
Mar 11 01:12:40 office-left-tv rpisurv[464]: 2022/03/11 01:12:40 - core.worker - INFO - This process was sigtermed
Mar 11 01:12:40 office-left-tv systemd[1]: Stopping Rpisurv Raspberry Pi Surveillance...
Mar 11 01:12:40 office-left-tv systemd[1]: rpisurv.service: Main process exited, code=killed, status=15/TERM
Mar 11 01:12:40 office-left-tv rpisurv[464]: 2022/03/11 01:12:40 - core.worker - INFO - This process was sigtermed
Mar 11 01:12:40 office-left-tv rpisurv[464]: 2022/03/11 01:12:40 - core.worker - INFO - This stream screen_manager_0_screen1_cam_stream1 has been stopped
Mar 11 01:12:41 office-left-tv systemd[1]: rpisurv.service: Succeeded.
Mar 11 01:12:41 office-left-tv systemd[1]: Stopped Rpisurv Raspberry Pi Surveillance.
Mar 11 01:12:41 office-left-tv systemd[1]: Started Rpisurv Raspberry Pi Surveillance.
Mar 11 01:12:42 office-left-tv rpisurv[6101]: pygame 1.9.4.post1
Mar 11 01:12:42 office-left-tv rpisurv[6101]: Hello from the pygame community. https://www.pygame.org/contribute.html
Mar 11 01:12:42 office-left-tv rpisurv[6101]: 2022/03/11 01:12:42 - l_default - INFO - Starting rpisurv 3.0.0
Mar 11 01:12:42 office-left-tv rpisurv[6101]: 2022/03/11 01:12:42 - l_default - INFO - Auto detected display SAM-SAMSUNG at HDMI 0 with display number 2 1920 x 1080
Mar 11 01:12:42 office-left-tv rpisurv[6101]: 2022/03/11 01:12:42 - l_default - INFO - Unique id of this installation is 8e255237f343b3c7ce914e08ce22ece49873b696ac5ac4f2766a3be1406cff77
Mar 11 01:12:47 office-left-tv rpisurv[6101]: [010ef090] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
Mar 11 01:12:47 office-left-tv rpisurv[6101]: [01128868] dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Mar 11 01:12:47 office-left-tv rpisurv[6101]: [01128868] main interface error: no suitable interface module
Mar 11 01:12:47 office-left-tv rpisurv[6101]: [01071b58] main libvlc error: interface "dbus,none" initialization failed
Mar 11 01:12:47 office-left-tv rpisurv[6101]: [01113608] main interface error: no suitable interface module
Mar 11 01:12:47 office-left-tv rpisurv[6101]: [01071b58] main libvlc error: interface "globalhotkeys,none" initialization failed
Mar 11 01:12:47 office-left-tv rpisurv[6101]: [01113608] dummy interface: using the dummy interface module...
Mar 11 01:12:47 office-left-tv rpisurv[6101]: Created new TCP socket 4 for connection
Mar 11 01:12:47 office-left-tv rpisurv[6101]: 2022/03/11 01:12:47 - l_default - INFO - Sending stats is disabled, not sending stats
Mar 11 01:12:48 office-left-tv rpisurv[6101]: [736136c0] mmal_codec decoder: VCSM init succeeded: Legacy
Mar 11 01:12:48 office-left-tv rpisurv[6101]: [736136c0] main decoder error: buffer deadlock prevented
Mar 11 01:12:53 office-left-tv rpisurv[6101]: [736136c0] main decoder error: buffer deadlock prevented

@icepicknz
Copy link
Author

So, I thought I may try suggested versions from a while back, so installed a fresh 2021-05-07-raspios-buster-armhf

Same issue

Mar 11 03:33:26 raspberrypi systemd[1]: rpisurv.service: Succeeded.
Mar 11 03:33:26 raspberrypi systemd[1]: Stopped Rpisurv Raspberry Pi Surveillance.
Mar 11 03:33:26 raspberrypi systemd[1]: Started Rpisurv Raspberry Pi Surveillance.
Mar 11 03:33:27 raspberrypi rpisurv[1434]: pygame 1.9.4.post1
Mar 11 03:33:27 raspberrypi rpisurv[1434]: Hello from the pygame community. https://www.pygame.org/contribute.html
Mar 11 03:33:27 raspberrypi rpisurv[1434]: 2022/03/11 03:33:27 - l_default - INFO - Starting rpisurv 3.0.0
Mar 11 03:33:27 raspberrypi rpisurv[1434]: 2022/03/11 03:33:27 - l_default - INFO - Auto detected display SAM-SAMSUNG at HDMI 0 with display number 2 1920 x 1080
Mar 11 03:33:27 raspberrypi rpisurv[1434]: 2022/03/11 03:33:27 - l_default - INFO - Unique id of this installation is 8e255237f343b3c7ce914e08ce22ece49873b696ac5ac4f2766a3be1406cff77
Mar 11 03:33:31 raspberrypi rpisurv[1434]: [01666630] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
Mar 11 03:33:31 raspberrypi rpisurv[1434]: [01694300] dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Mar 11 03:33:31 raspberrypi rpisurv[1434]: [01694300] main interface error: no suitable interface module
Mar 11 03:33:31 raspberrypi rpisurv[1434]: [015edb58] main libvlc error: interface "dbus,none" initialization failed
Mar 11 03:33:31 raspberrypi rpisurv[1434]: [01690040] main interface error: no suitable interface module
Mar 11 03:33:31 raspberrypi rpisurv[1434]: [015edb58] main libvlc error: interface "globalhotkeys,none" initialization failed
Mar 11 03:33:31 raspberrypi rpisurv[1434]: [01690040] dummy interface: using the dummy interface module...
Mar 11 03:33:31 raspberrypi rpisurv[1434]: Created new TCP socket 3 for connection
Mar 11 03:33:32 raspberrypi rpisurv[1434]: 2022/03/11 03:33:32 - l_default - INFO - Sending stats is disabled, not sending stats
Mar 11 03:33:32 raspberrypi rpisurv[1434]: [75114958] mmal_codec decoder: VCSM init succeeded: Legacy
Mar 11 03:33:32 raspberrypi rpisurv[1434]: [75114958] main decoder error: buffer deadlock prevented
Mar 11 03:33:37 raspberrypi rpisurv[1434]: [75114958] main decoder error: buffer deadlock prevented

VLC is at least trying to run. I can stream rtsp://192.168.44.4:7447/zR4CkwuhXKsMKu2a just fine from my MAC VLC

root@raspberrypi:~# ps -auxwww | grep vlc
root      1447  2.0  3.3 124732 16936 ?        Ssl  03:33   0:02 /usr/bin/vlc -I dummy --aspect-ratio=1920:1080 --vout mmal_vout --network-caching 500 --no-video-title-show --mmal-display=hdmi-1 --input-timeshift-granularity=0 --repeat --mmal-vout-transparent --mmal-vout-window 1920x1080+0+0 --mmal-layer 2000000000 --no-audio rtsp://192.168.44.4:7447/zR4CkwuhXKsMKu2a

@icepicknz
Copy link
Author

Ok this is interesting, I decided to try stream same quality camera off my local home NVR and it works, then tried medium and high quality, they all worked. So its only the remote stuff thats not working.

I suspect there is some buffer setting that needs to be used for remote RTSP??

@SvenVD
Copy link
Owner

SvenVD commented Mar 14, 2022

You could try playing with network_caching_ms config option

@SvenVD
Copy link
Owner

SvenVD commented Jun 22, 2022

Any update?

@sebburon
Copy link

I am facing the same issue. I also tried the network_caching_ms without any luck.
Any solutions to that would be appreciated.

@Charlsburg
Copy link

Charlsburg commented Oct 28, 2023

Ok this is interesting, I decided to try stream same quality camera off my local home NVR and it works, then tried medium and high quality, they all worked. So its only the remote stuff thats not working.

I suspect there is some buffer setting that needs to be used for remote RTSP??

I've been battling this issue also, and found I was able to pull a PC RTSP stream from my PC on my home network, but as soon as I plug it into the network on site (which is far less complex, same subnet, no firewalls), I get this same buffer deadlock error.

Really is doing my head in and I've tried so many different iterations but nothing seems to stop triggering the deadlock.
Have tried network cache, increased buffer limit, different quality streams, TCP, UDP, different video codecs - whatever is creating the error doesn't actually seem to be buffer related.

Did you manage to find any solutions yet?

@SvenVD
Copy link
Owner

SvenVD commented Nov 30, 2023

any update?

@dlasher
Copy link

dlasher commented Feb 6, 2024

Trying to convert from v2 to v3, and seeing this often on the pi3/bullseye/vlc install I've done. video streams all reset, and logs show

Feb 06 04:18:48 pi-camera-den rpisurv[655]: [73a39bf0] mmal_codec decoder: VCSM init succeeded: CMA
Feb 06 04:18:49 pi-camera-den rpisurv[655]: error: XDG_RUNTIME_DIR not set in the environment.
Feb 06 04:18:49 pi-camera-den rpisurv[655]: error: XDG_RUNTIME_DIR not set in the environment.
Feb 06 04:19:57 pi-camera-den rpisurv[655]: Created new TCP socket 4 for connection
Feb 06 04:19:57 pi-camera-den rpisurv[655]: [73a3a1a8] mmal_codec decoder: VCSM init succeeded: CMA
Feb 06 04:19:57 pi-camera-den rpisurv[657]: Created new TCP socket 6 for connection
Feb 06 04:19:57 pi-camera-den rpisurv[657]: [7390d378] mmal_codec decoder: VCSM init succeeded: CMA
Feb 06 04:19:57 pi-camera-den rpisurv[650]: Created new TCP socket 6 for connection
Feb 06 04:19:57 pi-camera-den rpisurv[650]: [72c0a8b8] mmal_codec decoder: VCSM init succeeded: CMA
Feb 06 04:19:57 pi-camera-den rpisurv[648]: Created new TCP socket 6 for connection
Feb 06 04:19:57 pi-camera-den rpisurv[648]: [73a0d378] mmal_codec decoder: VCSM init succeeded: CMA
Feb 06 04:19:57 pi-camera-den rpisurv[655]: [73a3a1a8] main decoder error: buffer deadlock prevented
Feb 06 04:19:57 pi-camera-den rpisurv[650]: [72c0a8b8] mmal_codec decoder: VCSM init succeeded: CMA
Feb 06 04:19:57 pi-camera-den rpisurv[648]: [73a0d378] main decoder error: buffer deadlock prevented
Feb 06 04:19:57 pi-camera-den rpisurv[657]: [7390d378] main decoder error: buffer deadlock prevented
Feb 06 04:19:57 pi-camera-den rpisurv[650]: [72c0a8b8] main decoder error: buffer deadlock prevented
Feb 06 04:19:58 pi-camera-den rpisurv[657]: [7390d378] mmal_codec decoder: VCSM init succeeded: CMA

For now I'm going back to my buster/2.0 install. the video stays on screen for hours with zero blips. :(

(for context, video is coming from a go2rtc server running at 0% cpu, wired gigabit path between server & pi.)

@Charlsburg
Copy link

Charlsburg commented Feb 6, 2024

I wonder if its as simple as needing to manually set the environment within the script, given its running in headless mode it doesnt have a desktop environment running. I'm not nearby my CCTV pi and dont currently have a spare to test on so cant test for the next week or so.
Something like the following only you should setup your user ID (i.e. pi:pi)

``
# manually setup runtime environment
import os

if 'XDG_RUNTIME_DIR' not in os.environ:
user_id = os.getuid() # Get the current user's ID
os.environ['XDG_RUNTIME_DIR'] = f'/run/user/{user_id}'

# Print the set directory to confirm
print(f"XDG_RUNTIME_DIR set to: {os.environ['XDG_RUNTIME_DIR']}")

``

@dlasher
Copy link

dlasher commented Feb 7, 2024

Per camera buffering seems to make it better, but having to run a 3000-5000ms "buffer" on each camera dramatically reduces the "realtime" effect, especially when it's things like a front door. They can be walking away before you hear the doorbell.

v2/omxplayer - no such issues. Going back for now.

@SvenVD - given any thought to using SDL2 to replace MMAL? (since omx is long gone) I've seen some work around ffmpeg / vlc and SDL as an output option. Hopefully that could survive longer than OMX or MMAL did.

@SvenVD
Copy link
Owner

SvenVD commented Feb 10, 2024

I did not do any tests with sdl, not sure if it used hardware acceleration or that it can be use to provide specific coordinates. Vlc on raspberry pi os is compiled with mmal support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants