Samfox2 / homebridge-videodoorbell

Video-Doorbell plugin based on homebridge-camera-ffmpeg for Homebridge.
Apache License 2.0
97 stars 17 forks source link

Snapshots work on any iOS or WatchOS device, live stream only on Watch #22

Closed MichelRabozee closed 5 years ago

MichelRabozee commented 6 years ago

Hello !

In the Apple Home apps on iOS and Apple Watch I correctly receive notifications and snapshots.

But the live streaming won't start on iPhone or iPad in the Home app when I tap the still image, I receive a "camera not answering"; the feed starts only when triggered from Apple Watch.

I can therefore safely say that the specified source (a http streamer producing mjpegs) works, as well as ffmpeg install.

So I look into the log, and there, the "Start streaming/Stop streaming events only fire up when I use Apple Watch to look at the live feed. No Start/Stop event are generated when I use the Home app on iPhone or iPad.

I already tried recreating another "camera" instance for the video doorbell (with a different name), added it to HomeKit, but behaviour stays the same: no live feed triggered from iOS, only from WatchOS.

For information, I have other cameras (under the camera-ffmpeg plugin) and those are correctly live fed from iOS as well.

I looked at the code of index.je and ffmpeg.js for both plugins, and see no reason it does behave differently in video doorbell with iOS or WatchOS.

Does anybody have any suggestions to resolve that issue? It is really confusing...

my config:

  "platform": "Video-doorbell",
  "cameras": [
    {
      "name": "Visiophone",
      "port": 5005,
      "videoConfig": {
        "debug": true,
        "source": "-re -i http://192.168.1.101:8001/",
        "stillImageSource": "-i http://192.168.1.101:6183/jpg/image.jpg",
        "maxStreams": 5,
        "maxWidth": 320,
        "maxHeight": 240,
        "maxFPS": 10
      }
    }

and the log when I trigger the live feed from the watch:

[2018-8-13 16:43:10] [Video-doorbell] Start streaming video from Visiophone with 320x240@68kBit ffmpeg -re -i http://192.168.1.101:8001/ -map 0:0 -vcodec libx264 -pix_fmt yuv420p -r 10 -f rawvideo -tune zerolatency -vf scale=320:240 -b:v 68k -bufsize 68k -maxrate 68k -payload_type 99 -ssrc 10304847 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params vQ37oVBFJEhXNRGIn6jcPiWx+s+SJTlqKD4jKzlq srtp://192.168.1.38:50754?rtcpport=50754&localrtcpport=50754&pkt_size=1316 [2018-8-13 16:43:10] [Video-doorbell] Snapshot from Visiophone at 320x240 ffmpeg -i http://192.168.1.101:6183/jpg/image.jpg -t 1 -s 320x240 -f image2 - [2018-8-13 16:43:22] [Video-doorbell] Stopped streaming

(of course, no log when triggered from iOS)

Thank you, Michel

MichelRabozee commented 5 years ago

Hi, I am still stuck here. How is it possible that the stream works when activated from the Apple Watch, and does not work when activated from any other iOS device ? As I wrote above, in the logs, it is like only the Apple Watch triggers the "Start streaming video". The log does not have entries like that when I use the iPhone or the iPad for triggering the streaming.

Samfox2 commented 5 years ago

I think your watch triggeres a low resolution stream which is working fine while the other devices trigger higher resolution streams. Looks like a problem with your network bandwidth.

MichelRabozee commented 5 years ago

But I should see the "Start streaming video" in the logs, no ? How can the watch request something different from the iOS devices with respect to your plugin regarding streaming ? BTW, I am pretty sure I have no network issue. The stream I have from the videophone is really simple: 1 frame per second: http://corniche.rabozee.net:8001

From the watch, I get in the log: [2018-9-14 21:09:56] [Video-doorbell] Snapshot from Visiophone at 320x240 ffmpeg -i http://corniche.rabozee.net:6183/jpg/image.jpg -t 1 -s 320x240 -f image2 - [2018-9-14 21:10:12] [Video-doorbell] Start streaming video from Visiophone with 320x240@68kBit ffmpeg -re -i http://corniche.rabozee.net:8001/ -map 0:0 -vcodec libx264 -pix_fmt yuv420p -r 10 -f rawvideo -tune zerolatency -vf scale=320:240 -b:v 68k -bufsize 68k -maxrate 68k -payload_type 99 -ssrc 7756707 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params F+7O/TETWS1mLnPKY+h5YuFbMFDRYR2p32GYftgL srtp://192.168.1.155:60075?rtcpport=60075&localrtcpport=60075&pkt_size=1316

From other iOS devices, I got nothing but: [2018-9-14 21:11:30] [Video-doorbell] Snapshot from Visiophone at 320x240 ffmpeg -i http://corniche.rabozee.net:6183/jpg/image.jpg -t 1 -s 320x240 -f image2 -

MichelRabozee commented 5 years ago

It seems it is really an issue with triggering of the Streaming from iOS; even if I put as source for the videophone a rtsp stream for another camera ("-re -i rtsp://admin:xxx@192.168.1.240:80/videoMain") which works with the Camera-ffmpeg plugin (both from the Watch and the iOS devices), it does not start the stream in iOS.

MichelRabozee commented 5 years ago

OK, I created a Camera-ffmpeg with the same URLs, and the stream starts. Rebooted everything in sequence (Apple TV, iPhone, iPad, ...) and now both the videodoorbell accessory and the Camera-ffmpeg accessory for that videophone work (both snapshot and streaming) on Apple Watch, iPhone, iPad... Go figure... Anyway, issue closed for me !

Samfox2 commented 5 years ago

Great to hear that it’s working now!