dgreif / ring

Unofficial packages for Ring Doorbells, Cameras, Alarm System, and Smart Lighting
MIT License
1.23k stars 162 forks source link

[Streaming]: Streaming works locally but not using external network or LTE/5G #1127

Closed sa3eedo12 closed 1 year ago

sa3eedo12 commented 1 year ago

Streaming Issue

This issue has been driving me crazy, my HomeBridge instance is deployed on a Synology NAS which is connected to the same network as my AppleTV 4K. I don't have any vLANs or subnets, I have UPNP enabled, ALG disabled entirely, no firewall on the NAS or on the router.

I've tried restarting the Apple TV, HomeBridge, my devices, and the router but unfortunately this hasn't solved anything.

Proposed Solution

I could be wrong, but based on the logs it appears that the stream size is too large for remote streaming. Perhaps adding a way to reduce the bitrate might resolve the issue.

Environment

Homebridge

What operating system are you on?

Linux

Relevant log output

[12/21/2022, 10:25:19 PM] [Homebridge UI] Homebridge log truncated by admin.
[12/21/2022, 10:25:24 PM] [Ring] Preparing Live Stream for Front Door
[12/21/2022, 10:25:25 PM] [Ring] From Ring (Front Door): stopped gracefully
[12/21/2022, 10:25:25 PM] [Ring] From Ring (Front Door): pipe:: Operation timed out

[12/21/2022, 10:25:25 PM] [Ring] From Ring (Front Door): size=       2kB time=00:00:00.83 bitrate=  24.1kbits/s speed=0.0772x    
video:0kB audio:2kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 26.977688%

[12/21/2022, 10:25:25 PM] [Ring] From Ring (Front Door): Exiting normally, received signal 15.

[12/21/2022, 10:25:25 PM] [Ring] Stream Prepared for Front Door (0.977s)
[12/21/2022, 10:25:25 PM] [Ring] WebSocket connected for Front Door
[12/21/2022, 10:25:26 PM] [Ring] iceConnectionStateChange: completed
[12/21/2022, 10:25:26 PM] [Ring] connectionStateChange: connecting
[12/21/2022, 10:25:26 PM] [Ring] iceConnectionStateChange: new
[12/21/2022, 10:25:26 PM] [Ring] iceConnectionStateChange: checking
[12/21/2022, 10:25:26 PM] [Ring] Activating Session
[12/21/2022, 10:25:26 PM] [Ring] iceConnectionStateChange: new
[12/21/2022, 10:25:26 PM] [Ring] iceConnectionStateChange: connected
[12/21/2022, 10:25:27 PM] [Ring] connectionStateChange: connected
[12/21/2022, 10:25:27 PM] [Ring] received first video packet
[12/21/2022, 10:25:27 PM] [Ring] received first audio packet
[12/21/2022, 10:25:28 PM] [Ring] Activating stream for Front Door (3.672s)
[12/21/2022, 10:25:28 PM] [Ring] Streaming active for Front Door (3.694s)
[12/21/2022, 10:25:28 PM] [Ring] Received stream data from Front Door (3.696s)
[12/21/2022, 10:25:28 PM] [Ring] From Ring (Front Door): Input #0, sdp, from 'pipe:':
  Duration: N/A, start: 0.000000, bitrate: N/A

[12/21/2022, 10:25:28 PM] [Ring] From Ring (Front Door):   Stream #0:0: Audio: opus, 48000 Hz, stereo, s16

[12/21/2022, 10:25:28 PM] [Ring] From Ring (Front Door): Stream mapping:
  Stream #0:0 -> #0:0 (opus (libopus) -> opus (libopus))

[12/21/2022, 10:25:28 PM] [Ring] From Ring (Front Door): Output #0, rtp, to 'rtp://127.0.0.1:38673?pkt_size=188':
  Metadata:
    encoder         : Lavf59.16.100

[12/21/2022, 10:25:28 PM] [Ring] From Ring (Front Door):   Stream #0:0: Audio: opus, 24000 Hz, mono, s16, 24 kb/s
    Metadata:
      encoder         : Lavc59.18.100 libopus
size=       0kB time=00:00:00.00 bitrate=N/A speed=N/A    
[12/21/2022, 10:25:29 PM] [Ring] From Ring (Front Door): size=       2kB time=00:00:00.65 bitrate=  21.5kbits/s speed=1.18x    
[12/21/2022, 10:25:29 PM] [Ring] From Ring (Front Door): size=       3kB time=00:00:01.19 bitrate=  20.9kbits/s speed=1.07x    
[12/21/2022, 10:25:30 PM] [Ring] From Ring (Front Door): size=       4kB time=00:00:01.73 bitrate=  20.7kbits/s speed=1.03x    
[12/21/2022, 10:25:30 PM] [Ring] From Ring (Front Door): [rtp @ 0x555ae77623c0] Packet size 191 too large for max RTP payload size 176
av_interleaved_write_frame(): Invalid argument

[12/21/2022, 10:25:30 PM] [Ring] From Ring (Front Door): size=       5kB time=00:00:02.03 bitrate=  20.0kbits/s speed=1.02x    
video:0kB audio:5kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.800165%

[12/21/2022, 10:25:30 PM] [Ring] From Ring (Front Door): Conversion failed!

[12/21/2022, 10:25:30 PM] [Ring] connectionStateChange: closed
[12/21/2022, 10:25:30 PM] [Ring] From Ring (Front Door): exited with code 1 and signal null
[12/21/2022, 10:25:30 PM] [Ring] iceConnectionStateChange: closed
[12/21/2022, 10:25:30 PM] [Ring] Return Audio (Front Door): stopped gracefully
[12/21/2022, 10:25:30 PM] [Ring] Return Audio (Front Door): Input #0, sdp, from 'pipe:':
  Metadata:
    title           : Talk
  Duration: N/A, bitrate: N/A
  Stream #0:0: Audio: opus, 48000 Hz, mono, s16
Stream mapping:
  Stream #0:0 -> #0:0 (opus (libopus) -> opus (libopus))
Finishing stream 0:0 without any data written to it.
[libopus @ 0x564f048d28c0] No bit rate set. Defaulting to 96000 bps.
Output #0, rtp, to 'rtp://127.0.0.1:34879':
  Metadata:
    title           : Talk
    encoder         : Lavf59.16.100
  Stream #0:0: Audio: opus, 48000 Hz, stereo, s16, 96 kb/s
    Metadata:
      encoder         : Lavc59.18.100 libopus
size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Exiting normally, received signal 15.

[12/21/2022, 10:25:58 PM] [Ring] Stopped Live Stream for Front Door

Honesty Time

Luca-Lusu commented 1 year ago

I can confirm I have the exact same issue: video streaming works either locally or if connected remotely with another WiFi network. If connected with Cellular network streaming doesn't work (Homebridge running on a Raspberry PI here).

Perhaps offering the possibility to change the Video Codec and Straming Parameters (like for example it's possible in Homebridge Camera.UI Plugin) could be helpful.

dgreif commented 1 year ago

Changing the video codec or streaming quality is not something I'd like to add. That would require video to be transcoded by the plugin, rather than just passed through. This requires significantly more CPU, and will not work well on some lower end devices. If this issue came about after updating to the newest "Home" version, there likely isn't anything I can do to correct it.