Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get broken pipe exceptio #344

Open
loungelizard2018 opened this issue Dec 2, 2023 · 66 comments
Open

Get broken pipe exceptio #344

loungelizard2018 opened this issue Dec 2, 2023 · 66 comments

Comments

@loungelizard2018
Copy link

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
Copy link

RepairsAlmostComplete commented Dec 11, 2023

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
Copy link

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
Copy link

Likewise with the above issue.

@tromanshow
Copy link

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
Copy link

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

@robertlynch3
Copy link

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
Copy link

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
Copy link
Author

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
Copy link

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
Copy link
Author

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
Copy link

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://[email protected]: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.

@loungelizard2018
Copy link
Author

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://[email protected]: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
Copy link

Ownezx commented Jan 12, 2024

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
Copy link

MyndPhreak commented Jan 13, 2024

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
Copy link

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
Copy link

mcaramb commented Jan 31, 2024

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
Copy link

dcigir commented Feb 1, 2024

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.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 --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
Copy link

mcaramb commented Feb 1, 2024

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.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 --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
Copy link

[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
Copy link

dcigir commented Feb 2, 2024

[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
Copy link

[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
Copy link

mcaramb commented Feb 2, 2024

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
Copy link

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
Copy link

mcaramb commented Feb 5, 2024

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
Copy link

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
Copy link

mcaramb commented Feb 7, 2024

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
Copy link

dcigir commented Feb 7, 2024

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
Copy link

dcigir commented Feb 8, 2024

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
Copy link

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

@simclancy
Copy link

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
Copy link

fwest57 commented May 16, 2024

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
Copy link

simclancy commented May 16, 2024

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
Copy link

fwest57 commented May 16, 2024

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
Copy link

piejanssens commented May 22, 2024

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
Copy link

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
Copy link

mcaramb commented May 23, 2024

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
Copy link

fwest57 commented May 26, 2024

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

Copy link

stale bot commented Jun 27, 2024

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.

@stale stale bot added the stale label Jun 27, 2024
@fwest57
Copy link

fwest57 commented Jun 28, 2024

Does the git clone https://github.com/zacharee/unifi-cam-proxy.git. I keep getting an error "unable to 'git clone' to temporary context directory: error fatching : fatal: couldn't find remote ref master: exit status 128.

@stale stale bot removed the stale label Jun 28, 2024
@chendo
Copy link

chendo commented Jul 10, 2024

The build line build: https://github.com/zacharee/unifi-cam-proxy.git#main

I can confirm that the broken pipe issue was resolved for me by using @zacharee's fork

@georgepauna
Copy link

Does the git clone https://github.com/zacharee/unifi-cam-proxy.git. I keep getting an error "unable to 'git clone' to temporary context directory: error fatching : fatal: couldn't find remote ref master: exit status 128.

Add #main to the end of the github URL:
https://github.com/zacharee/unifi-cam-proxy.git#main

@georgepauna
Copy link

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

It works on Synology NAS... sort of...

You need to install git server from package center.
Then you need to add #main at the end of the github URL in compose.yaml:
https://github.com/zacharee/unifi-cam-proxy.git#main

SO deploying works, but configuration is a different beast.
I had it working to the point Protect adopted the camera(s) and saw some static images, no video yet, but that's not synology's problem

@fwest57
Copy link

fwest57 commented Jul 25, 2024

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

It works on Synology NAS... sort of...

You need to install git server from package center. Then you need to add #main at the end of the github URL in compose.yaml: https://github.com/zacharee/unifi-cam-proxy.git#main

SO deploying works, but configuration is a different beast. I had it working to the point Protect adopted the camera(s) and saw some static images, no video yet, but that's not synology's problem

I was able to get it running under my Synology Nas with the Build command now. I'm using a Amcrest cam 4k with Frigate command line, but as you can see below. I keep getting the 404 error Not Found.

+] Running 1/1
⠿ Container clientpem-unifi-cam-proxy-1 Recreated 2.7s
Attaching to clientpem-unifi-cam-proxy-1
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:01 4576305c059b FrigateCam[1] INFO Spawning stream for snapshots: AV_LOG_FORCE_NOCOLOR=1 ffmpeg -loglevel level+error -nostdin -y -re -rtsp_transport tcp -i "rtsp://admin:[email protected]:554/videoSub" -r 1 -update 1 /tmp/tmpdnwucjzz/screen.jpg
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:01 4576305c059b Core[1] INFO Creating ws connection to wss://10.15.0.1:7442/camera/1.0/ws?token=WC3PSnZrLfomDDxtcF3JTs9aTxSsET2A
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:01 4576305c059b FrigateCam[1] INFO Adopting with token [WC3PSnZrLfomDDxtcF3JTs9aTxSsET2A] and mac [9c:8e:cd:3e:2d:0d]
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:01 4576305c059b FrigateCam[1] INFO Processing [ubnt_avclient_hello] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:02 4576305c059b FrigateCam[1] INFO Processing [ubnt_avclient_paramAgreement] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:02 4576305c059b FrigateCam[1] INFO Processing [StopService] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:02 4576305c059b FrigateCam[1] INFO Processing [ubnt_avclient_hello] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:02 4576305c059b FrigateCam[1] INFO Processing [ChangeDeviceSettings] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:02 4576305c059b FrigateCam[1] INFO Processing [ChangeVideoSettings] message
clientpem-unifi-cam-proxy-1 | ffmpeg version 5.1.4 Copyright (c) 2000-2023 the FFmpeg developers
clientpem-unifi-cam-proxy-1 | built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924
clientpem-unifi-cam-proxy-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
clientpem-unifi-cam-proxy-1 | libavutil 57. 28.100 / 57. 28.100
clientpem-unifi-cam-proxy-1 | libavcodec 59. 37.100 / 59. 37.100
clientpem-unifi-cam-proxy-1 | libavformat 59. 27.100 / 59. 27.100
clientpem-unifi-cam-proxy-1 | libavdevice 59. 7.100 / 59. 7.100
clientpem-unifi-cam-proxy-1 | libavfilter 8. 44.100 / 8. 44.100
clientpem-unifi-cam-proxy-1 | libswscale 6. 7.100 / 6. 7.100
clientpem-unifi-cam-proxy-1 | libswresample 4. 7.100 / 4. 7.100
clientpem-unifi-cam-proxy-1 | libpostproc 56. 6.100 / 56. 6.100
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:02 4576305c059b FrigateCam[1] INFO Spawning ffmpeg for video2 (ZjedmDvCBrMX8ZO4): AV_LOG_FORCE_NOCOLOR=1 ffmpeg -nostdin -loglevel level+error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://admin:[email protected]:554/videoSub" -c:v copy -vbsf "h264_metadata=tick_rate=2206/100:fixed_frame_rate_flag=1" -ar 32000 -ac 2 -codec:a aac -b:a 32k -metadata streamName=ZjedmDvCBrMX8ZO4 -f flv - | /usr/local/bin/python -m unifi.clock_sync --timestamp-modifier 90 | nc 10.15.10.1 7550
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:02 4576305c059b FrigateCam[1] INFO Processing [ChangeVideoSettings] message
clientpem-unifi-cam-proxy-1 | ffmpeg version 5.1.4 Copyright (c) 2000-2023 the FFmpeg developers
clientpem-unifi-cam-proxy-1 | built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924
clientpem-unifi-cam-proxy-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
clientpem-unifi-cam-proxy-1 | libavutil 57. 28.100 / 57. 28.100
clientpem-unifi-cam-proxy-1 | libavcodec 59. 37.100 / 59. 37.100
clientpem-unifi-cam-proxy-1 | libavformat 59. 27.100 / 59. 27.100
clientpem-unifi-cam-proxy-1 | libavdevice 59. 7.100 / 59. 7.100
clientpem-unifi-cam-proxy-1 | libavfilter 8. 44.100 / 8. 44.100
clientpem-unifi-cam-proxy-1 | libswscale 6. 7.100 / 6. 7.100
clientpem-unifi-cam-proxy-1 | libswresample 4. 7.100 / 4. 7.100
clientpem-unifi-cam-proxy-1 | libpostproc 56. 6.100 / 56. 6.100
clientpem-unifi-cam-proxy-1 | [rtsp @ 0x7ffbc616c100] [error] method OPTIONS failed: 404 Not Found
clientpem-unifi-cam-proxy-1 | [error] rtsp://admin:[email protected]:554/videoSub: Server returned 404 Not Found
clientpem-unifi-cam-proxy-1 | [rtsp @ 0x7f6706238100] [error] method OPTIONS failed: 404 Not Found
clientpem-unifi-cam-proxy-1 | [error] rtsp://admin:[email protected]:554/videoSub: Server returned 404 Not Found
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:02 4576305c059b FrigateCam[1] INFO Spawning ffmpeg for video3 (DzVJXNKS2bl1t7Kq): AV_LOG_FORCE_NOCOLOR=1 ffmpeg -nostdin -loglevel level+error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://admin:[email protected]:554/videoSub" -c:v copy -vbsf "h264_metadata=tick_rate=2206/100:fixed_frame_rate_flag=1" -ar 32000 -ac 2 -codec:a aac -b:a 32k -metadata streamName=DzVJXNKS2bl1t7Kq -f flv - | /usr/local/bin/python -m unifi.clock_sync --timestamp-modifier 90 | nc 10.15.10.1 7550
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:02 4576305c059b FrigateCam[1] INFO Processing [NetworkStatus] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:02 4576305c059b FrigateCam[1] INFO Processing [GetSystemStats] message
clientpem-unifi-cam-proxy-1 | [rtsp @ 0x7fa6e28e4100] [error] method OPTIONS failed: 404 Not Found
clientpem-unifi-cam-proxy-1 | [error] rtsp://admin:[email protected]:554/videoSub: Server returned 404 Not Found
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:02 4576305c059b FrigateCam[1] INFO Processing [ubnt_avclient_paramAgreement] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:05 4576305c059b FrigateCam[1] INFO Processing [ChangeVideoSettings] message
clientpem-unifi-cam-proxy-1 | ffmpeg version 5.1.4 Copyright (c) 2000-2023 the FFmpeg developers
clientpem-unifi-cam-proxy-1 | built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924
clientpem-unifi-cam-proxy-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
clientpem-unifi-cam-proxy-1 | libavutil 57. 28.100 / 57. 28.100
clientpem-unifi-cam-proxy-1 | libavcodec 59. 37.100 / 59. 37.100
clientpem-unifi-cam-proxy-1 | libavformat 59. 27.100 / 59. 27.100
clientpem-unifi-cam-proxy-1 | libavdevice 59. 7.100 / 59. 7.100
clientpem-unifi-cam-proxy-1 | libavfilter 8. 44.100 / 8. 44.100
clientpem-unifi-cam-proxy-1 | libswscale 6. 7.100 / 6. 7.100
clientpem-unifi-cam-proxy-1 | libswresample 4. 7.100 / 4. 7.100
clientpem-unifi-cam-proxy-1 | libpostproc 56. 6.100 / 56. 6.100
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:05 4576305c059b FrigateCam[1] INFO Spawning ffmpeg for video1 (PAIlKVXdzhtn8oDN): AV_LOG_FORCE_NOCOLOR=1 ffmpeg -nostdin -loglevel level+error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -timeout 15000000 -rtsp_transport tcp -i "rtsp://admin:[email protected]:554/videoSub" -c:v copy -vbsf "h264_metadata=tick_rate=2206/100:fixed_frame_rate_flag=1" -ar 32000 -ac 2 -codec:a aac -b:a 32k -metadata streamName=PAIlKVXdzhtn8oDN -f flv - | /usr/local/bin/python -m unifi.clock_sync --timestamp-modifier 90 | nc 10.15.10.1 7550
clientpem-unifi-cam-proxy-1 | [rtsp @ 0x7f32dc7e3100] [error] method OPTIONS failed: 404 Not Found
clientpem-unifi-cam-proxy-1 | [error] rtsp://admin:[email protected]:554/videoSub: Server returned 404 Not Found
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:07 4576305c059b FrigateCam[1] INFO Processing [ChangeIspSettings] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:07 4576305c059b FrigateCam[1] INFO Processing [ChangeOsdSettings] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:07 4576305c059b FrigateCam[1] INFO Processing [ChangeSoundLedSettings] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:07 4576305c059b FrigateCam[1] INFO Processing [ChangeVideoSettings] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:07 4576305c059b FrigateCam[1] INFO Processing [ChangeSmartMotionSettings] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:07 4576305c059b FrigateCam[1] INFO Processing [EnableLogging] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:07 4576305c059b FrigateCam[1] INFO Processing [ChangeDeviceSettings] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:07 4576305c059b FrigateCam[1] INFO Processing [ChangeDeviceSettings] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:07 4576305c059b FrigateCam[1] INFO Processing [SmartMotionTest] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:07 4576305c059b FrigateCam[1] INFO Processing [ChangeVideoSettings] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:07 4576305c059b FrigateCam[1] INFO Processing [AudioAgentChangeTuning] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:07 4576305c059b FrigateCam[1] INFO Processing [UpdateUsernamePassword] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:07 4576305c059b FrigateCam[1] INFO Processing [ChangeVideoSettings] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:07 4576305c059b FrigateCam[1] INFO Processing [ChangeSmartDetectSettings] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:07 4576305c059b FrigateCam[1] INFO Processing [NetworkStatus] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:07 4576305c059b FrigateCam[1] INFO Processing [GetSystemStats] message
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:11 4576305c059b FrigateCam[1] INFO Cleaning up instance
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:11 4576305c059b FrigateCam[1] INFO Stopping stream video2
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:11 4576305c059b FrigateCam[1] INFO Stopping stream video3
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:11 4576305c059b FrigateCam[1] INFO Stopping stream video1
clientpem-unifi-cam-proxy-1 | Traceback (most recent call last):
clientpem-unifi-cam-proxy-1 | File "/usr/local/bin/unifi-cam-proxy", line 8, in
clientpem-unifi-cam-proxy-1 | sys.exit(main())
clientpem-unifi-cam-proxy-1 | ^^^^^^
clientpem-unifi-cam-proxy-1 | File "/usr/local/lib/python3.11/site-packages/unifi/main.py", line 174, in main
clientpem-unifi-cam-proxy-1 | loop.run_until_complete(run())
clientpem-unifi-cam-proxy-1 | File "/usr/local/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
clientpem-unifi-cam-proxy-1 | return future.result()
clientpem-unifi-cam-proxy-1 | ^^^^^^^^^^^^^^^
clientpem-unifi-cam-proxy-1 | File "/usr/local/lib/python3.11/site-packages/unifi/main.py", line 169, in run
clientpem-unifi-cam-proxy-1 | await c.run()
clientpem-unifi-cam-proxy-1 | File "/usr/local/lib/python3.11/site-packages/unifi/core.py", line 81, in run
clientpem-unifi-cam-proxy-1 | await connect()
clientpem-unifi-cam-proxy-1 | File "/usr/local/lib/python3.11/site-packages/backoff/_async.py", line 76, in retry
clientpem-unifi-cam-proxy-1 | ret = await target(*args, **kwargs)
clientpem-unifi-cam-proxy-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
clientpem-unifi-cam-proxy-1 | File "/usr/local/lib/python3.11/site-packages/unifi/core.py", line 72, in connect
clientpem-unifi-cam-proxy-1 | await asyncio.gather(*tasks)
clientpem-unifi-cam-proxy-1 | File "/usr/local/lib/python3.11/site-packages/unifi/cams/frigate.py", line 91, in run
clientpem-unifi-cam-proxy-1 | await mqtt_connect()
clientpem-unifi-cam-proxy-1 | File "/usr/local/lib/python3.11/site-packages/backoff/_async.py", line 76, in retry
clientpem-unifi-cam-proxy-1 | ret = await target(*args, **kwargs)
clientpem-unifi-cam-proxy-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
clientpem-unifi-cam-proxy-1 | File "/usr/local/lib/python3.11/site-packages/unifi/cams/frigate.py", line 68, in mqtt_connect
clientpem-unifi-cam-proxy-1 | async with Client(
clientpem-unifi-cam-proxy-1 | File "/usr/local/lib/python3.11/site-packages/aiomqtt/client.py", line 714, in aenter
clientpem-unifi-cam-proxy-1 | await self._wait_for(self._connected, timeout=None)
clientpem-unifi-cam-proxy-1 | File "/usr/local/lib/python3.11/site-packages/aiomqtt/client.py", line 493, in _wait_for
clientpem-unifi-cam-proxy-1 | raise MqttError(msg) from None
clientpem-unifi-cam-proxy-1 | aiomqtt.exceptions.MqttError: Operation timed out
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:11 4576305c059b FrigateCam[1] INFO Stopping stream video2
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:11 4576305c059b FrigateCam[1] INFO Stopping stream video3
clientpem-unifi-cam-proxy-1 | 2024-07-25 14:57:11 4576305c059b FrigateCam[1] INFO Stopping stream video1
clientpem-unifi-cam-proxy-1 exited with code 1

@fwest57
Copy link

fwest57 commented Jul 25, 2024

Does anyone have this working with Frigate, and if so what type of camera are you using? Also, what is the command line you use to get it working please? Don't want to waste anymore time if no one have this work.

Copy link

stale bot commented Aug 30, 2024

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.

@stale stale bot added the stale label Aug 30, 2024
@piejanssens
Copy link

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.

nope

@goshku
Copy link

goshku commented Sep 1, 2024

Same crash.

@mcaramb
Copy link

mcaramb commented Sep 3, 2024

Yeah, this is still a problem even with the new Protect 4.1.53. Still getting broken pipe errors. still showing only a still when doing rtsp. I'm using docker and have tried both keshavdv:dev and the zacharee fork. For one brief moment of hope, when using keshavdv:dev I had it pointed to one camera, it did indeed start showing video, but after adding a second cam, both stopped and just show a still and lots of broken pipe errors. Going back to the single camera has since lost the ability and am back to getting broken pipe errors.

@jeitnier
Copy link

jeitnier commented Sep 4, 2024

Just wanted to report that I got my Reolink RLC-520A working using @zacharee's fork (off main branch. At the time of this writing there is no dev branch.)

Here is my working docker-compose.yml:

services:
  proxy1:
    restart: unless-stopped
    build: https://github.com/zacharee/unifi-cam-proxy.git
    volumes:
      - "./client.pem:/client.pem"
    command: >-
      unifi-cam-proxy
      --host 192.168.x.x
      --mac 'cc:71:aa:78:e0:54'
      --ip 192.168.x.x
      --cert /client.pem
      --token <token>
      reolink
      -u admin
      -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'

Getting snapshot and live video. Stream is choppy, but I have not tried all possible stream configurations yet. But having tried bare metal and docker using this repo, I could never get past the broken pipe.

@stale stale bot removed the stale label Sep 4, 2024
@iMot4k
Copy link

iMot4k commented Sep 8, 2024

Hi there! Just got my RLC-410W to work smoothly with the settings in the last post of @jeitnier (Using UNVR with Unifi OS 4.0.6).

It is in fact very choppy and not really in time with the default settings, but if you put "-s sub" instead of "-s main" and use the default settings for the sub stream (640*360 @ 7fps, 160 for the bitrate and "High" as the H.264 profile), it works very well and without any choppiness. If you don't need stellar quality and fps, it's a good and quick way to make it work.

By finding the right ffmpeg arguments I'm sure you could use the camera in high quality, but for now it works for me.

Note that if you change the resolution or fps, you'll get lots of "rtsp errors" in the console, and the video will likely not work at all. But I tested to launch the unifi-cam-proxy command with the default settings and THEN increasing the bitrate to the maximum (on sub stream it's 512) and it still works great. The rtsp stream doesn't need to reload so it just takes it without any problem, but note that if you kill your docker container and restart it, you'll need to put the camera back to 160, then wait until you have a smooth stream on Unifi and THEN put it to 512 again.

Other than that it works very well if you don't need the maximum quality of your cameras.

@tmushy
Copy link

tmushy commented Sep 8, 2024

So rumor is onvif support with be coming to unifi protect next month. We will be able to add third party cameras.

@jeitnier
Copy link

jeitnier commented Sep 8, 2024

Hi there! Just got my RLC-410W to work smoothly with the settings in the last post of @jeitnier (Using UNVR with Unifi OS 4.0.6).

It is in fact very choppy and not really in time with the default settings, but if you put "-s sub" instead of "-s main" and use the default settings for the sub stream (640*360 @ 7fps, 160 for the bitrate and "High" as the H.264 profile), it works very well and without any choppiness. If you don't need stellar quality and fps, it's a good and quick way to make it work.

By finding the right ffmpeg arguments I'm sure you could use the camera in high quality, but for now it works for me.

Note that if you change the resolution or fps, you'll get lots of "rtsp errors" in the console, and the video will likely not work at all. But I tested to launch the unifi-cam-proxy command with the default settings and THEN increasing the bitrate to the maximum (on sub stream it's 512) and it still works great. The rtsp stream doesn't need to reload so it just takes it without any problem, but note that if you kill your docker container and restart it, you'll need to put the camera back to 160, then wait until you have a smooth stream on Unifi and THEN put it to 512 again.

Other than that it works very well if you don't need the maximum quality of your cameras.

Yes after looking at the reolink specific docs closer I noticed I had the substream set to main and no main stream, so effectively setting these params solved my stream stability issues. Now getting smooth live stream, recording, etc.

reolink
      -u admin
      -p ********
      -m main
      -s sub

@tmushy yes saw that news on reddit the other day. I am not holding my breathe 🤣 but we shall see.

@zacharee
Copy link

Protect 5.0.20 (EA) has ONVIF support, although it's pretty buggy in the initial release: some Protect installs go into a restart loop when enabling it, it's not able to authenticate with cameras from Tapo and some from Reolink, and some adopted cameras randomly drop offline in the dashboard.

They're all known and acknowledged issues, and I think there's going to be another Protect release tomorrow to fix at least the restart loops. I've personally gotten a random Aliexpress IP camera working, and aside from an incorrect aspect ratio, streams and playback work smoothly.

@fwest57
Copy link

fwest57 commented Sep 14, 2024

Protect 5.0.20 (EA) has ONVIF support, although it's pretty buggy in the initial release: some Protect installs go into a restart loop when enabling it, it's not able to authenticate with cameras from Tapo and some from Reolink, and some adopted cameras randomly drop offline in the dashboard.

They're all known and acknowledged issues, and I think there's going to be another Protect release tomorrow to fix at least the restart loops. I've personally gotten a random Aliexpress IP camera working, and aside from an incorrect aspect ratio, streams and playback work smoothly.

Well, they have released Protect 5.0.21 now. I have 3 Amcrest cameras working on it now, but having found anyway to get notification working on them. The streams are working great and smooth on the 2 4k cameras, but 1 Ultra HD camera stream is choppy. The fps is set at 1, and there isn't anyway to change it. Hopefully all of those issues will get fixed in the stable release. Would like to here if the problems I'm have are just related to Amcrest camera only.

On the other hand, I was never able to get the Amcrest cameras working using unifi-cam-proxy. I could get them adopted, but no real stream of any kind. They work find on Frigate using Container Manager on my Synology Nas with a PCI TPU installed. When I would try to integrate the Amcrest cameras using frigate with unifi-cam-proxy. I never was able to get them to adopt into protect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests