keshavdv / unifi-cam-proxy

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

Video won't rotate #360

Closed isd94techdir closed 2 months ago

isd94techdir commented 3 months ago

Camera

Avigilon 2.0C-H3A-DC1

Firmware version of the camera

3.28.0..86

Description

Camera was installed upside down and is difficult to reach. In the avigilon server we can rotate the video just fine, but using unifi-cam-proxy and Unifi Protect, the controls to rotate the video do not work in Protect. I've tried various ffmpeg arguments and none of them have resulted in rotating the camera view.

How to reproduce

Start unifi-cam-proxy in docker-compose: chs-old-gym-bridge: restart: unless-stopped build: https://docker.io/keshavdv/unifi-cam-proxy:latest volumes:

Expected behaviour

Video should be able to be rotated 180 degrees.

Screenshots

No response

Additional information

Here is the output from the docker container: Attaching to docker_chs-old-gym-bridge_1 chs-old-gym-bridge_1 | We renamed asyncio-mqtt to aiomqtt and released a version 1.0.0 in the process. This is the last release under the asyncio-mqtt name. You can find the new repository at https://github.com/sbtinstruments/aiomqtt chs-old-gym-bridge_1 | 2024-03-08 22:14:26 967d879ab2e6 RTSPCam[1] INFO Spawning stream for snapshots: ffmpeg -nostdin -y -re -rtsp_transport tcp -i "rtsp://admin:password@10.1.64.10/defaultPrimary?streamType=u" -r 1 -update 1 /tmp/tmp5wwpu62p/screen.jpg chs-old-gym-bridge_1 | 2024-03-08 22:14:26 967d879ab2e6 Core[1] INFO Creating ws connection to wss://10.1.64.30:7442/camera/1.0/ws?token=dbI8OrljcEbpYpIJtHy8hrXBQxSXXXXX chs-old-gym-bridge_1 | 2024-03-08 22:14:26 967d879ab2e6 RTSPCam[1] INFO Adopting with token [dbI8OrljcEbpYpIJtHy8hrXBQxSXXXXX] and mac [00:18:85:18:AB:2B] chs-old-gym-bridge_1 | 2024-03-08 22:14:26 967d879ab2e6 RTSPCam[1] INFO Processing [ubnt_avclient_hello] message chs-old-gym-bridge_1 | 2024-03-08 22:14:26 967d879ab2e6 RTSPCam[1] INFO Processing [ubnt_avclient_paramAgreement] message chs-old-gym-bridge_1 | 2024-03-08 22:14:26 967d879ab2e6 RTSPCam[1] INFO Processing [StopService] message chs-old-gym-bridge_1 | 2024-03-08 22:14:26 967d879ab2e6 RTSPCam[1] INFO Processing [ChangeVideoSettings] message chs-old-gym-bridge_1 | ffmpeg version 5.1.4 Copyright (c) 2000-2023 the FFmpeg developers chs-old-gym-bridge_1 | built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924 chs-old-gym-bridge_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 chs-old-gym-bridge_1 | libavutil 57. 28.100 / 57. 28.100 chs-old-gym-bridge_1 | libavcodec 59. 37.100 / 59. 37.100 chs-old-gym-bridge_1 | libavformat 59. 27.100 / 59. 27.100 chs-old-gym-bridge_1 | libavdevice 59. 7.100 / 59. 7.100 chs-old-gym-bridge_1 | libavfilter 8. 44.100 / 8. 44.100 chs-old-gym-bridge_1 | libswscale 6. 7.100 / 6. 7.100 chs-old-gym-bridge_1 | libswresample 4. 7.100 / 4. 7.100 chs-old-gym-bridge_1 | libpostproc 56. 6.100 / 56. 6.100 chs-old-gym-bridge_1 | 2024-03-08 22:14:27 967d879ab2e6 RTSPCam[1] INFO Spawning ffmpeg for video2 (Bp8yA6lyJhR3800c): 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://admin:password@10.1.64.10/defaultPrimary?streamType=u" -vf "transpose=2,transpose=2" -metadata:s:v rotate=0 -an -metadata streamName=Bp8yA6lyJhR3800c -f flv - | /usr/local/bin/python -m unifi.clock_sync --write-timestamps | nc 10.1.64.30 7550 chs-old-gym-bridge_1 | 2024-03-08 22:14:27 967d879ab2e6 RTSPCam[1] INFO Processing [ubnt_avclient_hello] message chs-old-gym-bridge_1 | 2024-03-08 22:14:27 967d879ab2e6 RTSPCam[1] INFO Processing [ChangeVideoSettings] message chs-old-gym-bridge_1 | ffmpeg version 5.1.4 Copyright (c) 2000-2023 the FFmpeg developers chs-old-gym-bridge_1 | built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924 chs-old-gym-bridge_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 chs-old-gym-bridge_1 | libavutil 57. 28.100 / 57. 28.100 chs-old-gym-bridge_1 | libavcodec 59. 37.100 / 59. 37.100 chs-old-gym-bridge_1 | libavformat 59. 27.100 / 59. 27.100 chs-old-gym-bridge_1 | libavdevice 59. 7.100 / 59. 7.100 chs-old-gym-bridge_1 | libavfilter 8. 44.100 / 8. 44.100 chs-old-gym-bridge_1 | libswscale 6. 7.100 / 6. 7.100 chs-old-gym-bridge_1 | libswresample 4. 7.100 / 4. 7.100 chs-old-gym-bridge_1 | libpostproc 56. 6.100 / 56. 6.100 chs-old-gym-bridge_1 | 2024-03-08 22:14:27 967d879ab2e6 RTSPCam[1] INFO Spawning ffmpeg for video3 (0WWvgsuyiUaQotBu): 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://admin:password@10.1.64.10/defaultPrimary?streamType=u" -vf "transpose=2,transpose=2" -metadata:s:v rotate=0 -an -metadata streamName=0WWvgsuyiUaQotBu -f flv - | /usr/local/bin/python -m unifi.clock_sync --write-timestamps | nc 10.1.64.30 7550 chs-old-gym-bridge_1 | 2024-03-08 22:14:27 967d879ab2e6 RTSPCam[1] INFO Processing [ubnt_avclient_paramAgreement] message chs-old-gym-bridge_1 | 2024-03-08 22:14:28 967d879ab2e6 RTSPCam[1] INFO Processing [ChangeDeviceSettings] message chs-old-gym-bridge_1 | 2024-03-08 22:14:28 967d879ab2e6 RTSPCam[1] INFO Processing [NetworkStatus] message chs-old-gym-bridge_1 | 2024-03-08 22:14:28 967d879ab2e6 RTSPCam[1] INFO Processing [GetSystemStats] message chs-old-gym-bridge_1 | 2024-03-08 22:14:29 967d879ab2e6 RTSPCam[1] INFO Processing [UpdateFirmwareRequest] message chs-old-gym-bridge_1 | 2024-03-08 22:14:29 967d879ab2e6 RTSPCam[1] INFO Reconnecting... chs-old-gym-bridge_1 | 2024-03-08 22:14:29 967d879ab2e6 RTSPCam[1] INFO Cleaning up instance chs-old-gym-bridge_1 | 2024-03-08 22:14:29 967d879ab2e6 RTSPCam[1] INFO Stopping stream video2 chs-old-gym-bridge_1 | 2024-03-08 22:14:29 967d879ab2e6 RTSPCam[1] INFO Stopping stream video3 chs-old-gym-bridge_1 | 2024-03-08 22:14:29 967d879ab2e6 Core[1] INFO Backing off connect(...) for 2.0s (True) chs-old-gym-bridge_1 | 2024-03-08 22:14:31 967d879ab2e6 Core[1] INFO Creating ws connection to wss://10.1.64.30:7442/camera/1.0/ws?token=dbI8OrljcEbpYpIJtHy8hrXBQxSXXXXX chs-old-gym-bridge_1 | 2024-03-08 22:14:31 967d879ab2e6 RTSPCam[1] INFO Adopting with token [dbI8OrljcEbpYpIJtHy8hrXBQxSXXXXX] and mac [00:18:85:18:AB:2B] chs-old-gym-bridge_1 | 2024-03-08 22:14:31 967d879ab2e6 RTSPCam[1] INFO Processing [ubnt_avclient_hello] message chs-old-gym-bridge_1 | 2024-03-08 22:14:31 967d879ab2e6 RTSPCam[1] INFO Processing [ubnt_avclient_paramAgreement] message chs-old-gym-bridge_1 | 2024-03-08 22:14:32 967d879ab2e6 RTSPCam[1] INFO Processing [StopService] message chs-old-gym-bridge_1 | 2024-03-08 22:14:32 967d879ab2e6 RTSPCam[1] INFO Processing [ubnt_avclient_hello] message chs-old-gym-bridge_1 | 2024-03-08 22:14:32 967d879ab2e6 RTSPCam[1] INFO Processing [ChangeVideoSettings] message chs-old-gym-bridge_1 | 2024-03-08 22:14:32 967d879ab2e6 RTSPCam[1] INFO Processing [ChangeDeviceSettings] message chs-old-gym-bridge_1 | 2024-03-08 22:14:32 967d879ab2e6 RTSPCam[1] INFO Processing [NetworkStatus] message chs-old-gym-bridge_1 | 2024-03-08 22:14:32 967d879ab2e6 RTSPCam[1] INFO Processing [GetSystemStats] message chs-old-gym-bridge_1 | 2024-03-08 22:14:32 967d879ab2e6 RTSPCam[1] INFO Processing [ubnt_avclient_paramAgreement] message chs-old-gym-bridge_1 | 2024-03-08 22:14:37 967d879ab2e6 RTSPCam[1] INFO Processing [ChangeIspSettings] message chs-old-gym-bridge_1 | 2024-03-08 22:14:37 967d879ab2e6 RTSPCam[1] INFO Processing [ChangeOsdSettings] message chs-old-gym-bridge_1 | 2024-03-08 22:14:37 967d879ab2e6 RTSPCam[1] INFO Processing [ChangeAudioEventsSettings] message chs-old-gym-bridge_1 | 2024-03-08 22:14:37 967d879ab2e6 RTSPCam[1] INFO Processing [ChangeSoundLedSettings] message chs-old-gym-bridge_1 | 2024-03-08 22:14:37 967d879ab2e6 RTSPCam[1] INFO Processing [ChangeVideoSettings] message chs-old-gym-bridge_1 | 2024-03-08 22:14:37 967d879ab2e6 RTSPCam[1] INFO Processing [ChangeSmartMotionSettings] message chs-old-gym-bridge_1 | 2024-03-08 22:14:37 967d879ab2e6 RTSPCam[1] INFO Processing [EnableLogging] message chs-old-gym-bridge_1 | 2024-03-08 22:14:37 967d879ab2e6 RTSPCam[1] INFO Processing [ChangeDeviceSettings] message chs-old-gym-bridge_1 | 2024-03-08 22:14:37 967d879ab2e6 RTSPCam[1] INFO Processing [ChangeDeviceSettings] message chs-old-gym-bridge_1 | 2024-03-08 22:14:37 967d879ab2e6 RTSPCam[1] INFO Processing [SmartMotionTest] message chs-old-gym-bridge_1 | 2024-03-08 22:14:37 967d879ab2e6 RTSPCam[1] INFO Processing [ChangeVideoSettings] message chs-old-gym-bridge_1 | 2024-03-08 22:14:37 967d879ab2e6 RTSPCam[1] INFO Processing [UpdateUsernamePassword] message chs-old-gym-bridge_1 | 2024-03-08 22:14:37 967d879ab2e6 RTSPCam[1] INFO Processing [ChangeVideoSettings] message chs-old-gym-bridge_1 | 2024-03-08 22:14:39 967d879ab2e6 RTSPCam[1] INFO Processing [NetworkStatus] message chs-old-gym-bridge_1 | 2024-03-08 22:14:39 967d879ab2e6 RTSPCam[1] INFO Processing [GetSystemStats] message chs-old-gym-bridge_1 | 2024-03-08 22:14:46 967d879ab2e6 RTSPCam[1] INFO Processing [ChangeVideoSettings] message chs-old-gym-bridge_1 | ffmpeg version 5.1.4 Copyright (c) 2000-2023 the FFmpeg developers chs-old-gym-bridge_1 | built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924 chs-old-gym-bridge_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 chs-old-gym-bridge_1 | libavutil 57. 28.100 / 57. 28.100 chs-old-gym-bridge_1 | libavcodec 59. 37.100 / 59. 37.100 chs-old-gym-bridge_1 | libavformat 59. 27.100 / 59. 27.100 chs-old-gym-bridge_1 | libavdevice 59. 7.100 / 59. 7.100 chs-old-gym-bridge_1 | libavfilter 8. 44.100 / 8. 44.100 chs-old-gym-bridge_1 | libswscale 6. 7.100 / 6. 7.100 chs-old-gym-bridge_1 | libswresample 4. 7.100 / 4. 7.100 chs-old-gym-bridge_1 | libpostproc 56. 6.100 / 56. 6.100 chs-old-gym-bridge_1 | 2024-03-08 22:14:46 967d879ab2e6 RTSPCam[1] INFO Spawning ffmpeg for video1 (pc1Skw548lCXOusn): 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://admin:password@10.1.64.10/defaultPrimary?streamType=u" -vf "transpose=2,transpose=2" -metadata:s:v rotate=0 -an -metadata streamName=pc1Skw548lCXOusn -f flv - | /usr/local/bin/python -m unifi.clock_sync --write-timestamps | nc 10.1.64.30 7550 chs-old-gym-bridge_1 | 2024-03-08 22:14:49 967d879ab2e6 RTSPCam[1] INFO Processing [NetworkStatus] message chs-old-gym-bridge_1 | 2024-03-08 22:14:49 967d879ab2e6 RTSPCam[1] INFO Processing [GetSystemStats] message chs-old-gym-bridge_1 | 2024-03-08 22:14:59 967d879ab2e6 RTSPCam[1] INFO Processing [NetworkStatus] message chs-old-gym-bridge_1 | 2024-03-08 22:14:59 967d879ab2e6 RTSPCam[1] INFO Processing [GetSystemStats] message chs-old-gym-bridge_1 | 2024-03-08 22:15:09 967d879ab2e6 RTSPCam[1] INFO Processing [NetworkStatus] message chs-old-gym-bridge_1 | 2024-03-08 22:15:09 967d879ab2e6 RTSPCam[1] INFO Processing [GetSystemStats] message chs-old-gym-bridge_1 | 2024-03-08 22:15:19 967d879ab2e6 RTSPCam[1] INFO Processing [NetworkStatus] message chs-old-gym-bridge_1 | 2024-03-08 22:15:19 967d879ab2e6 RTSPCam[1] INFO Processing [GetRequest] message chs-old-gym-bridge_1 | 2024-03-08 22:15:19 967d879ab2e6 RTSPCam[1] INFO Spawning stream for snapshots: ffmpeg -nostdin -y -re -rtsp_transport tcp -i "rtsp://admin:password@10.1.64.10/defaultPrimary?streamType=u" -r 1 -update 1 /tmp/tmp5wwpu62p/screen.jpg chs-old-gym-bridge_1 | 2024-03-08 22:15:19 967d879ab2e6 RTSPCam[1] INFO Processing [GetSystemStats] message chs-old-gym-bridge_1 | 2024-03-08 22:15:29 967d879ab2e6 RTSPCam[1] INFO Processing [NetworkStatus] message chs-old-gym-bridge_1 | 2024-03-08 22:15:29 967d879ab2e6 RTSPCam[1] INFO Processing [GetSystemStats] message chs-old-gym-bridge_1 | 2024-03-08 22:15:39 967d879ab2e6 RTSPCam[1] INFO Processing [NetworkStatus] message chs-old-gym-bridge_1 | 2024-03-08 22:15:39 967d879ab2e6 RTSPCam[1] INFO Processing [GetSystemStats] message

In protect it will show the 1 screenshot that gets generated and then we just have the 3 flashing dots in the lower lefthand corner, but the live video never is displayed. I've tried setting the camera to constantly record and nothing gets recorded. I have been able to get Frigate to rotate the video, but I have tons of cameras I want to get into Protect (I'm eventually going to replace all of them) so running frigate isn't practical. I've tried multiple ways to flip the video but none of them have worked (hflip,vflip and rotate=PI). If I run the container without the ffmpeg args, it works as expected but the video feed is upside down. In the ffmpeg args I had to include -an to get rid of the audio because it kept throwing errors that the audio stream is the incorrect format even though the camera doesn't have audio.

stale[bot] commented 2 months ago

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