keshavdv / unifi-cam-proxy

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

Hikvision wont record/stream #361

Closed kelzen01 closed 5 months ago

kelzen01 commented 8 months ago

UniFi OS 3.2.12 Protect 2.11.21

Camera

DS-2CD2186G2-I

Firmware version of the camera

V5.7.14 build 231213

Description

RTSP Stream won't strat recording or streaming. Tried all kind of videosettings (1920x1080 etc). UNIFI Protect sees the camera and i can see the thumbnail , but keeps buffering (three dots in the left down corner.

How to reproduce

No response

Expected behaviour

keeps buffering, no livestream or recording.

Screenshots

No response

Additional information

version: "3.9" services: unifi-cam-proxy: restart: unless-stopped image: keshavdv/unifi-cam-proxy:dev volumes:

Ampsyy commented 8 months ago

Also having the same issue, have also tried using the Hikvision command mentioned in the docs as well as the RTSP stream: unifi-cam-proxy -H {NVR IP} -i {camera IP} -c /client.pem -t {Adoption token} hikvision -u {username} -p {password}

But get Output file #0 does not contain any stream

kms254 commented 8 months ago

I am/was running into the same issue. I made a bit of progress reading through the logs and playing with VLC and I have this command working in my docker compose file.

command: unifi-cam-proxy --host {NVR_HOST} --cert /client.pem --token {TOKEN} -i {CAMERA_IP} --model 'UVC G5 Pro' hikvision -u {USERNAME} -p {PASSWORD}--channel 1 --substream 1

I also had to make a very slight code modification by removing the training / on this line. https://github.com/keshavdv/unifi-cam-proxy/blob/main/unifi/cams/hikvision.py#L112

I built the docker container locally and updated the compose file to use the locally built docker container

gizze59 commented 7 months ago

Live stream start working locally, if I activate "Share livestream with link" under Settings for proxy-cam in Unify console. It's not an solution, just an observation

jannes-kruger commented 7 months ago

Same problem looks to be related to the Broken Pipe issue logged in some other places as well. Has anyone been able to ger around this?

2024-04-23 08:09:28 2024-04-23 06:09:28 dff63ffeca9d RTSPCam[1] INFO Spawning ffmpeg for video2 (P1Wmc9RH3BvZdxlx): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -stimeout 15000000 -rtsp_transport tcp -i "rtsp://xxxx:xxxxxx@172.16.18.22:554/Streaming/Channels/101/" -c:v copy -vbsf "h264_metadata=tick_rate=40:fixed_frame_rate_flag=1" -ar 32000 -ac 2 -codec:a aac -b:a 32k -metadata streamname=P1Wmc9RH3BvZdxlx -f flv - | /usr/local/bin/python -m unifi.clock_sync | nc 172.16.18.2 7550 2024-04-23 08:09:29 Traceback (most recent call last): 2024-04-23 08:09:29 File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main 2024-04-23 08:09:29 return _run_code(code, main_globals, None, 2024-04-23 08:09:29 File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code 2024-04-23 08:09:29 exec(code, run_globals) 2024-04-23 08:09:29 File "/app/unifi/clock_sync.py", line 167, in 2024-04-23 08:09:29 main() 2024-04-23 08:09:29 File "/app/unifi/clock_sync.py", line 157, in main 2024-04-23 08:09:29 write(read_bytes(source, payload_size)) 2024-04-23 08:09:29 File "/app/unifi/clock_sync.py", line 87, in write 2024-04-23 08:09:29 sys.stdout.buffer.write(data) 2024-04-23 08:09:29 BrokenPipeError: [Errno 32] Broken pipe 2024-04-23 08:09:29 Exception ignored in: <_io.TextIOWrapper name='' mode='w' encoding='utf-8'> 2024-04-23 08:09:29 BrokenPipeError: [Errno 32] Broken pipe 2024-04-23 08:09:29 av_interleaved_write_frame(): Broken pipe 2024-04-23 08:09:29 Error writing trailer of pipe:: Broken pipe 2024-04-23 08:09:33 2024-04-23 06:09:33 dff63ffeca9d RTSPCam[1] INFO Processing [NetworkStatus] message 2024-04-23 08:09:33 2024-04-23 06:09:33 dff63ffeca9d RTSPCam[1] INFO Processing [GetSystemStats] message 2024-04-23 08:09:43 2024-04-23 06:09:43 dff63ffeca9d RTSPCam[1] INFO Processing [NetworkStatus] message 2024-04-23 08:09:43 2024-04-23 06:09:43 dff63ffeca9d RTSPCam[1] INFO Processing [GetSystemStats] message 2024-04-23 08:09:53 2024-04-23 06:09:53 dff63ffeca9d RTSPCam[1] INFO Processing [ChangeVideoSettings] message 2024-04-23 08:09:53 ffmpeg version 4.1.6 Copyright (c) 2000-2020 the FFmpeg developers

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