keshavdv / unifi-cam-proxy

Enable non-Ubiquiti cameras to work with Unifi NVR
MIT License
1.59k stars 223 forks source link

App / FFMPEG crashes #273

Closed tlowcode closed 1 year ago

tlowcode commented 1 year ago

Camera

Netatmo Presence / Doorbird Doorbell

Firmware version of the camera

NA

Description

Error during execution:

2023-01-08 10:57:30 abe5df81ea2d RTSPCam[1] INFO Spawning ffmpeg for video1 (fZelYtY5RqiKTUaI): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -stimeout 15000000 -rtsp_transport tcp -i "rtsp://xxxxx:xxxxxxx@192.168.178.207:554/mpeg/media.amp" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=fZelYtY5RqiKTUaI -f flv - | /usr/local/bin/python -m unifi.clock_sync | nc 192.168.178.1 7550 Traceback (most recent call last): File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/app/unifi/clock_sync.py", line 167, in <module> main() File "/app/unifi/clock_sync.py", line 157, in main write(read_bytes(source, payload_size)) File "/app/unifi/clock_sync.py", line 87, in write sys.stdout.buffer.write(data) BrokenPipeError: [Errno 32] Broken pipe Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> BrokenPipeError: [Errno 32] Broken pipe av_interleaved_write_frame(): Broken pipe Error writing trailer of pipe:: Broken pipe

How to reproduce

start container

Expected behaviour

Video is streamed

Screenshots

No response

Aditional information

No response

vehvis commented 1 year ago

I'm having the exact same issue.

Camera: Generic Chinese IP cam (no idea about brand or model) OS: Ubuntu 22.04 arm64 on a Raspberry Pi 4

abryniak commented 1 year ago

Yes it looks it doesn't work longer :-(

simongalton commented 1 year ago

I can confirm the exact same error in the container and directly on Fedora 35 (python 3.10) and Fedora 37 (python 3.11).

simongalton commented 1 year ago

I have narrowed it down to the invocation of ffmpeg and the final pipe to netcat (nc). The nc command exits almost immediately with the broken pipe. Perhaps something has changed on unifi's side.

febef commented 1 year ago

I have the same error, u.u any update?

ymichel commented 1 year ago

I also receive a plethora of broken pipes…

bigjools commented 1 year ago

It works fine if you use ffmpeg v5.

simongalton commented 1 year ago

That's interesting, @bigjools - my Fedora 37 system is running ffmpeg 5.1.2 and it is not working. Which version are you running? Is it in a container or directly on a system?

hdd commented 1 year ago

I have just pushed a PR to update ffmpeg in docker , no errors so far , but still cannot get the stream working.

see whether this does help .

bigjools commented 1 year ago

That's interesting, @bigjools - my Fedora 37 system is running ffmpeg 5.1.2 and it is not working. Which version are you running? Is it in a container or directly on a system?

I'm using a container for this, just ubuntu:latest so it'll be 7:5.1.2-2ubuntu2. However I was a bit hasty to say it's fine as it only seems to work in the Android app for me, the web UI still has problems :(

cvpeck commented 1 year ago

I had same error in docker container so I am trying from local install instead. Built new version of ffmpeg (5.x) and had similar error - 2023-02-03 21:22:19 pi-cluster10 RTSPCam[183804] WARNING Previous ffmpeg process for video3 died. 2023-02-03 21:22:19 pi-cluster10 RTSPCam[183804] INFO Spawning ffmpeg for video3 (i7g3svPbTkK2zzyu): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -timeout 15000000 -rtsp_transport tcp -i "rtsp://User:Password@192.168.0.2:88/videoSub" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=i7g3svPbTkK2zzyu -f flv - | /usr/bin/python3 -m unifi.clock_sync | nc 192.168.0.1 7550 Traceback (most recent call last): Traceback (most recent call last): File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, return _run_code(code, main_globals, None, File "/usr/lib/python3.9/runpy.py", line 87, in _run_code File "/usr/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/pi/.local/lib/python3.9/site-packages/unifi/clock_sync.py", line 167, in <module> exec(code, run_globals) File "/home/pi/.local/lib/python3.9/site-packages/unifi/clock_sync.py", line 167, in <module> main() main() File "/home/pi/.local/lib/python3.9/site-packages/unifi/clock_sync.py", line 157, in main File "/home/pi/.local/lib/python3.9/site-packages/unifi/clock_sync.py", line 161, in main write(read_bytes(source, payload_size)) File "/home/pi/.local/lib/python3.9/site-packages/unifi/clock_sync.py", line 87, in write sys.stdout.buffer.write(data) BrokenPipeError: [Errno 32] Broken pipe Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> BrokenPipeError: [Errno 32] Broken pipe write(read_bytes(source, payload_size)) File "/home/pi/.local/lib/python3.9/site-packages/unifi/clock_sync.py", line 87, in write sys.stdout.buffer.write(data) BrokenPipeError: [Errno 32] Broken pipe Exception ignored in: <_io.TextIOWrapper name='<stdout>' 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 av_interleaved_write_frame(): Broken pipe Error writing trailer of pipe:: Broken pipe Error closing file pipe:: Broken pipe

cvpeck commented 1 year ago

further versioning info - RTSPCam[183804] INFO Processing [ChangeVideoSettings] message ffmpeg version df2e08e Copyright (c) 2000-2022 the FFmpeg developers built with gcc 10 (Debian 10.2.1-6) configuration: --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --extra-libs='-lpthread -lm -latomic' --arch=arm64 --enable-gmp --enable-gpl --enable-libaom --enable-libass --enable-libdav1d --enable-libdrm --enable-libfdk-aac --enable-libfreetype --enable-libkvazaar --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libssh --enable-libvorbis --enable-libvpx --enable-libzimg --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-nonfree --enable-version3 --target-os=linux --enable-pthreads --enable-openssl --enable-hardcoded-tables libavutil 57. 17.100 / 57. 17.100 libavcodec 59. 18.100 / 59. 18.100 libavformat 59. 16.100 / 59. 16.100 libavdevice 59. 4.100 / 59. 4.100 libavfilter 8. 24.100 / 8. 24.100 libswscale 6. 4.100 / 6. 4.100 libswresample 4. 3.100 / 4. 3.100 libpostproc 56. 3.100 / 56. 3.100

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

ymichel commented 1 year ago

Any further progress here?

wladkolc commented 1 year ago

same issue here. Anybody got solution?

bdsoha commented 1 year ago

This issue should be closed by #276

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.