keshavdv / unifi-cam-proxy

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

Get broken pipe exceptio #344

Open loungelizard2018 opened 7 months ago

loungelizard2018 commented 7 months ago

Camera

Dafang (Wyze V3

Firmware version of the camera

running on custom firmware /EliasKotlyar/Xiaomi-Dafang-Hacks

Description

Hi, I managed to get the docker up and running in unraid and it is sporadically updating the video image on the UDM Pro. It is shown as a G3 but strangely with a completely wrong IP address (192.168.1.10 which is nowhere in use in my setup). The camera itself is running under 10.1.100.254.

I see broken ffmpeg messages in the log which are probably the reason the picture is updated sporadically only. When I view the livestream of the camera via vlc it works fine.

Any pointers as to what I can try to get it up and running smoothly?

cheers, Florian


`2023-12-02 23:16:39 63910d932a7e RTSPCam[1] INFO Spawning ffmpeg for video2 (d10LqkTTbP3LsNVk): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -stimeout 15000000 -rtsp_transport tcp -i "rtsp://10.1.110.254:8554/unicast" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=d10LqkTTbP3LsNVk -f flv - | /usr/local/bin/python -m unifi.clock_sync | nc 10.1.100.1 7550
[mp3float @ 0x14fef5ec3680] Header missing
2023-12-02 23:16:41 63910d932a7e RTSPCam[1] INFO Processing [ChangeVideoSettings] message
ffmpeg version 4.1.6 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 8.3.0 (Alpine 8.3.0)
  configuration: --prefix=/usr --enable-avresample --enable-avfilter --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --disable-stripping --disable-static --disable-librtmp --enable-vaapi --enable-vdpau --enable-libopus --disable-debug
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
2023-12-02 23:16:42 63910d932a7e RTSPCam[1] WARNING Previous ffmpeg process for video1 died.
2023-12-02 23:16:42 63910d932a7e RTSPCam[1] INFO Spawning ffmpeg for video1 (cQV9TDczEgC67NnO): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -stimeout 15000000 -rtsp_transport tcp -i "rtsp://10.1.110.254:8554/unicast" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=cQV9TDczEgC67NnO -f flv - | /usr/local/bin/python -m unifi.clock_sync | nc 10.1.100.1 7550
[mp3float @ 0x1477d144b680] Header missing
2023-12-02 23:16:42 63910d932a7e RTSPCam[1] INFO Processing [GetRequest] message
[mp3float @ 0x5618dcdecd40] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
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 161, 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
2023-12-02 23:16:44 63910d932a7e RTSPCam[1] INFO Processing [NetworkStatus] message
2023-12-02 23:16:44 63910d932a7e RTSPCam[1] INFO Processing [GetSystemStats] message
[mp3float @ 0x1477cf39a4c0] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
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 161, 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
av_interleaved_write_frame(): Broken pipe
Error writing trailer of pipe:: Broken pipe
2023-12-02 23:16:49 63910d932a7e RTSPCam[1] INFO Processing [ChangeVideoSettings] message
ffmpeg version 4.1.6 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 8.3.0 (Alpine 8.3.0)
  configuration: --prefix=/usr --enable-avresample --enable-avfilter --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --disable-stripping --disable-static --disable-librtmp --enable-vaapi --enable-vdpau --enable-libopus --disable-debug
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
2023-12-02 23:16:49 63910d932a7e RTSPCam[1] WARNING Previous ffmpeg process for video2 died.
2023-12-02 23:16:49 63910d932a7e RTSPCam[1] INFO Spawning ffmpeg for video2 (d10LqkTTbP3LsNVk): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -stimeout 15000000 -rtsp_transport tcp -i "rtsp://10.1.110.254:8554/unicast" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=d10LqkTTbP3LsNVk -f flv - | /usr/local/bin/python -m unifi.clock_sync | nc 10.1.100.1 7550
[mp3float @ 0x153144652680] Header missing
2023-12-02 23:16:54 63910d932a7e RTSPCam[1] INFO Processing [NetworkStatus] message
2023-12-02 23:16:54 63910d932a7e RTSPCam[1] INFO Processing [GetSystemStats] message
[mp3float @ 0x55a24e0377c0] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
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 161, 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
av_interleaved_write_frame(): Broken pipe
Error writing trailer of pipe:: Broken pipe
2023-12-02 23:16:55 63910d932a7e RTSPCam[1] INFO Processing [GetRequest] message

````2023-12-02 23:16:39 63910d932a7e RTSPCam[1] INFO Spawning ffmpeg for video2 (d10LqkTTbP3LsNVk): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -stimeout 15000000 -rtsp_transport tcp -i "rtsp://10.1.110.254:8554/unicast" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=d10LqkTTbP3LsNVk -f flv - | /usr/local/bin/python -m unifi.clock_sync | nc 10.1.100.1 7550
[mp3float @ 0x14fef5ec3680] Header missing
2023-12-02 23:16:41 63910d932a7e RTSPCam[1] INFO Processing [ChangeVideoSettings] message
ffmpeg version 4.1.6 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 8.3.0 (Alpine 8.3.0)
  configuration: --prefix=/usr --enable-avresample --enable-avfilter --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --disable-stripping --disable-static --disable-librtmp --enable-vaapi --enable-vdpau --enable-libopus --disable-debug
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
2023-12-02 23:16:42 63910d932a7e RTSPCam[1] WARNING Previous ffmpeg process for video1 died.
2023-12-02 23:16:42 63910d932a7e RTSPCam[1] INFO Spawning ffmpeg for video1 (cQV9TDczEgC67NnO): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -stimeout 15000000 -rtsp_transport tcp -i "rtsp://10.1.110.254:8554/unicast" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=cQV9TDczEgC67NnO -f flv - | /usr/local/bin/python -m unifi.clock_sync | nc 10.1.100.1 7550
[mp3float @ 0x1477d144b680] Header missing
2023-12-02 23:16:42 63910d932a7e RTSPCam[1] INFO Processing [GetRequest] message
[mp3float @ 0x5618dcdecd40] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
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 161, 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
2023-12-02 23:16:44 63910d932a7e RTSPCam[1] INFO Processing [NetworkStatus] message
2023-12-02 23:16:44 63910d932a7e RTSPCam[1] INFO Processing [GetSystemStats] message
[mp3float @ 0x1477cf39a4c0] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
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 161, 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
av_interleaved_write_frame(): Broken pipe
Error writing trailer of pipe:: Broken pipe
2023-12-02 23:16:49 63910d932a7e RTSPCam[1] INFO Processing [ChangeVideoSettings] message
ffmpeg version 4.1.6 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 8.3.0 (Alpine 8.3.0)
  configuration: --prefix=/usr --enable-avresample --enable-avfilter --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --disable-stripping --disable-static --disable-librtmp --enable-vaapi --enable-vdpau --enable-libopus --disable-debug
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
2023-12-02 23:16:49 63910d932a7e RTSPCam[1] WARNING Previous ffmpeg process for video2 died.
2023-12-02 23:16:49 63910d932a7e RTSPCam[1] INFO Spawning ffmpeg for video2 (d10LqkTTbP3LsNVk): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -stimeout 15000000 -rtsp_transport tcp -i "rtsp://10.1.110.254:8554/unicast" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=d10LqkTTbP3LsNVk -f flv - | /usr/local/bin/python -m unifi.clock_sync | nc 10.1.100.1 7550
[mp3float @ 0x153144652680] Header missing
2023-12-02 23:16:54 63910d932a7e RTSPCam[1] INFO Processing [NetworkStatus] message
2023-12-02 23:16:54 63910d932a7e RTSPCam[1] INFO Processing [GetSystemStats] message
[mp3float @ 0x55a24e0377c0] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
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 161, 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
av_interleaved_write_frame(): Broken pipe
Error writing trailer of pipe:: Broken pipe
2023-12-02 23:16:55 63910d932a7e RTSPCam[1] INFO Processing [GetRequest] message

### How to reproduce

restart the docker. consistent behavior.

### Expected behaviour

_No response_

### Screenshots

_No response_

### Additional information

_No response_
RepairsAlmostComplete commented 6 months ago

Hi, I am getting the same error:

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 161, 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 av_interleaved_write_frame(): Broken pipe Error writing trailer of pipe:: Broken pipe 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 av_interleaved_write_frame(): Broken pipe Error writing trailer of pipe:: Broken pipe

halfirondad commented 6 months ago

Same issue here too....

2023-12-13 16:01:05 74eb5f84c024 Reolink[1] INFO Spawning ffmpeg for video1 (3AjUf5hFQ1Keom5e): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -stimeout 15000000 -rtsp_transport tcp -i "rtsp://********:*******@192.168.1.*:554//h264Preview_01_main" -c:v copy -bsf:v "h264_metadata=tick_rate=60000/1001" -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=3AjUf5hFQ1Keom5e -f flv - | /usr/local/bin/python -m unifi.clock_sync | nc 192.168.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
av_interleaved_write_frame(): Broken pipe
    Last message repeated 1 times
Error writing trailer of pipe:: Broken pipe
grstreten commented 6 months ago

Likewise with the above issue.

tromanshow commented 6 months ago

Hello same here ...

Error writing trailer of pipe:: Broken pipe

and also

WARNING Previous ffmpeg process for video2 died.

I got the same Ip for the camera ( 192.168.1.10) that has nothing to do with current setup.

simclancy commented 6 months ago

Use the dev branch, i tried that yesterday and it was working.

robertlynch3 commented 6 months ago

Use the dev branch, i tried that yesterday and it was working.

are you referring to the docker image image: keshavdv/unifi-cam-proxy:dev?

simclancy commented 6 months ago

Use the dev branch, i tried that yesterday and it was working.

are you referring to the docker image image: keshavdv/unifi-cam-proxy:dev?

Yep

loungelizard2018 commented 6 months ago

Thanks for your efforts. I just pulled the image but I am still facing difficulties with broken pipe. Also i notice that the IP in the unifi setup is still shown as 192.168.1.10.

2023-12-31 04:57:14 af24a072b9c4 RTSPCam[1] WARNING Previous ffmpeg process for video2 died. 2023-12-31 04:57:14 af24a072b9c4 RTSPCam[1] INFO Spawning ffmpeg for video2 (hNN1euzajteYwOLq): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://10.1.110.254:8554/unicast" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamName=hNN1euzajteYwOLq -f flv - | /usr/local/bin/python -m unifi.clock_sync --write-timestamps | nc 10.1.100.1 7550 2023-12-31 04:57:20 af24a072b9c4 RTSPCam[1] INFO Processing [NetworkStatus] message 2023-12-31 04:57:20 af24a072b9c4 RTSPCam[1] INFO Processing [GetSystemStats] message 2023-12-31 04:57:29 af24a072b9c4 RTSPCam[1] INFO Processing [ChangeVideoSettings] message 2023-12-31 04:57:30 af24a072b9c4 RTSPCam[1] INFO Processing [NetworkStatus] message 2023-12-31 04:57:30 af24a072b9c4 RTSPCam[1] INFO Processing [GetSystemStats] message 2023-12-31 04:57:40 af24a072b9c4 RTSPCam[1] INFO Processing [NetworkStatus] message 2023-12-31 04:57:40 af24a072b9c4 RTSPCam[1] INFO Processing [GetSystemStats] message 2023-12-31 04:57:44 af24a072b9c4 RTSPCam[1] INFO Processing [ChangeVideoSettings] message 2023-12-31 04:57:47 af24a072b9c4 RTSPCam[1] INFO Processing [ChangeVideoSettings] message 2023-12-31 04:57:50 af24a072b9c4 RTSPCam[1] INFO Processing [NetworkStatus] message 2023-12-31 04:57:50 af24a072b9c4 RTSPCam[1] INFO Processing [GetSystemStats] message 2023-12-31 04:57:54 af24a072b9c4 RTSPCam[1] INFO Processing [ChangeVideoSettings] message rtsp://10.1.110.254:8554/unicast: Operation timed out Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> BrokenPipeError: [Errno 32] Broken pipe 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 <module> 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 rtsp://10.1.110.254:8554/unicast: Operation timed out 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 2023-12-31 04:58:00 af24a072b9c4 RTSPCam[1] INFO Processing [NetworkStatus] message 2023-12-31 04:58:00 af24a072b9c4 RTSPCam[1] INFO Processing [GetSystemStats] message 2023-12-31 04:58:10 af24a072b9c4 RTSPCam[1] INFO Processing [NetworkStatus] message 2023-12-31 04:58:10 af24a072b9c4 RTSPCam[1] INFO Processing [GetSystemStats] message 2023-12-31 04:58:14 af24a072b9c4 RTSPCam[1] INFO Processing [ChangeVideoSettings] message ffmpeg version 5.1.3 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924 configuration: --prefix=/usr --enable-avfilter --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libpulse --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-libdav1d --enable-lto --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --enable-librist --enable-libsrt --enable-libssh --enable-libvidstab --disable-stripping --disable-static --disable-librtmp --disable-lzma --enable-libaom --enable-libopus --enable-libsoxr --enable-libwebp --enable-vaapi --enable-vdpau --enable-vulkan --enable-libdrm --enable-libzmq --optflags=-O2 --disable-debug --enable-libsvtav1 libavutil 57. 28.100 / 57. 28.100 libavcodec 59. 37.100 / 59. 37.100 libavformat 59. 27.100 / 59. 27.100 libavdevice 59. 7.100 / 59. 7.100 libavfilter 8. 44.100 / 8. 44.100 libswscale 6. 7.100 / 6. 7.100 libswresample 4. 7.100 / 4. 7.100 libpostproc 56. 6.100 / 56. 6.100 2023-12-31 04:58:14 af24a072b9c4 RTSPCam[1] WARNING Previous ffmpeg process for video3 died. 2023-12-31 04:58:14 af24a072b9c4 RTSPCam[1] INFO Spawning ffmpeg for video3 (qx6ZEOyWJ4WMN7x2): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://10.1.110.254:8554/unicast" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamName=qx6ZEOyWJ4WMN7x2 -f flv - | /usr/local/bin/python -m unifi.clock_sync --write-timestamps | nc 10.1.100.1 7550 2023-12-31 04:58:16 af24a072b9c4 RTSPCam[1] INFO Processing [ChangeVideoSettings] message ffmpeg version 5.1.3 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924 configuration: --prefix=/usr --enable-avfilter --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libpulse --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-libdav1d --enable-lto --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --enable-librist --enable-libsrt --enable-libssh --enable-libvidstab --disable-stripping --disable-static --disable-librtmp --disable-lzma --enable-libaom --enable-libopus --enable-libsoxr --enable-libwebp --enable-vaapi --enable-vdpau --enable-vulkan --enable-libdrm --enable-libzmq --optflags=-O2 --disable-debug --enable-libsvtav1 libavutil 57. 28.100 / 57. 28.100 libavcodec 59. 37.100 / 59. 37.100 libavformat 59. 27.100 / 59. 27.100 libavdevice 59. 7.100 / 59. 7.100 libavfilter 8. 44.100 / 8. 44.100 libswscale 6. 7.100 / 6. 7.100 libswresample 4. 7.100 / 4. 7.100 libpostproc 56. 6.100 / 56. 6.100 2023-12-31 04:58:16 af24a072b9c4 RTSPCam[1] WARNING Previous ffmpeg process for video1 died. 2023-12-31 04:58:16 af24a072b9c4 RTSPCam[1] INFO Spawning ffmpeg for video1 (QYGe5K2k4uX1gEXQ): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://10.1.110.254:8554/unicast" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamName=QYGe5K2k4uX1gEXQ -f flv - | /usr/local/bin/python -m unifi.clock_sync --write-timestamps | nc 10.1.100.1 7550 2023-12-31 04:58:20 af24a072b9c4 RTSPCam[1] INFO Processing [NetworkStatus] message 2023-12-31 04:58:20 af24a072b9c4 RTSPCam[1] INFO Processing [GetSystemStats] message 2023-12-31 04:58:24 af24a072b9c4 RTSPCam[1] INFO Processing [GetRequest] message 2023-12-31 04:58:24 af24a072b9c4 RTSPCam[1] INFO Processing [ChangeVideoSettings] message ffmpeg version 5.1.3 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924 configuration: --prefix=/usr --enable-avfilter --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libpulse --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-libdav1d --enable-lto --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --enable-librist --enable-libsrt --enable-libssh --enable-libvidstab --disable-stripping --disable-static --disable-librtmp --disable-lzma --enable-libaom --enable-libopus --enable-libsoxr --enable-libwebp --enable-vaapi --enable-vdpau --enable-vulkan --enable-libdrm --enable-libzmq --optflags=-O2 --disable-debug --enable-libsvtav1 libavutil 57. 28.100 / 57. 28.100 libavcodec 59. 37.100 / 59. 37.100 libavformat 59. 27.100 / 59. 27.100 libavdevice 59. 7.100 / 59. 7.100 libavfilter 8. 44.100 / 8. 44.100 libswscale 6. 7.100 / 6. 7.100 libswresample 4. 7.100 / 4. 7.100 libpostproc 56. 6.100 / 56. 6.100 2023-12-31 04:58:24 af24a072b9c4 RTSPCam[1] WARNING Previous ffmpeg process for video2 died. 2023-12-31 04:58:24 af24a072b9c4 RTSPCam[1] INFO Spawning ffmpeg for video2 (hNN1euzajteYwOLq): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://10.1.110.254:8554/unicast" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamName=hNN1euzajteYwOLq -f flv - | /usr/local/bin/python -m unifi.clock_sync --write-timestamps | nc 10.1.100.1 7550 rtsp://10.1.110.254:8554/unicast: Invalid data found when processing input 2023-12-31 04:58:30 af24a072b9c4 RTSPCam[1] INFO Processing [NetworkStatus] message 2023-12-31 04:58:30 af24a072b9c4 RTSPCam[1] INFO Processing [GetSystemStats] message rtsp://10.1.110.254:8554/unicast: Invalid data found when processing input rtsp://10.1.110.254:8554/unicast: Invalid data found when processing input

simclancy commented 6 months ago

Thanks for your efforts. I just pulled the image but I am still facing difficulties with broken pipe. Also i notice that the IP in the unifi setup is still shown as 192.168.1.10.

2023-12-31 04:57:14 af24a072b9c4 RTSPCam[1] WARNING Previous ffmpeg process for video2 died. 2023-12-31 04:57:14 af24a072b9c4 RTSPCam[1] INFO Spawning ffmpeg for video2 (hNN1euzajteYwOLq): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://10.1.110.254:8554/unicast" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamName=hNN1euzajteYwOLq -f flv - | /usr/local/bin/python -m unifi.clock_sync --write-timestamps | nc 10.1.100.1 7550 2023-12-31 04:57:20 af24a072b9c4 RTSPCam[1] INFO Processing [NetworkStatus] message 2023-12-31 04:57:20 af24a072b9c4 RTSPCam[1] INFO Processing [GetSystemStats] message 2023-12-31 04:57:29 af24a072b9c4 RTSPCam[1] INFO Processing [ChangeVideoSettings] message 2023-12-31 04:57:30 af24a072b9c4 RTSPCam[1] INFO Processing [NetworkStatus] message 2023-12-31 04:57:30 af24a072b9c4 RTSPCam[1] INFO Processing [GetSystemStats] message 2023-12-31 04:57:40 af24a072b9c4 RTSPCam[1] INFO Processing [NetworkStatus] message 2023-12-31 04:57:40 af24a072b9c4 RTSPCam[1] INFO Processing [GetSystemStats] message 2023-12-31 04:57:44 af24a072b9c4 RTSPCam[1] INFO Processing [ChangeVideoSettings] message 2023-12-31 04:57:47 af24a072b9c4 RTSPCam[1] INFO Processing [ChangeVideoSettings] message 2023-12-31 04:57:50 af24a072b9c4 RTSPCam[1] INFO Processing [NetworkStatus] message 2023-12-31 04:57:50 af24a072b9c4 RTSPCam[1] INFO Processing [GetSystemStats] message 2023-12-31 04:57:54 af24a072b9c4 RTSPCam[1] INFO Processing [ChangeVideoSettings] message rtsp://10.1.110.254:8554/unicast: Operation timed out Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> BrokenPipeError: [Errno 32] Broken pipe 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 <module> 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 rtsp://10.1.110.254:8554/unicast: Operation timed out 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 2023-12-31 04:58:00 af24a072b9c4 RTSPCam[1] INFO Processing [NetworkStatus] message 2023-12-31 04:58:00 af24a072b9c4 RTSPCam[1] INFO Processing [GetSystemStats] message 2023-12-31 04:58:10 af24a072b9c4 RTSPCam[1] INFO Processing [NetworkStatus] message 2023-12-31 04:58:10 af24a072b9c4 RTSPCam[1] INFO Processing [GetSystemStats] message 2023-12-31 04:58:14 af24a072b9c4 RTSPCam[1] INFO Processing [ChangeVideoSettings] message ffmpeg version 5.1.3 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924 configuration: --prefix=/usr --enable-avfilter --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libpulse --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-libdav1d --enable-lto --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --enable-librist --enable-libsrt --enable-libssh --enable-libvidstab --disable-stripping --disable-static --disable-librtmp --disable-lzma --enable-libaom --enable-libopus --enable-libsoxr --enable-libwebp --enable-vaapi --enable-vdpau --enable-vulkan --enable-libdrm --enable-libzmq --optflags=-O2 --disable-debug --enable-libsvtav1 libavutil 57. 28.100 / 57. 28.100 libavcodec 59. 37.100 / 59. 37.100 libavformat 59. 27.100 / 59. 27.100 libavdevice 59. 7.100 / 59. 7.100 libavfilter 8. 44.100 / 8. 44.100 libswscale 6. 7.100 / 6. 7.100 libswresample 4. 7.100 / 4. 7.100 libpostproc 56. 6.100 / 56. 6.100 2023-12-31 04:58:14 af24a072b9c4 RTSPCam[1] WARNING Previous ffmpeg process for video3 died. 2023-12-31 04:58:14 af24a072b9c4 RTSPCam[1] INFO Spawning ffmpeg for video3 (qx6ZEOyWJ4WMN7x2): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://10.1.110.254:8554/unicast" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamName=qx6ZEOyWJ4WMN7x2 -f flv - | /usr/local/bin/python -m unifi.clock_sync --write-timestamps | nc 10.1.100.1 7550 2023-12-31 04:58:16 af24a072b9c4 RTSPCam[1] INFO Processing [ChangeVideoSettings] message ffmpeg version 5.1.3 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924 configuration: --prefix=/usr --enable-avfilter --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libpulse --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-libdav1d --enable-lto --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --enable-librist --enable-libsrt --enable-libssh --enable-libvidstab --disable-stripping --disable-static --disable-librtmp --disable-lzma --enable-libaom --enable-libopus --enable-libsoxr --enable-libwebp --enable-vaapi --enable-vdpau --enable-vulkan --enable-libdrm --enable-libzmq --optflags=-O2 --disable-debug --enable-libsvtav1 libavutil 57. 28.100 / 57. 28.100 libavcodec 59. 37.100 / 59. 37.100 libavformat 59. 27.100 / 59. 27.100 libavdevice 59. 7.100 / 59. 7.100 libavfilter 8. 44.100 / 8. 44.100 libswscale 6. 7.100 / 6. 7.100 libswresample 4. 7.100 / 4. 7.100 libpostproc 56. 6.100 / 56. 6.100 2023-12-31 04:58:16 af24a072b9c4 RTSPCam[1] WARNING Previous ffmpeg process for video1 died. 2023-12-31 04:58:16 af24a072b9c4 RTSPCam[1] INFO Spawning ffmpeg for video1 (QYGe5K2k4uX1gEXQ): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://10.1.110.254:8554/unicast" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamName=QYGe5K2k4uX1gEXQ -f flv - | /usr/local/bin/python -m unifi.clock_sync --write-timestamps | nc 10.1.100.1 7550 2023-12-31 04:58:20 af24a072b9c4 RTSPCam[1] INFO Processing [NetworkStatus] message 2023-12-31 04:58:20 af24a072b9c4 RTSPCam[1] INFO Processing [GetSystemStats] message 2023-12-31 04:58:24 af24a072b9c4 RTSPCam[1] INFO Processing [GetRequest] message 2023-12-31 04:58:24 af24a072b9c4 RTSPCam[1] INFO Processing [ChangeVideoSettings] message ffmpeg version 5.1.3 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924 configuration: --prefix=/usr --enable-avfilter --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libpulse --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-libdav1d --enable-lto --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --enable-librist --enable-libsrt --enable-libssh --enable-libvidstab --disable-stripping --disable-static --disable-librtmp --disable-lzma --enable-libaom --enable-libopus --enable-libsoxr --enable-libwebp --enable-vaapi --enable-vdpau --enable-vulkan --enable-libdrm --enable-libzmq --optflags=-O2 --disable-debug --enable-libsvtav1 libavutil 57. 28.100 / 57. 28.100 libavcodec 59. 37.100 / 59. 37.100 libavformat 59. 27.100 / 59. 27.100 libavdevice 59. 7.100 / 59. 7.100 libavfilter 8. 44.100 / 8. 44.100 libswscale 6. 7.100 / 6. 7.100 libswresample 4. 7.100 / 4. 7.100 libpostproc 56. 6.100 / 56. 6.100 2023-12-31 04:58:24 af24a072b9c4 RTSPCam[1] WARNING Previous ffmpeg process for video2 died. 2023-12-31 04:58:24 af24a072b9c4 RTSPCam[1] INFO Spawning ffmpeg for video2 (hNN1euzajteYwOLq): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://10.1.110.254:8554/unicast" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamName=hNN1euzajteYwOLq -f flv - | /usr/local/bin/python -m unifi.clock_sync --write-timestamps | nc 10.1.100.1 7550 rtsp://10.1.110.254:8554/unicast: Invalid data found when processing input 2023-12-31 04:58:30 af24a072b9c4 RTSPCam[1] INFO Processing [NetworkStatus] message 2023-12-31 04:58:30 af24a072b9c4 RTSPCam[1] INFO Processing [GetSystemStats] message rtsp://10.1.110.254:8554/unicast: Invalid data found when processing input rtsp://10.1.110.254:8554/unicast: Invalid data found when processing input

I dont have this broken pipe thing with the dev branch, but there is some weirdness with the camera IP. So i checked the files (main.py) on github, the default is that IP, you can change it with --IP but with Unraid you get some error with you only being able to use that custom IP with user created networks, it worked for me when i used the docker compose manager.

loungelizard2018 commented 6 months ago

I dont have this broken pipe thing with the dev branch, but there is some weirdness with the camera IP. So i checked the files (main.py) on github, the default is that IP, you can change it with --IP but with Unraid you get some error with you only being able to use that custom IP with user created networks, it worked for me when i used the docker compose manager.

Could you explain what you did?

simclancy commented 6 months ago

I am still messing around but this is what works with IP change for me.

`services: proxy-1: restart: unless-stopped image: keshavdv/unifi-cam-proxy:dev volumes:

I have also tested a similar one with just rtsp and not the frigate one, you just need to change after the token to rtsp -s and remove the unnecessary stuff.

loungelizard2018 commented 6 months ago

I am still messing around but this is what works with IP change for me.

services: proxy-1: restart: unless-stopped image: keshavdv/unifi-cam-proxy:dev volumes: - "/mnt/user/appdata/camproxy/client.pem:/client.pem" command: unifi-cam-proxy --host 192.168.0.1 --ip 192.168.0.220 --mac 'XXX' --cert /client.pem --token XXX frigate -s "rtsp://XXX@192.168.0.204:8554/XXX_Camera_sub?video=all&audio=all" --mqtt-host "192.168.0.203" --mqtt-username "admin" --mqtt-password "XXX" --frigate-camera XXX_Camera --snapshot-url "http://192.168.0.204:5000/live/webrtc/api/frame.mp4?src=XXX_Camera"

I have also tested a similar one with just rtsp and not the frigate one, you just need to change after the token to rtsp -s and remove the unnecessary stuff.

Thanks... I can confirm getting the IP address changed this way successfully.

I still do get broken pipe exceptions and then the ffmpeg process dies. But it seems to pick up afterwards quickly again therefore works decently. I will try with a different camera to ensure there is nothing wrong with the rtsp stream.

Ownezx commented 5 months ago

Hi there, I have been trying to make a [insert camera model name] on my network and have been having the same issues.

I run on a broken pipe in the same way as some others previously :

2024-01-12 16:37:56 RedactedMachineName RTSPCam[965209] INFO Spawning ffmpeg for video2 (FbtRYZ4Bw0M8y83Q): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -stimeout 15000000 -rtsp_transport tcp -i "redacted rtsp link" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=FbtRYZ4Bw0M8y83Q -f flv - | /usr/bin/python3 -m unifi.clock_sync | nc redacted_ip 7550
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.10/dist-packages/unifi/clock_sync.py", line 167, in <module>
    main()
  File "/usr/local/lib/python3.10/dist-packages/unifi/clock_sync.py", line 157, in main
    write(read_bytes(source, payload_size))
  File "/usr/local/lib/python3.10/dist-packages/unifi/clock_sync.py", line 87, in write
    sys.stdout.buffer.write(data)
BrokenPipeError: [Errno 32] Broken pipe
av_interleaved_write_frame(): Broken pipe
Error writing trailer of pipe:: Broken pipe

So far I have G3 flex working on my UniFi software, so I think that side is working correctly, and I have managed to use ffmpeg to save my stream to an mp4 file without any issues.

Could there be an issue with the way the clock_sync writes the data to UniFi and unify closing the socket?

MyndPhreak commented 5 months ago

When I use the dev branch of the docker, the camera shows up as online and gives me a snapshot, but then subsequently crashes Unifi Protect for some reason and I have to restart it. Currently using this as posted above:

version: "3.5"
services: 
  unifi-cam-proxy: 
    restart: unless-stopped 
    image: keshavdv/unifi-cam-proxy:dev
    volumes: 
      - "./client.pem:/client.pem"
    command: unifi-cam-proxy --host 10.0.0.1 --ip 10.0.0.84 --mac 'xxx' --model 'UVC G4 PTZ' --cert /client.pem --token xxx frigate -s "rtsp://10.0.0.84:554/stream0?video=all&audio=all" --mqtt-host "10.0.0.139" --mqtt-port 1883 --mqtt-username "xxx" --mqtt-password "xxx" --frigate-camera ptzcam --snapshot-url "http://10.0.0.26:5069/api/ptzcam" 

I have some logs here:

ffmpeg version 5.1.3 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924
  configuration: --prefix=/usr --enable-avfilter --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libpulse --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-libdav1d --enable-lto --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --enable-librist --enable-libsrt --enable-libssh --enable-libvidstab --disable-stripping --disable-static --disable-librtmp --disable-lzma --enable-libaom --enable-libopus --enable-libsoxr --enable-libwebp --enable-vaapi --enable-vdpau --enable-vulkan --enable-libdrm --enable-libzmq --optflags=-O2 --disable-debug --enable-libsvtav1
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
2024-01-13 01:21:39 b0e10960476e FrigateCam[1] WARNING Previous ffmpeg process for video1 died.
2024-01-13 01:21:39 b0e10960476e FrigateCam[1] INFO Spawning ffmpeg for video1 (VH77C7BMBDIfO8Bh): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://10.0.0.84:554/stream0?video=all&audio=all" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamName=VH77C7BMBDIfO8Bh -f flv - | /usr/local/bin/python -m unifi.clock_sync --write-timestamps | nc 10.0.0.1 7550
2024-01-13 01:21:41 b0e10960476e FrigateCam[1] INFO Processing [ChangeIspSettings] message
2024-01-13 01:21:41 b0e10960476e FrigateCam[1] INFO Processing [ChangeOsdSettings] message
2024-01-13 01:21:41 b0e10960476e FrigateCam[1] INFO Processing [ChangeAudioEventsSettings] message
2024-01-13 01:21:41 b0e10960476e FrigateCam[1] INFO Processing [ChangeSoundLedSettings] message
2024-01-13 01:21:41 b0e10960476e FrigateCam[1] INFO Processing [ChangeVideoSettings] message
2024-01-13 01:21:41 b0e10960476e FrigateCam[1] INFO Processing [ChangeSmartMotionSettings] message
2024-01-13 01:21:41 b0e10960476e FrigateCam[1] INFO Processing [EnableLogging] message
2024-01-13 01:21:41 b0e10960476e FrigateCam[1] INFO Processing [ChangeDeviceSettings] message
2024-01-13 01:21:41 b0e10960476e FrigateCam[1] INFO Processing [ChangeDeviceSettings] message
2024-01-13 01:21:41 b0e10960476e FrigateCam[1] INFO Processing [ChangeSmartDetectSettings] message
2024-01-13 01:21:41 b0e10960476e FrigateCam[1] INFO Processing [SmartMotionTest] message
2024-01-13 01:21:41 b0e10960476e FrigateCam[1] INFO Processing [ChangeVideoSettings] message
2024-01-13 01:21:41 b0e10960476e FrigateCam[1] INFO Processing [UpdateUsernamePassword] message
2024-01-13 01:21:41 b0e10960476e FrigateCam[1] INFO Processing [ChangeVideoSettings] message
2024-01-13 01:21:46 b0e10960476e FrigateCam[1] INFO Processing [NetworkStatus] message
2024-01-13 01:21:46 b0e10960476e FrigateCam[1] INFO Processing [GetSystemStats] message
2024-01-13 01:21:56 b0e10960476e FrigateCam[1] INFO Processing [NetworkStatus] message
2024-01-13 01:21:56 b0e10960476e FrigateCam[1] INFO Processing [GetSystemStats] message
2024-01-13 01:22:06 b0e10960476e FrigateCam[1] INFO Processing [NetworkStatus] message
2024-01-13 01:22:06 b0e10960476e FrigateCam[1] INFO Processing [GetSystemStats] message
2024-01-13 01:22:16 b0e10960476e FrigateCam[1] INFO Processing [NetworkStatus] message
2024-01-13 01:22:16 b0e10960476e FrigateCam[1] INFO Processing [GetSystemStats] message
2024-01-13 01:22:26 b0e10960476e FrigateCam[1] INFO Processing [NetworkStatus] message
2024-01-13 01:22:26 b0e10960476e FrigateCam[1] INFO Processing [GetSystemStats] message
2024-01-13 01:22:36 b0e10960476e FrigateCam[1] INFO Processing [NetworkStatus] message
2024-01-13 01:22:36 b0e10960476e FrigateCam[1] INFO Processing [GetSystemStats] message
2024-01-13 01:22:46 b0e10960476e FrigateCam[1] INFO Processing [NetworkStatus] message
2024-01-13 01:22:46 b0e10960476e FrigateCam[1] INFO Processing [GetSystemStats] message
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 <module>
    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='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe
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 <module>
    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='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe
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 <module>
    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='<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
av_interleaved_write_frame(): Broken pipe
Error writing trailer of pipe:: Broken pipe
Error closing file pipe:: Broken pipe
2024-01-13 01:22:52 b0e10960476e FrigateCam[1] INFO Connection to 10.0.0.1 was closed.
2024-01-13 01:22:52 b0e10960476e FrigateCam[1] INFO Cleaning up instance
2024-01-13 01:22:52 b0e10960476e FrigateCam[1] INFO Stopping stream video3
2024-01-13 01:22:52 b0e10960476e FrigateCam[1] INFO Stopping stream video2
2024-01-13 01:22:52 b0e10960476e FrigateCam[1] INFO Stopping stream video1
2024-01-13 01:22:52 b0e10960476e Core[1] INFO Backing off connect(...) for 10.0s (True)

Edit: Actually it works now, turns out setting it to a PTZ cam does not work.

Buster14 commented 5 months ago

Same issue here, using pi5 + UP docker image from here + hikvision cams https://github.com/markdegrootnl/unifi-protect-arm64/issues Tried various configs but i only get screenshots. So was this axed by unifi or what?

mcaramb commented 5 months ago

Using Bare Metal Ubuntu installation

Same issues here. BrokenPipe errors. If you look at the command line code repeatedly generated by the script:

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

It seems 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 NVR. so, two pipes. If you just make the script pipe the stream to clock_sync.pl and then only do stdout to the screen from clock_sync.py (don't continue the pass to nc), the stream fills the screen with the video data encoding data continuously with no broken pipe error, so it's not on the input encoding side.

You can see this by just running the command line:

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

(you just take off the final pipe to nc | nc 192.168.19.7 7550)

but if you change it back and pipe the clock_sync.py stream onward to nc, it breaks after one frame.

I think what's going on here is the NVR server starts to receive the flv data via netcat, but senses something weird is up with it, and rejects the connection, thus nc dies, causing the pipe to break between clock_sync.py and nc. Maybe unify changed something in the codec settings of what it's willing to accept as a live incoming stream that rejects it now.

dcigir commented 5 months ago

I'm running it on Synology NAS, Unifi protect is on UDM SE and I am only getting snapshot. Even with the dev branch. What I can't figure it out is where I need to put command with arguments, because in my Docker that command don't work

unifi-cam-proxy -H {NVR IP} -i {camera IP} -c /client.pem -t {Adoption token} reolink -u {username} -p {password} -s “main” –ffmpeg-args=‘-c:v copy -bsf:v “h264_metadata=tick_rate=60000/1001” -ar 32000 -ac 1 -codec:a aac -b:a 32k’

This is my log output:

ffmpeg version 5.1.3 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 12.2.1 (Alpine 12.2.1git20220924-r4) 20220924
configuration: --prefix=/usr --enable-avfilter --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-gpl --enable- libass --enable-libmp3lame --enable-libpulse --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora - -enable-libv4l2 --enable-libdav1d --enable-lto --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --enable-librist --enab le-libsrt --enable-libssh --enable-libvidstab --disable-stripping --disable-static --disable-librtmp --disable-lzma --enable-libaom --enable-libopus -- enable-libsoxr --enable-libwebp --enable-vaapi --enable-vdpau --enable-vulkan --enable-libdrm --enable-libzmq --optflags=-O2 --disable-debug --enable-l ibsvtav1
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
libpostproc 56. 6.100 / 56. 6.100
2024-02-01 20:37:15 keshavdv-unifi-cam-proxy3 RTSPCam[1] WARNING Previous ffmpeg process for video2 died.
2024-02-01 20:37:15 keshavdv-unifi-cam-proxy3 RTSPCam[1] INFO Spawning ffmpeg for video2 (le6l8p4LHsxlo99w): ffmpeg -nostdin -loglevel error -y -avoid
negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://xxxxx:xxxxxxx@192 .168.1.137:554/h264Preview_01_main" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamName=le6l8p4LHsxlo99w -f flv - | /usr/local/bin/pyt hon -m unifi.clock_sync --write-timestamps | nc 192.168.1.1 7550
[flv @ 0x7fb9f1973380] Video codec hevc not compatible with flv
Could not write header for output file #0 (incorrect codec parameters ?): Function not implemented
Error initializing output stream 0:1 --
^[a2024-02-01 20:37:18 keshavdv-unifi-cam-proxy3 RTSPCam[1] INFO Processing [GetRequest] message

mcaramb commented 5 months ago

I'm running it on Synology NAS, Unifi protect is on UDM SE and I am only getting snapshot. Even with the dev branch. What I can't figure it out is where I need to put command with arguments, because in my Docker that command don't work

unifi-cam-proxy -H {NVR IP} -i {camera IP} -c /client.pem -t {Adoption token} reolink -u {username} -p {password} -s “main” –ffmpeg-args=‘-c:v copy -bsf:v “h264_metadata=tick_rate=60000/1001” -ar 32000 -ac 1 -codec:a aac -b:a 32k’

This is my log output:

ffmpeg version 5.1.3 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 12.2.1 (Alpine 12.2.1git20220924-r4) 20220924 configuration: --prefix=/usr --enable-avfilter --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-gpl --enable- libass --enable-libmp3lame --enable-libpulse --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora - -enable-libv4l2 --enable-libdav1d --enable-lto --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --enable-librist --enab le-libsrt --enable-libssh --enable-libvidstab --disable-stripping --disable-static --disable-librtmp --disable-lzma --enable-libaom --enable-libopus -- enable-libsoxr --enable-libwebp --enable-vaapi --enable-vdpau --enable-vulkan --enable-libdrm --enable-libzmq --optflags=-O2 --disable-debug --enable-l ibsvtav1 libavutil 57. 28.100 / 57. 28.100 libavcodec 59. 37.100 / 59. 37.100 libavformat 59. 27.100 / 59. 27.100 libavdevice 59. 7.100 / 59. 7.100 libavfilter 8. 44.100 / 8. 44.100 libswscale 6. 7.100 / 6. 7.100 libswresample 4. 7.100 / 4. 7.100 libpostproc 56. 6.100 / 56. 6.100 2024-02-01 20:37:15 keshavdv-unifi-cam-proxy3 RTSPCam[1] WARNING Previous ffmpeg process for video2 died. 2024-02-01 20:37:15 keshavdv-unifi-cam-proxy3 RTSPCam[1] INFO Spawning ffmpeg for video2 (le6l8p4LHsxlo99w): ffmpeg -nostdin -loglevel error -y -avoid negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://xxxxx:xxxxxxx@192 .168.1.137:554/h264Preview_01_main" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamName=le6l8p4LHsxlo99w -f flv - | /usr/local/bin/pyt hon -m unifi.clock_sync --write-timestamps | nc 192.168.1.1 7550 [flv @ 0x7fb9f1973380] Video codec hevc not compatible with flv Could not write header for output file #0 (incorrect codec parameters ?): Function not implemented Error initializing output stream 0:1 -- ^[a2024-02-01 20:37:18 keshavdv-unifi-cam-proxy3 RTSPCam[1] INFO Processing [GetRequest] message

Now that's interesting. I don't use Docker so can't speak for the dev branch version (still waiting for the dev branch command line version for apt install), but it looks like he was trying to change the flv file format based on a change on Protect....

[flv @ 0x7fb9f1973380] Video codec hevc not compatible with flv Could not write header for output file #0 (incorrect codec parameters ?): Function not implemented Error initializing output stream 0:1 -- ^[a2024-02-01 20:37:18 keshavdv-unifi-cam-proxy3 RTSPCam[1] INFO Processing [GetRequest] message

I think this is gonna be dead until someone can figure out the new flv requirements for the new version of Protect.

simclancy commented 5 months ago

[flv @ 0x7fb9f1973380] Video codec hevc not compatible with flv

Try to change your camera settings to H264, basically make sure the camera settings is configured to what is recommended by Frigate and Scrypted.

I dont have this broken pipe thing with the dev branch.

dcigir commented 5 months ago

[flv @ 0x7fb9f1973380] Video codec hevc not compatible with flv

Try to change your camera settings to H264, basically make sure the camera settings is configured to what is recommended by Frigate and Scrypted.

I dont have this broken pipe thing with the dev branch.

@simclancy What type of camera are u using? Where do you run unifi-camera-proxy?

simclancy commented 5 months ago

[flv @ 0x7fb9f1973380] Video codec hevc not compatible with flv Try to change your camera settings to H264, basically make sure the camera settings is configured to what is recommended by Frigate and Scrypted. I dont have this broken pipe thing with the dev branch.

@simclancy What type of camera are u using? Where do you run unifi-camera-proxy?

Bunch of Hikvision and Reolink cameras, i tried the RTSP way before but now i am using through Frigate. Unraid, using docker compose.

mcaramb commented 5 months ago

Ok, I'm trying the Docker version with the dev branch this weekend. I have zero experience using the Docker containers, but have been doing some reading. I'm on a Mac and would prefer to OSX and the Docker Desktop app. Do I just install the make Docker Desktop, then point to the repository and search for it? where does the docker-compose.yaml file fit in? Is that just for Docker Compose, which I assume is an alternative method of creating a container rather than through the Desktop app?

simclancy commented 5 months ago

Ok, I'm trying the Docker version with the dev branch this weekend. I have zero experience using the Docker containers, but have been doing some reading. I'm on a Mac and would prefer to OSX and the Docker Desktop app. Do I just install the make Docker Desktop, then point to the repository and search for it? where does the docker-compose.yaml file fit in? Is that just for Docker Compose, which I assume is an alternative method of creating a container rather than through the Desktop app?

Well you will have to search yourself if the non linux variants of Docker has the same functionalities, i thought it didnt at least on windows. I did post what i used in this thread, just search for that as a reference.

mcaramb commented 5 months ago

Well you will have to search yourself if the non linux variants of Docker has the same functionalities, i thought it didnt at least on windows. I did post what i used in this thread, just search for that as a reference.

Ok, with docker I was able to pull the dev branch and build the container from the docker-compose.yaml file, and the broken pipe errors have gone away, but the stream now updates, but only every 25 or so seconds. I'm not using frigate, just straight rtsp H264, 1920x1080, 20fps feed from the cam (LTS CMIP3502). Tried adding the IP and MAC flags, still no joy. There's apparently a ton of other builds from other people in the repository, I may try some of those instead. Would really love to get this working as we have 35+ quite nice cams I really am not looking forward to replace just to get them all on a common platform.

simclancy commented 4 months ago

Well you will have to search yourself if the non linux variants of Docker has the same functionalities, i thought it didnt at least on windows. I did post what i used in this thread, just search for that as a reference.

Ok, with docker I was able to pull the dev branch and build the container from the docker-compose.yaml file, and the broken pipe errors have gone away, but the stream now updates, but only every 25 or so seconds. I'm not using frigate, just straight rtsp H264, 1920x1080, 20fps feed from the cam (LTS CMIP3502). Tried adding the IP and MAC flags, still no joy. There's apparently a ton of other builds from other people in the repository, I may try some of those instead. Would really love to get this working as we have 35+ quite nice cams I really am not looking forward to replace just to get them all on a common platform.

Where are the other builds? Pretty sure 35 cams is above what is supported if you are just using a UDM Pro

mcaramb commented 4 months ago

Well you will have to search yourself if the non linux variants of Docker has the same functionalities, i thought it didnt at least on windows. I did post what i used in this thread, just search for that as a reference.

Ok, with docker I was able to pull the dev branch and build the container from the docker-compose.yaml file, and the broken pipe errors have gone away, but the stream now updates, but only every 25 or so seconds. I'm not using frigate, just straight rtsp H264, 1920x1080, 20fps feed from the cam (LTS CMIP3502). Tried adding the IP and MAC flags, still no joy. There's apparently a ton of other builds from other people in the repository, I may try some of those instead. Would really love to get this working as we have 35+ quite nice cams I really am not looking forward to replace just to get them all on a common platform.

Where are the other builds? Pretty sure 35 cams is above what is supported if you are just using a UDM Pro

Oh man, I've got like over 100 cameras total split over 3 UDM PROs. I've already converted most of our extremely old IPS and analog composite ones to Ubiquity cams, but there's nothing wrong with these newer 30+ LTS ones. Also, I'm having a hard time selling them used. Already finding it impossible with the other 70 older ones I've already replaced even when I included the old proprietary NVRs.

And, you can really push the limits depending on resolution. For example, on NVR1 alone I've got (42) G3 Flexs and (2) G4 Domes. All three of my UDM Pros have a full arrays of 8Tb HST drives as well. Granted, most of the cams only record on motion, but the cams on NVR2 and NVR3 record full time but there's less of them on those decks.

What I'd like to do is use probably about 5-6 miniMacs (I've already got a bunch of older i7 2012 units laying around) running unifi-cam-proxy for like 5 cams each, as converters to NVR3.

I saw the other builds simply doing an image search for unifi-cam-proxy in the Docker Desktop App Search Bar.

Heheh... So if you're wondering who's the guy that keeps scooping up all the cameras from the ui store, that would probably be me :) Actually, it's taken me over a year to acquire that many from the store, eBay, etc. This has been a long conversion project.

dcigir commented 4 months ago

I would only want that my one Reolink 811A is working on my UDM SE with two other G4 Instant cameras, and you are messing with 100's of them. :)

dcigir commented 4 months ago

Today I tried to use my other camera (Foscam G2 FullHD) in camera-proxy, and it's working normally. The real question is why Reolink 4K camera don't want to work?

johntdyer commented 4 months ago

Not sure if this is the same issue but I've got the camera showing up in the Unifi Protect but its only showing a still image and seemingly refreshing every couple of mins.
`

(reverse-i-search)`tai': ^Cil -f messages
(unifi-cam-proxy) root@debian:/mnt/pve/proxmox_nfs/shared-configs/unifi-cam-proxy# docker logs unifi-driveway-proxy -f
2024-02-09 23:39:25 2659c75680ef RTSPCam[1] INFO Spawning stream for snapshots: ffmpeg -nostdin -y -re -rtsp_transport tcp -i "rtsp://192.168.121.129:8554/driveway_high" -r 1 -update 1 /tmp/tmpz7xnu6xi/screen.jpg
2024-02-09 23:39:25 2659c75680ef Core[1] INFO Creating ws connection to wss://192.168.100.1:7442/camera/1.0/ws?token=iHKxM5aVwWtZmDzTkeg4WcDrOIMv357Y
2024-02-09 23:39:25 2659c75680ef RTSPCam[1] INFO Adopting with token [iHKxM5aVwWtZmDzTkeg4WcDrOIMv357Y] and mac [AA:BB:CC:00:11:22]
2024-02-09 23:39:25 2659c75680ef RTSPCam[1] INFO Processing [ubnt_avclient_hello] message
2024-02-09 23:39:26 2659c75680ef RTSPCam[1] INFO Processing [ubnt_avclient_paramAgreement] message
2024-02-09 23:39:26 2659c75680ef RTSPCam[1] INFO Processing [StopService] message
2024-02-09 23:39:26 2659c75680ef RTSPCam[1] INFO Processing [ubnt_avclient_hello] message
2024-02-09 23:39:26 2659c75680ef RTSPCam[1] INFO Processing [ChangeVideoSettings] message
ffmpeg version 5.1.3 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924
  configuration: --prefix=/usr --enable-avfilter --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libpulse --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-libdav1d --enable-lto --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --enable-librist --enable-libsrt --enable-libssh --enable-libvidstab --disable-stripping --disable-static --disable-librtmp --disable-lzma --enable-libaom --enable-libopus --enable-libsoxr --enable-libwebp --enable-vaapi --enable-vdpau --enable-vulkan --enable-libdrm --enable-libzmq --optflags=-O2 --disable-debug --enable-libsvtav1
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
2024-02-09 23:39:26 2659c75680ef RTSPCam[1] INFO Spawning ffmpeg for video3 (537NDxMuGJC99dxj): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://192.168.121.129:8554/driveway_high" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamName=537NDxMuGJC99dxj -f flv - | /usr/local/bin/python -m unifi.clock_sync --write-timestamps | nc 192.168.100.1 7550
2024-02-09 23:39:26 2659c75680ef RTSPCam[1] INFO Processing [ubnt_avclient_paramAgreement] message
2024-02-09 23:39:27 2659c75680ef RTSPCam[1] INFO Processing [ChangeDeviceSettings] message
2024-02-09 23:39:27 2659c75680ef RTSPCam[1] INFO Processing [NetworkStatus] message
2024-02-09 23:39:27 2659c75680ef RTSPCam[1] INFO Processing [GetSystemStats] message
2024-02-09 23:39:28 2659c75680ef RTSPCam[1] INFO Processing [ChangeVideoSettings] message
ffmpeg version 5.1.3 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924
  configuration: --prefix=/usr --enable-avfilter --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libpulse --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-libdav1d --enable-lto --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --enable-librist --enable-libsrt --enable-libssh --enable-libvidstab --disable-stripping --disable-static --disable-librtmp --disable-lzma --enable-libaom --enable-libopus --enable-libsoxr --enable-libwebp --enable-vaapi --enable-vdpau --enable-vulkan --enable-libdrm --enable-libzmq --optflags=-O2 --disable-debug --enable-libsvtav1
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
2024-02-09 23:39:28 2659c75680ef RTSPCam[1] INFO Spawning ffmpeg for video1 (uICJ25U1DqEZn3O4): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://192.168.121.129:8554/driveway_high" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamName=uICJ25U1DqEZn3O4 -f flv - | /usr/local/bin/python -m unifi.clock_sync --write-timestamps | nc 192.168.100.1 7550
2024-02-09 23:39:28 2659c75680ef RTSPCam[1] INFO Processing [UpdateFirmwareRequest] message
2024-02-09 23:39:28 2659c75680ef RTSPCam[1] INFO Reconnecting...
2024-02-09 23:39:28 2659c75680ef RTSPCam[1] INFO Cleaning up instance
2024-02-09 23:39:28 2659c75680ef RTSPCam[1] INFO Stopping stream video3
2024-02-09 23:39:28 2659c75680ef RTSPCam[1] INFO Stopping stream video1
2024-02-09 23:39:28 2659c75680ef Core[1] INFO Backing off connect(...) for 2.0s (True)
2024-02-09 23:39:30 2659c75680ef Core[1] INFO Creating ws connection to wss://192.168.100.1:7442/camera/1.0/ws?token=iHKxM5aVwWtZmDzTkeg4WcDrOIMv357Y
2024-02-09 23:39:30 2659c75680ef RTSPCam[1] INFO Adopting with token [iHKxM5aVwWtZmDzTkeg4WcDrOIMv357Y] and mac [AA:BB:CC:00:11:22]
2024-02-09 23:39:30 2659c75680ef RTSPCam[1] INFO Processing [ubnt_avclient_hello] message
2024-02-09 23:39:30 2659c75680ef RTSPCam[1] INFO Processing [ubnt_avclient_paramAgreement] message
2024-02-09 23:39:31 2659c75680ef RTSPCam[1] INFO Processing [StopService] message
2024-02-09 23:39:31 2659c75680ef RTSPCam[1] INFO Processing [ubnt_avclient_hello] message
2024-02-09 23:39:31 2659c75680ef RTSPCam[1] INFO Processing [ChangeVideoSettings] message
2024-02-09 23:39:31 2659c75680ef RTSPCam[1] INFO Processing [ChangeDeviceSettings] message
2024-02-09 23:39:31 2659c75680ef RTSPCam[1] INFO Processing [NetworkStatus] message
2024-02-09 23:39:31 2659c75680ef RTSPCam[1] INFO Processing [GetSystemStats] message
2024-02-09 23:39:31 2659c75680ef RTSPCam[1] INFO Processing [ubnt_avclient_paramAgreement] message
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 <module>
    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
av_interleaved_write_frame(): Broken pipe
Error writing trailer of pipe:: Broken pipe
Error closing file pipe:: Broken pipe
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 <module>
    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
av_interleaved_write_frame(): Broken pipe
Error writing trailer of pipe:: Broken pipe
Error closing file pipe:: Broken pipe
2024-02-09 23:39:36 2659c75680ef RTSPCam[1] INFO Processing [ChangeIspSettings] message
2024-02-09 23:39:36 2659c75680ef RTSPCam[1] INFO Processing [ChangeOsdSettings] message
2024-02-09 23:39:36 2659c75680ef RTSPCam[1] INFO Processing [ChangeAudioEventsSettings] message
2024-02-09 23:39:36 2659c75680ef RTSPCam[1] INFO Processing [ChangeSoundLedSettings] message
2024-02-09 23:39:36 2659c75680ef RTSPCam[1] INFO Processing [ChangeVideoSettings] message
2024-02-09 23:39:36 2659c75680ef RTSPCam[1] INFO Processing [ChangeSmartMotionSettings] message
2024-02-09 23:39:36 2659c75680ef RTSPCam[1] INFO Processing [EnableLogging] message
2024-02-09 23:39:36 2659c75680ef RTSPCam[1] INFO Processing [ChangeDeviceSettings] message
2024-02-09 23:39:36 2659c75680ef RTSPCam[1] INFO Processing [ChangeDeviceSettings] message
2024-02-09 23:39:36 2659c75680ef RTSPCam[1] INFO Processing [SmartMotionTest] message
2024-02-09 23:39:36 2659c75680ef RTSPCam[1] INFO Processing [ChangeVideoSettings] message
2024-02-09 23:39:36 2659c75680ef RTSPCam[1] INFO Processing [AudioAgentChangeTuning] message
2024-02-09 23:39:36 2659c75680ef RTSPCam[1] INFO Processing [UpdateUsernamePassword] message
2024-02-09 23:39:36 2659c75680ef RTSPCam[1] INFO Processing [ChangeVideoSettings] message
2024-02-09 23:39:36 2659c75680ef RTSPCam[1] INFO Processing [ChangeAudioEventsSettings] message
2024-02-09 23:39:37 2659c75680ef RTSPCam[1] INFO Processing [ChangeVideoSettings] message
2024-02-09 23:39:39 2659c75680ef RTSPCam[1] INFO Processing [ChangeVideoSettings] message
ffmpeg version 5.1.3 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924
  configuration: --prefix=/usr --enable-avfilter --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libpulse --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-libdav1d --enable-lto --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --enable-librist --enable-libsrt --enable-libssh --enable-libvidstab --disable-stripping --disable-static --disable-librtmp --disable-lzma --enable-libaom --enable-libopus --enable-libsoxr --enable-libwebp --enable-vaapi --enable-vdpau --enable-vulkan --enable-libdrm --enable-libzmq --optflags=-O2 --disable-debug --enable-libsvtav1
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
2024-02-09 23:39:39 2659c75680ef RTSPCam[1] WARNING Previous ffmpeg process for video1 died.
2024-02-09 23:39:39 2659c75680ef RTSPCam[1] INFO Spawning ffmpeg for video1 (uICJ25U1DqEZn3O4): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://192.168.121.129:8554/driveway_high" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamName=uICJ25U1DqEZn3O4 -f flv - | /usr/local/bin/python -m unifi.clock_sync --write-timestamps | nc 192.168.100.1 7550
2024-02-09 23:39:39 2659c75680ef RTSPCam[1] INFO Processing [NetworkStatus] message
2024-02-09 23:39:39 2659c75680ef RTSPCam[1] INFO Processing [GetSystemStats] message
2024-02-09 23:39:39 2659c75680ef RTSPCam[1] INFO Processing [ChangeVideoSettings] message
ffmpeg version 5.1.3 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924
  configuration: --prefix=/usr --enable-avfilter --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libpulse --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-libdav1d --enable-lto --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --enable-librist --enable-libsrt --enable-libssh --enable-libvidstab --disable-stripping --disable-static --disable-librtmp --disable-lzma --enable-libaom --enable-libopus --enable-libsoxr --enable-libwebp --enable-vaapi --enable-vdpau --enable-vulkan --enable-libdrm --enable-libzmq --optflags=-O2 --disable-debug --enable-libsvtav1
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
2024-02-09 23:39:39 2659c75680ef RTSPCam[1] WARNING Previous ffmpeg process for video3 died.
2024-02-09 23:39:39 2659c75680ef RTSPCam[1] INFO Spawning ffmpeg for video3 (537NDxMuGJC99dxj): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://192.168.121.129:8554/driveway_high" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamName=537NDxMuGJC99dxj -f flv - | /usr/local/bin/python -m unifi.clock_sync --write-timestamps | nc 192.168.100.1 7550
2024-02-09 23:39:40 2659c75680ef RTSPCam[1] INFO Processing [GetRequest] message
2024-02-09 23:39:40 2659c75680ef RTSPCam[1] INFO Spawning stream for snapshots: ffmpeg -nostdin -y -re -rtsp_transport tcp -i "rtsp://192.168.121.129:8554/driveway_high" -r 1 -update 1 /tmp/tmpz7xnu6xi/screen.jpg
2024-02-09 23:39:40 2659c75680ef RTSPCam[1] WARNING Snapshot file /tmp/tmpz7xnu6xi/screen.jpg is not ready yet, skipping upload
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 <module>
    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
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    sys.stdout.buffer.write(data)
BrokenPipeError: [Errno 32] Broken pipe
    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 <module>
    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
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
johntdyer commented 4 months ago
image

screen recording -> https://capture.dropbox.com/Q9xUXriwlgVeccUX

dcigir commented 4 months ago

I have managed to add Reolink Camera also to Unifi Protect. The only problem is that Reolink 811 is h265, and you can't use main stream, as Unifi is not supporting it. You could only use sub stream. :) Does anybody know how to add this argument to Docker? If I try it I get command erro (--ffmpeg-args='-hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p')

simclancy commented 4 months ago

I have managed to add Reolink Camera also to Unifi Protect. The only problem is that Reolink 811 is h265, and you can't use main stream, as Unifi is not supporting it. You could only use sub stream. :)

Some reolink cameras if you lower to 2K resolution (or below) you can get a H264 stream, maybe try that.

dcigir commented 4 months ago

I have managed to add Reolink Camera also to Unifi Protect. The only problem is that Reolink 811 is h265, and you can't use main stream, as Unifi is not supporting it. You could only use sub stream. :)

Some reolink cameras if you lower to 2K resolution (or below) you can get a H264 stream, maybe try that.

I have Reolink 811a, and if I lower the resolution, then I'm missing part of the picture

johntdyer commented 4 months ago

Here is my ffprobe for my Duhau

root@debian:~# ffprobe -show_streams -timeout 5 "rtsp://admin:xxxxxxxxx@192.168.140.123:554/cam/realmonitor?channel=1&subtype=0"
ffprobe version 5.1.4-0+deb12u1 Copyright (c) 2007-2023 the FFmpeg developers
  built with gcc 12 (Debian 12.2.0-14)
  configuration: --prefix=/usr --extra-version=0+deb12u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[rtsp @ 0x5561dce63740] UDP timeout, retrying with TCP
[rtsp @ 0x5561dce63740] method SETUP failed: 461 Unsupported transport
[rtsp @ 0x5561dce63740] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, rtsp, from 'rtsp://admin:xxxxxxx@192.168.140.123:554/cam/realmonitor?channel=1&subtype=0':
  Metadata:
    title           : Media Server
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: h264, none, 90k tbr, 90k tbn
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=unknown
codec_type=video
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=0
height=0
coded_width=0
coded_height=0
closed_captions=0
film_grain=0
has_b_frames=0
sample_aspect_ratio=N/A
display_aspect_ratio=N/A
pix_fmt=unknown
level=-99
color_range=unknown
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=unspecified
field_order=unknown
refs=1
is_avc=false
nal_length_size=0
id=N/A
r_frame_rate=90000/1
avg_frame_rate=0/0
time_base=1/90000
start_pts=N/A
start_time=N/A
duration_ts=N/A
duration=N/A
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
extradata_size=36
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
DISPOSITION:captions=0
DISPOSITION:descriptions=0
DISPOSITION:metadata=0
DISPOSITION:dependent=0
DISPOSITION:still_image=0
[/STREAM]
root@debian:~#
stale[bot] commented 3 months 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.

mcaramb commented 3 months ago

bump

Hey man, any chance on getting back to this?

collse commented 2 months ago

I also get constantly the stream dying

unifi-camproxy-proxy-1-1  | 2024-04-15 12:38:18 6251903f2c62 FrigateCam[1] INFO Spawning ffmpeg for video3 (nwXtVC2dgiTIDIuw): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://a.b.c.d:8554/yi-dome211" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamName=nwXtVC2dgiTIDIuw -f flv - | /usr/local/bin/python -m unifi.clock_sync --write-timestamps | nc e.f.g.h 7550
unifi-camproxy-proxy-1-1  | Traceback (most recent call last):
unifi-camproxy-proxy-1-1  |   File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
unifi-camproxy-proxy-1-1  |     return _run_code(code, main_globals, None,
unifi-camproxy-proxy-1-1  |   File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
unifi-camproxy-proxy-1-1  |     exec(code, run_globals)
unifi-camproxy-proxy-1-1  |   File "/app/unifi/clock_sync.py", line 179, in <module>
unifi-camproxy-proxy-1-1  |     main(parse_args())
unifi-camproxy-proxy-1-1  |   File "/app/unifi/clock_sync.py", line 156, in main
unifi-camproxy-proxy-1-1  |     write(read_bytes(source, payload_size))
unifi-camproxy-proxy-1-1  |   File "/app/unifi/clock_sync.py", line 28, in write
unifi-camproxy-proxy-1-1  |     sys.stdout.buffer.write(data)
unifi-camproxy-proxy-1-1  | BrokenPipeError: [Errno 32] Broken pipe
unifi-camproxy-proxy-1-1  | Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
unifi-camproxy-proxy-1-1  | BrokenPipeError: [Errno 32] Broken pipe
unifi-camproxy-proxy-1-1  | av_interleaved_write_frame(): Broken pipe
unifi-camproxy-proxy-1-1  |     Last message repeated 2 times
unifi-camproxy-proxy-1-1  | Error writing trailer of pipe:: Broken pipe
unifi-camproxy-proxy-1-1  | Error closing file pipe:: Broken pipe
unifi-camproxy-proxy-2-1  | 2024-04-15 12:38:21 167510c482e8 FrigateCam[1] INFO Processing [GetRequest] message
unifi-camproxy-proxy-1-1  | 2024-04-15 12:38:22 6251903f2c62 FrigateCam[1] INFO Processing [NetworkStatus] message
unifi-camproxy-proxy-1-1  | 2024-04-15 12:38:22 6251903f2c62 FrigateCam[1] INFO Processing [GetSystemStats] message
unifi-camproxy-proxy-1-1  | 2024-04-15 12:38:23 6251903f2c62 FrigateCam[1] INFO Processing [ChangeVideoSettings] message
unifi-camproxy-proxy-1-1  | ffmpeg version 5.1.3 Copyright (c) 2000-2022 the FFmpeg developers
unifi-camproxy-proxy-1-1  |   built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924
unifi-camproxy-proxy-1-1  |   configuration: --prefix=/usr --enable-avfilter --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libpulse --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-libdav1d --enable-lto --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --enable-librist --enable-libsrt --enable-libssh --enable-libvidstab --disable-stripping --disable-static --disable-librtmp --disable-lzma --enable-libaom --enable-libopus --enable-libsoxr --enable-libwebp --enable-vaapi --enable-vdpau --enable-vulkan --enable-libdrm --enable-libzmq --optflags=-O2 --disable-debug --enable-libsvtav1
unifi-camproxy-proxy-1-1  |   libavutil      57. 28.100 / 57. 28.100
unifi-camproxy-proxy-1-1  |   libavcodec     59. 37.100 / 59. 37.100
unifi-camproxy-proxy-1-1  |   libavformat    59. 27.100 / 59. 27.100
unifi-camproxy-proxy-1-1  |   libavdevice    59.  7.100 / 59.  7.100
unifi-camproxy-proxy-1-1  |   libavfilter     8. 44.100 /  8. 44.100
unifi-camproxy-proxy-1-1  |   libswscale      6.  7.100 /  6.  7.100
unifi-camproxy-proxy-1-1  |   libswresample   4.  7.100 /  4.  7.100
unifi-camproxy-proxy-1-1  |   libpostproc    56.  6.100 / 56.  6.100
unifi-camproxy-proxy-1-1  | 2024-04-15 12:38:23 6251903f2c62 FrigateCam[1] WARNING Previous ffmpeg process for video1 died.
unifi-camproxy-proxy-1-1  | 2024-04-15 12:38:23 6251903f2c62 FrigateCam[1] INFO Spawning ffmpeg for video1 (Ob0wd1x49joRHC3W): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://a.b.c.d:8554/yi-dome211" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamName=Ob0wd1x49joRHC3W -f flv - | /usr/local/bin/python -m unifi.clock_sync --write-timestamps | nc e.f.g.h 7550

I am using unifi protect 3.0.26 though

another thing I did notice, even though I present --model 'UVC G3 Flex' protect names it "Unknown Device"

I have tried direct integrations with the rtsp stream as well as re-streamed from frigate both with the same result - streams work fine in VLC and IINA though

I did try the following container images: keshavdv/unifi-cam-proxy keshavdv/unifi-cam-proxy:dev gwndaan/unifi-cam-proxy:timestamp-modifier

getting the token however differs on I guess anything protect 3.x you need to access https://E.F.G.H/proxy/protect/api/cameras/manage-payload

ineichp commented 2 months ago

Hello everyone, I have a ReoLink Cam and tried using the Reolink parameter as well as a normal RSTP stream. There is always an error with the unifi.clock_sync.

Has anyone had any new insights?

mcaramb commented 2 months ago

Any ideas yet on what's causing this breaking in Protect 3.0.26? Has anyone gotten any kind of stream (frigate, rtsp, etc) to work? There seems to be alot of activity on other gitgub case branches to fix PTV, microphones, etc. so are those running in an earlier version?

simclancy commented 2 months ago

Any ideas yet on what's causing this breaking in Protect 3.0.26? Has anyone gotten any kind of stream (frigate, rtsp, etc) to work? There seems to be alot of activity on other gitgub case branches to fix PTV, microphones, etc. so are those running in an earlier version?

Still works for me, i also tried that other fork and it seems that it kinda fixes the out of sync recordings.

fwest57 commented 1 month ago

What version of Protect are you using simclancy? Also, is it Reolink Camera 811 the one you have the live stream and recording working on? I’m able to add a amcrest camera, but live stream and recording is not working.

simclancy commented 1 month ago

What version of Protect are you using simclancy? Also, is it Reolink Camera 811 the one you have the live stream and recording working on? I’m able to add a amcrest camera, but live stream and recording is not working.

Latest one, Reolink Duo 1st gen but through Frigate yea. So far so good, in fact i am using a different branch right now GwnDaan:timestamp-modifier from the PR, and that too works good, so far the out of sync issue seems to be better i havent checked all of the cams if they completely fixed the out of sync issue but it is certainly closer than before.

fwest57 commented 1 month ago

What version of Protect are you using simclancy? Also, is it Reolink Camera 811 the one you have the live stream and recording working on? I’m able to add a amcrest camera, but live stream and recording is not working.

Latest one, Reolink Duo 1st gen but through Frigate yea. So far so good, in fact i am using a different branch right now GwnDaan:timestamp-modifier from the PR, and that too works good, so far the out of sync issue seems to be better i havent checked all of the cams if they completely fixed the out of sync issue but it is certainly closer than before.

I got a Reolink 811 AI, what command line would you recommend me to try. I couldn't get the Amcrest camera to work

simclancy commented 1 month ago
go2rtc:
  rtsp:
    username: "XXXXX"
    password: "XXXXX"
  streams:
    Gate_Camera: 
      - "ffmpeg:http://192.168.0.70/flv?port=1935&app=bcs&stream=channel1_main.bcs&user=XXXX&password=XXXXX#video=copy#audio=copy#audio=opus"
    Gate_Camera_sub: 
      - "ffmpeg:Gate_Camera#video=h264#width=1280#height=720#audio=copy#raw=-fpsmax 10#hardware=vaapi"

  gate:
    restart: unless-stopped
    image: gwndaan/unifi-cam-proxy:timestamp-modifier
    volumes:
      - "/mnt/user/appdata/camproxy/client.pem:/client.pem"
    command: unifi-cam-proxy --host 192.168.0.1 --ip 192.168.0.221 --model "UVC G4 Bullet" --mac 'XXXX' --cert /client.pem --token XXXXX frigate -s "rtsp://XXXX@XXXX:8554/Gate_Camera?mp4" --mqtt-host "192.168.0.10" --mqtt-username "admin" --mqtt-password "XXXX" --frigate-camera Gate_Camera --snapshot-url "http://192.168.0.70/cgi-bin/api.cgi?cmd=Snap&channel=1&rs=roadcam&user=admin&password=k8xM4JPsuqNp"
Frigate's go2rtc to docker compose. 
fwest57 commented 1 month ago
go2rtc:
  rtsp:
    username: "XXXXX"
    password: "XXXXX"
  streams:
    Gate_Camera: 
      - "ffmpeg:http://192.168.0.70/flv?port=1935&app=bcs&stream=channel1_main.bcs&user=XXXX&password=XXXXX#video=copy#audio=copy#audio=opus"
    Gate_Camera_sub: 
      - "ffmpeg:Gate_Camera#video=h264#width=1280#height=720#audio=copy#raw=-fpsmax 10#hardware=vaapi"

  gate:
    restart: unless-stopped
    image: gwndaan/unifi-cam-proxy:timestamp-modifier
    volumes:
      - "/mnt/user/appdata/camproxy/client.pem:/client.pem"
    command: unifi-cam-proxy --host 192.168.0.1 --ip 192.168.0.221 --model "UVC G4 Bullet" --mac 'XXXX' --cert /client.pem --token XXXXX frigate -s "rtsp://XXXX@XXXX:8554/Gate_Camera?mp4" --mqtt-host "192.168.0.10" --mqtt-username "admin" --mqtt-password "XXXX" --frigate-camera Gate_Camera --snapshot-url "http://192.168.0.70/cgi-bin/api.cgi?cmd=Snap&channel=1&rs=roadcam&user=admin&password=k8xM4JPsuqNp"
Frigate's go2rtc to docker compose. 

Don’t have a mqtt server setup. I am going to try an setup one on my synology nas. I also see you are using a different unifi-cam-proxy image and volumes from what I have been using. Does it make a difference which one I use?

piejanssens commented 1 month ago

Same issue with Eufy Indoor 2K cam. Stream is 15fps H264 AVC in BT.709.

Update: the fork from @zacharee works with livestream in UniFi Protect! and is not showing broken pipe errors for me!

To make the change:

cd <location_of_your_existing_docker-compose.yml>
git clone https://github.com/zacharee/unifi-cam-proxy.git
vi docker-compose.yml
<replace line with 'install' with "build: ./unifi-cam-proxy">
sudo docker-compose up

@zacharee Is there a particular fix from your branch that you can share with us so we know what was the culprit for this problem in the orginal repo?

zacharee commented 1 month ago

I don't really know. Looking at the changes, it might be related to updating dependencies, but I didn't change any of the default command structures.

mcaramb commented 1 month ago

Same issue with Eufy Indoor 2K cam. Stream is 15fps H264 AVC in BT.709.

Update: the fork from @zacharee works with livestream in UniFi Protect! and is not showing broken pipe errors for me!

To make the change:

cd <location_of_your_existing_docker-compose.yml>
git clone https://github.com/zacharee/unifi-cam-proxy.git
vi docker-compose.yml
<replace line with 'install' with "build: ./unifi-cam-proxy">
sudo docker-compose up

@zacharee Is there a particular fix from your branch that you can share with us so we know what was the culprit for this problem in the orginal repo?

Oh wow! This sounds hopeful. Are you seeing this working for basic rtsp streams directly from cameras (ie: not through frigate)?

fwest57 commented 1 month ago

Same issue with Eufy Indoor 2K cam. Stream is 15fps H264 AVC in BT.709. Update: the fork from @zacharee works with livestream in UniFi Protect! and is not showing broken pipe errors for me! To make the change:

cd <location_of_your_existing_docker-compose.yml>
git clone https://github.com/zacharee/unifi-cam-proxy.git
vi docker-compose.yml
<replace line with 'install' with "build: ./unifi-cam-proxy">
sudo docker-compose up

@zacharee Is there a particular fix from your branch that you can share with us so we know what was the culprit for this problem in the orginal repo?

Oh wow! This sounds hopeful. Are you seeing this working for basic rtsp streams directly from cameras (ie: not through frigate)?

I guest it doesn't work on Docker under Synology Nas. I tried the commands in terminal, keep getting errors in my docker-compose directory. Then when I try to load the container I'm getting errors as well. exec: "git": executable file not found in $PATH

stale[bot] commented 6 days 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.