raspberrypi / rpicam-apps

BSD 2-Clause "Simplified" License
416 stars 227 forks source link

[BUG] RTSP stream not starting on RPi 5 #747

Open GitHubGoody opened 6 days ago

GitHubGoody commented 6 days ago

Describe the bug I have an RPi 5 8GB running headless on the latest Raspberry Pi OS available via the RPi Imager with an RPi Camera Module 3 Wide connected. I'm simply trying to get it configured to stream RTSP but I keep getting errors and the stream does not start.

Bug report I attached the bug report generated using this command: camera-bug-report -t <timeout in seconds> -o <output file> -c "<rpicam-vid -t 0 --inline -o - | cvlc stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/stream}' :demux=h264>

bug.txt

This is the issue I posted on the forum here:

I have an RPi 5 8GB running headless on the latest Raspberry Pi OS available via the RPi Imager with an RPi Camera Module 3 Wide connected. I'm simply trying to get it configured to stream RTSP.

After running all of these commands to update it...

sudo apt update
supo apt upgrade
sudo apt install vlc
sudo apt install ffmpeg

...I tried the instructions offered here: https://www.raspberrypi.com/documentation/computers/camera_software.html#rtsp

When I try... rpicam-hello ...it starts the stream

When I try... rpicam-jpeg --output test.jpg ...it streams for 5 seconds and outputs a test.jpg image that I can retrieve via WinSCP and it looks great.

When I try... rpicam-vid -t 10s -o test.mp4 ...it streams for 10 seconds and outputs a test.mpg video that I can retrieve via WinSCP at it looks great.

When I try to start a stream with this... rpicam-vid -t 0 --inline -o - | cvlc stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/stream}' :demux=h264 ...I get this result and errors...

pi@xtoolp2lasercamera:~ $ rpicam-vid -t 0 --inline -o - | cvlc stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/stream}' :demux=h264
VLC media player 3.0.21 Vetinari (revision 3.0.21-0-gdd8bfdbabe8)
[000055563b0f0e50] main interface error: no suitable interface module
[000055563b009560] main libvlc error: interface "globalhotkeys,none" initialization failed
[000055563b0f0e50] dummy interface: using the dummy interface module...
[18:24:36.359722123] [18476]  INFO Camera camera_manager.cpp:325 libcamera v0.3.2+27-7330f29b
[18:24:36.367574459] [18489]  INFO RPI pisp.cpp:695 libpisp version v1.0.7 28196ed6edcf 29-08-2024 (16:33:32)
[18:24:36.385163086] [18489]  INFO RPI pisp.cpp:1154 Registered camera /base/axi/pcie@120000/rp1/i2c@88000/imx708@1a to CFE device /dev/media0 and ISP device /dev/media1 using PiSP variant BCM2712_C0
Preview window unavailable
Mode selection for 640:480:12:P
    SRGGB10_CSI2P,1536x864/0 - Score: 1486.67
    SRGGB10_CSI2P,2304x1296/0 - Score: 1786.67
    SRGGB10_CSI2P,4608x2592/0 - Score: 2686.67
Stream configuration adjusted
[18:24:36.386235628] [18476]  INFO Camera camera.cpp:1197 configuring streams: (0) 640x480-YUV420 (1) 1536x864-BGGR_PISP_COMP1
[18:24:36.386348425] [18489]  INFO RPI pisp.cpp:1450 Sensor: /base/axi/pcie@120000/rp1/i2c@88000/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected CFE format: 1536x864-PC1B
[NULL @ 0x555661e5b2f0] Unable to find a suitable output format for '-'
ERROR: *** libav: cannot allocate output context, try setting with --libav-format ***
[00007fff1c004290] h26x demux error: this doesn't look like a h264 ES stream, continuing anyway
[00007fff1c004e80] main stream error: unknown query 0x30e in demux_vaControlHelper

Specifically, these lines are in red:

[00005555e8a84e50] main interface error: no suitable interface module
[00005555e899d560] main libvlc error: interface "globalhotkeys,none" initialization failed

[NULL @ 0x5555cd22f2f0] Unable to find a suitable output format for '-'
ERROR: *** libav: cannot allocate output context, try setting with --libav-format ***
[00007fff4c004290] h26x demux error: this doesn't look like a h264 ES stream, continuing anyway
[00007fff4c004e80] main stream error: unknown query 0x30e in demux_vaControlHelper
naushir commented 4 days ago

Can you try adding --libav-format h264 into the command line?

slain2 commented 2 days ago

See my reply to that forum post for a version that works on a Pi5 Bookworm with v3 wide camera.