keshavdv / unifi-cam-proxy

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

Tapo C100/C200 Any luck? #193

Closed AlexGreenUK closed 2 years ago

AlexGreenUK commented 2 years ago

I have managed to get it up and running and connected in Protect but all I have is a still image that updates every 5-10 seconds. If I try to view the live video I get nothing.

Any help?

Thanks

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

McSpitz commented 2 years ago

same problem at my installation. it shows a still picture of the cameras view only. no refresh.

the log says:

unifi-cam-proxy_1 | 2022-03-31 14:12:31 1ce11e771d5a RTSPCam[1] INFO Spawning ffmpeg for video3 (J2f5QZCwiOMgdSqg): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -stimeout 15000000 -rtsp_transport tcp -i "rtsp://admin:mysecret@192.68.78.2:554/stream1" -c:v copy -vbsf "h264_metadata=tick_rate=2206/100" -ar 32000 -ac 2 -codec:a aac -b:a 32k -metadata streamname=J2f5QZCSDFSSqg -f flv - | /usr/local/bin/python -m unifi.clock_sync | nc 192.68.78.34 7550 unifi-cam-proxy_1 | [rtsp @ 0x7fc21fb12580] method DESCRIBE failed: 406 Not Acceptable unifi-cam-proxy_1 | rtsp://admin:mysecret@192.68.78.2:554/stream1: Server returned 4XX Client Error, but not one of 40{0,1,3,4} unifi-cam-proxy_1 | 2022-03-31 14:12:31 1ce11e771d5a RTSPCam[1] INFO Processing [UpdateFirmwareRequest] message unifi-cam-proxy_1 | 2022-03-31 14:12:31 1ce11e771d5a RTSPCam[1] INFO Reconnecting... unifi-cam-proxy_1 | 2022-03-31 14:12:31 1ce11e771d5a RTSPCam[1] INFO Cleaning up instance unifi-cam-proxy_1 | 2022-03-31 14:12:31 1ce11e771d5a RTSPCam[1] INFO Stopping stream video2 unifi-cam-proxy_1 | 2022-03-31 14:12:31 1ce11e771d5a RTSPCam[1] INFO Stopping stream video1 unifi-cam-proxy_1 | 2022-03-31 14:12:31 1ce11e771d5a RTSPCam[1] INFO Stopping stream video3 unifi-cam-proxy_1 | 2022-03-31 14:12:31 1ce11e771d5a Core[1] INFO Backing off connect(...) for 2.0s (True) unifi-cam-proxy_1 | [rtsp @ 0x7fe87d4ae580] method DESCRIBE failed: 406 Not Acceptable

josepdomotica commented 2 years ago

Hi, i'm Tapo C200 user, this is my docker-compose.yaml

version: '3' services: unifi-cam-proxy: container_name: unifi-cam-proxy image: keshavdv/unifi-cam-proxy volumes:

