Closed AliMickey closed 2 years ago
I have the same issue, same error messages. I've been working with it for days. My usecase is "bare-metal" (Proxmox LXC) and I discovered that I can stream the bunny test to Unifi and stream the camera to disc (on the host of the unifi cam proxy), so either end of the proxy works individually, but not when combined. I'll supplement this thread rather than make a new one, I hope that's OK.
Asked on the Discord to no avail, and I'm not smart enough to figure out if this is a bug or me doing it wrong.
Setup According to bare-metal install in the docs (in LXC on Proxmox, plenty of ressources according to summary logs) Unifi Protect on Cloud Key G2+ @ 10.0.0.10 Dahua IPC-HDW4830something @ 10.10.30.11, main stream 4K/4 FPS, substream HD/1 FPS, both H264 No firewall rules between the subnets (yet). All stream sources mentioned in this post work on VLC in both 10.10.10.X and other networks.
Streaming Big Buck Bunny to Unifi Protect
unifi-cam-proxy --host 10.0.0.10 --cert /var/certs/client.pem --token xxxxxxxxerVy5bDHbE7FYHSWxxxxxxx rtsp -s 'rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_175k.mov'
This command works as expected, Unifi controller reports the camera as online, shows snapshots when viewing the camera in device manager, shows live video and recorded playback. The video is choppy, but aside from that, things work.
Streaming from IP camera to disk of proxy host
ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -stimeout 15000000 -rtsp_transport tcp -i "rtsp://user:password@10.10.30.11:554/cam/realmonitor?channel=1&subtype=2" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=iiBbC5Vkdy7Zadnd -f flv test.flv
No errors shown and when I CTRL+C the file test.flv exists with a reasonable size.
Commands attempted to stream from IP camera to Unifi Protect Note that all of these output the broken pipe error shown in @AliMickey post above.
Exact repeat of the Big Buck Bunny test command changing only the source, generic rtsp:
unifi-cam-proxy --host 10.0.0.10 --cert /var/certs/client.pem --token xxxxxxxxxxVy5bDHbE7FYHSWxxxxxxx rtsp -s 'rtsp://user:password@10.10.30.11/live'
This is the ffmpeg command run by the big buck bunny command. When changing only the source, I get the broken pipe error.
ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -stimeout 15000000 -rtsp_transport tcp -i "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_175k.mov" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=iiBbC5Vkdy7Zadnd -f flv - | /usr/bin/python3 -m unifi.clock_sync | nc 10.0.0.10 7550
Trying a different stream source on the camera (still generic rstp), that also works in VLC (/live does too), main stream:
unifi-cam-proxy --host 10.0.0.10 --cert /var/certs/client.pem --token xxxxxxxxxVy5bDHbE7FYHSWxxxxxxxx rtsp -s 'rtsp://user:password@10.10.30.11:554/cam/realmonitor?channel=1&subtype=0'
As above, sub stream:
unifi-cam-proxy --host 10.0.0.10 --cert /var/certs/client.pem --token xxxxxxxxxVy5bDHbE7FYHSWxxxxxxxx rtsp -s 'rtsp://user:password@10.10.30.11:554/cam/realmonitor?channel=1&subtype=2'
Dahua-specific commands, main 4K stream:
unifi-cam-proxy -H 10.0.0.10 -i 10.10.30.11 -c /var/certs/client.pem -t xxxxxxxxxxVy5bDHbE7FYHSWxxxxxxxxx dahua -u user -p password --sub-stream 0
Dahua-specific commands, sub HD stream:
unifi-cam-proxy -H 10.0.0.10 -i 10.10.30.11 -c /var/certs/client.pem -t xxxxxxxxxxVy5bDHbE7FYHSWxxxxxxxxx dahua -u user -p password --sub-stream 2
All of these result in broken pipe. I would think it's a camera issue, except it's happy to stream to a file on disk and does report meta data correct.
Things I've tested
ffmpeg -nostdin -loglevel debug -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -stimeout 15000000 -rtsp_transport tcp -i "rtsp://user:password@10.10.30.11:554/cam/realmonitor?channel=1&subtype=0" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=JwehwodFGzvzGtsW -f flv - | /usr/bin/python3 -m unifi.clock_sync | nc 10.0.0.10 7550
Will output:
Stream #0:0, 0, 1/1000: Video: h264 (High), 1 reference frame ([7][0][0][0] / 0x0007), yuvj420p(pc, bt709, progressive, left), 3840x2160 (0x0) [SAR 1:1 DAR 16:9], 0/1, q=2-31, 4 fps, 14.99 tbr, 1k tbn, 90k tbc
EDIT (to add further detail): I tested with a different camera model on my network, Dahua IPC-HDBW4231E-ASE. This is just an HD camera, and I hadn't setup a user for the rtsp yet. Initially I got 401 (Forbidden), and after setting up the user, same broken pipe error.
I also attemped to use Onvif, this also does not change the broken pipe error.
I forgot to mention originally, the streams work fine in VLC as well as home-assistant.
@AliMickey (and others reading) - I've got it working finally. It seems the critical thing for me was the FPS. While it's not documented anywhere, it seems this must be 15 FPS or more. See #194 for more detail. I hope that helps you as well.
Seems my NVR only supports outputting 10FPS.
Thanks for the clarification.
Describe the bug I don't remember if I submitted this bug before, but I am back to trying to get this to work. I face this error when I run the container.
To Reproduce Steps to reproduce the behavior: Set up and run container using no custom ffmpeg args.
Camera (please complete the following information):
Additional context Docker compose:
Thanks!