Replies: 9 comments 1 reply
-
Same.... |
Beta Was this translation helpful? Give feedback.
-
Some one recommended to switch to dev branch, it seems that the stream start working on Android client, but recording and sound was completely die. I'm looking for solutions for these... |
Beta Was this translation helpful? Give feedback.
-
I tried dev, still get ton of these errors unfortunately |
Beta Was this translation helpful? Give feedback.
-
So far, I've made a little progress using the Docker dev version, but the stream only updates one frame every 25 seconds or so, The Docker verbose output doesn't show broken pipe connections, or ffmpeg restarts. I was only getting that from the bare metal apt install version which wasn't the dev version. From the docker verbose output It looks like an extra stream from ffmpeg is now being created which looks like a conversion to still frames, with the -r 1 -update 1 /tmp/tmpogtvk8sb/screen.jpg tag in the command line now being generated by the script which I don't believe happened in the main image build. I'm guessing that's an added fallback method to avoid broken pipe errors with live streaming, but I'm just spitballing here. Anyway, here's my config: We are a 100% Mac environment. I'm running this on a MiniMac M2, 8Gb Ram (192.168.19.4), with the latest version of Docker Desktop installed. I made the client.pem file locally using the openssl instructions. I then built a container via command line "docker compose up" by editing and using the following docker-compose.yaml file: version: "3.9" I'm testing an LTS CMIP3052 (192.16819.151) with an rtsp feed directly from the camera to a UDM-Pro (192.168.19.7). UDM-Pro is Console v 3.2.9, Protect v 2.11.21 Unifi-Cam-Proxy seems to run properly. Camera shows up in Protect as G3 Bullet in Protect, I see the thumbnail in the right side bar but when it's clicked to bring up the pop-up window, there's no stream, just a periodic frame refresh update about every 25 seconds. I've also tried it with the PTZ rtsp feed URLs, and an offsite rtsp test feed (BigBuckBunny). Same results, Have tried connecting to both the Main Stream (/Streaming/Channels/1) and the Substream (/Streaming/Channels/2) out of the camera: Main stream:1920x1080P Sub stream:640x360 A few months ago, Unifi had a problem with Safari and previewing live streams (ie: live doorbell video would show a blank screen) and we had to use Chrome. They have since fixed it (I think they must use HSL streaming with the native HTML5 video embed which Apple's webkit is woefully behind on, but I'm not sure, but it started working again a few weeks ago with their Unifi's latest Protect and Access update). But anyway, just to be sure, I tested it with Chrome as well just to make sure, and am seeing the same thing. I've also tested the rtsp feed from rtsp://userid:[email protected]:554/Streaming/Channels/2 with VLC and the feed seems to be ok coming out of the camera, it streams nicely in VLC. Here's a bit of the verbose output from unifi-cam-proxy: Attaching to unifi-cam-proxy-1 Just in case it's a source codec issue, I'm gonna try dropping one of my older G3 Flex's into standalone mode, and send its rtsp feed directly to the proxy out of the camera. I mean if one of their own cameras won't stream, nothing will - lol That said however, I have seen people using feeds out of frigate with some success. I may try building a quick frigate server and trying that as well. will post results |
Beta Was this translation helpful? Give feedback.
-
Same for me is not working anymore. Have nothing to add mcaramb has explained it very well. |
Beta Was this translation helpful? Give feedback.
-
Same issue here |
Beta Was this translation helpful? Give feedback.
-
Same issue here. @keshavdv , any chance you can share your thoughts or plans for this project going forward? |
Beta Was this translation helpful? Give feedback.
-
Having same issue here. Protect Android still streaming fine |
Beta Was this translation helpful? Give feedback.
-
I had the same problem using the outdated documentation -- the pip package is 0.2.0, while the main branch is 0.3.0.. On your linux:
That installed 0.3.0 for me and fixed the broken pipe problems |
Beta Was this translation helpful? Give feedback.
-
Decided to start a Discussion here as well. Folks on reddit (r/Ubiquiti) and GitHub (issue #344) seem to be having the same problem... We've all been able to get the cameras to appear in Protect, but but the popup window stream only shows one frame. The sidebar preview updates every 5-10 seconds with updated frames.
Anyway, after some debugging it looks like it comes down to a broken pipe error between ffmpeg's output through netcat to the Protect server on port 7550.
I use a bare metal Ubuntu command line installation, but this is also affecting installations using Docker.
But anyway, with the bare metal install, when running your unifi-cam-proxy script command line, you can see verbose what's happening. Not sure if you get this verbosity with Docker.... but here's what I see.
In the script output, you'll see this ffmpeg command line repeatedly generated by the script then the pipe breaks and the script restarts...
ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -stimeout 15000000 -rtsp_transport tcp -i "rtsp://192.168.190.150:554/Streaming/Channels/2" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=W1lhkzMqd6v6ZXDO -f flv - | /usr/bin/python3 -m unifi.clock_sync | nc 192.168.19.7 7550
Which shows there is first a pipe from ffmpeg to clock_sync.py, which inserts timing info into the stream, then clock_sync.py does a stdout pipe to nc which farms it to the Protect Server. so, two pipes. One is breaking. I believe it's the second one to the Protect server.
Because If you run this command yourself and remove the second pipe to nc, the stdout from clock_sync.py fills the screen with the video encoding data continuously without stopping, so it's not something wrong with how the original feed is being read.
ie:
ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -stimeout 15000000 -rtsp_transport tcp -i "rtsp://192.168.190.150:554/Streaming/Channels/2" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=W1lhkzMqd6v6ZXDO -f flv - | /usr/bin/python3 -m unifi.clock_sync
But if you change it back and pipe the clock_sync.py stream onward to nc, it breaks after one frame with BrokenPipe errors.
I think what's going on here is the Protect Server starts to receive the flv data via netcat, but senses something weird is up with it, and rejects the connection after the first frame, thus nc loses the connection, causing the pipe to break between clock_sync.py and nc. Maybe unify changed something in the codec or metadata of what it's willing to accept as a valid incoming flv stream to block 3rd party attempts like this.
The aforementioned errors:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/app/unifi/clock_sync.py", line 179, in
main(parse_args())
File "/app/unifi/clock_sync.py", line 156, in main
write(read_bytes(source, payload_size))
File "/app/unifi/clock_sync.py", line 28, in write
sys.stdout.buffer.write(data)
BrokenPipeError: [Errno 32] Broken pipe
Exception ignored in: <_io.TextIOWrapper name='' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe
av_interleaved_write_frame(): Broken pipe
Error writing trailer of pipe:: Broken pipe
Error closing file pipe:: Broken pipe
Beta Was this translation helpful? Give feedback.
All reactions