Here logs: unifi-cam-proxy | 2022-04-22 15:48:53 8c3d6d68f763 RTSPCam[1] INFO Processing [NetworkStatus] message unifi-cam-proxy | 2022-04-22 15:48:53 8c3d6d68f763 RTSPCam[1] INFO Processing [ChangeVideoSettings] message unifi-cam-proxy | ffmpeg version 4.1.6 Copyright (c) 2000-2020 the FFmpeg developers unifi-cam-proxy | built with gcc 8.3.0 (Alpine 8.3.0) unifi-cam-proxy | 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 unifi-cam-proxy | libavutil 56. 22.100 / 56. 22.100 unifi-cam-proxy | libavcodec 58. 35.100 / 58. 35.100 unifi-cam-proxy | libavformat 58. 20.100 / 58. 20.100 unifi-cam-proxy | libavdevice 58. 5.100 / 58. 5.100 unifi-cam-proxy | libavfilter 7. 40.101 / 7. 40.101 unifi-cam-proxy | libavresample 4. 0. 0 / 4. 0. 0 unifi-cam-proxy | libswscale 5. 3.100 / 5. 3.100 unifi-cam-proxy | libswresample 3. 3.100 / 3. 3.100 unifi-cam-proxy | libpostproc 55. 3.100 / 55. 3.100 unifi-cam-proxy | 2022-04-22 15:48:53 8c3d6d68f763 RTSPCam[1] WARNING Previous ffmpeg process for video2 died. unifi-cam-proxy | 2022-04-22 15:48:53 8c3d6d68f763 RTSPCam[1] INFO Spawning ffmpeg for video2 (HqcqWYPiifP87i6F): ffmpeg -nostdin -loglevel error -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -stimeout 15000000 -rtsp_transport tcp -i "rtsp://tapoc200user:tapoc200password@192.168.1.16:554/stream1" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=HqcqWYPiifP87i6F -f flv - | /usr/local/bin/python -m unifi.clock_sync | nc 192.168.1.10 7550 unifi-cam-proxy | 2022-04-22 15:48:53 8c3d6d68f763 RTSPCam[1] INFO Processing [GetSystemStats] message unifi-cam-proxy | [rtsp @ 0x7fbe8a9a8580] method SETUP failed: 406 Not Acceptable unifi-cam-proxy | rtsp://tapoc200user:tapoc200password@192.168.1.16:554/stream1: Server returned 4XX Client Error, but not one of 40{0,1,3,4}

It works, 'G3 Micro' the camera appears, but all the time it stays frozen, it is clearly visible because it shows me the time and the seconds do not move, it is not that it works in jumps every X seconds, it only shows me the first frame directly.

During this week I will test the C310 that I have to see if it is a thing of the C200 model or if this happens in general with all the Tapo.

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

ChrisEngelhardt commented 2 years ago

same issue here, any updates?

jfromaniello commented 2 years ago

I have the same problem but I also found an easy way to reproduce it.

It seems this camera has a limitation of two connections per stream (not sure if from the same IP).

This is how you can reproduce the problem, I copy the ffmpeg call from the logs and then:

ffmpeg -nostdin \
  -loglevel error 
   -y -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -stimeout 15000000 -rtsp_transport tcp \
   -i "rtsp://<username>:<password>@<ip>/stream1" \
   -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k \
   -metadata streamname=4omYKk7yIX9VbUrh -f flv $(mktemp)

If you run this command and leave it running in different terminals, the third time you get:

method SETUP failed: 406 Not Acceptable

My python is rusty, but it might be related to this: https://github.com/keshavdv/unifi-cam-proxy/blob/main/unifi/cams/rtsp.py#L21-L24

jfromaniello commented 2 years ago

The problem is that this camera has only 2 streams and each stream support a max of 2 connections. If you don't pass snapshot_url the proxy will use the last url for snapshots, plus open an stream for video1, video2 and video3.

what you want to do is to provide 3 streams, the first two are the same, and the last one will get video3 and the snapshot.

Example:

$RSTP_BASE_URL=rtsp://<user>:<pass>@<camera-ip>

unifi-cam-proxy rstp <all other parameters> \
  -s $RSTP_BASE_URL/stream1 $RSTP_BASE_URL/stream1 $RSTP_BASE_URL/stream2
fraser-mendeco commented 2 years ago

The problem is that this camera has only 2 streams and each stream support a max of 2 connections. If you don't pass snapshot_url the proxy will use the last url for snapshots, plus open an stream for video1, video2 and video3.

  • if you only specify 1 stream, then all connections are made to the same stream and it fails because the limit
  • if you specify both streams, then the second stream gets thre connections: video1, video2, and video3 and it fails because the limit

what you want to do is to provide 3 streams, the first two are the same, and the last one will get video3 and the snapshot.

Example:

$RSTP_BASE_URL=rtsp://<user>:<pass>@<camera-ip>

unifi-cam-proxy rstp <all other parameters> \
  -s $RSTP_BASE_URL/stream1 $RSTP_BASE_URL/stream1 $RSTP_BASE_URL/stream2

Sorry, it's not clear - is this a solution that works now or a potential solution with a future update?