NestMTX / app

All-in-one NestMTX Application
MIT License
16 stars 0 forks source link

Camera stops streaming after a few minutes #4

Closed kev24uk closed 2 months ago

kev24uk commented 2 months ago

Which version are you using?

v1.0.1

Which operating system are you using?

Describe the issue

Camera stops streaming after a short period, appears to be due to the url coming from google being incorrect. To note: this did not happen in nest-rtsp, in case that helps to diagnose a difference here!

Describe how to replicate the issue

Add a nest wired doorbell camera, start the container and after a random amount of time (usually a few minutes) the stream fails and does not work until the docker container is restarted (sometimes disabling and enabling the camera works but this is not consistent)

Did you attach the server logs?

{"level":50,"time":1725131891867,"pid":8,"hostname":"93f60798ad73","service":"camera-1","msg":"Error starting FFmpeg process:"}
{"level":30,"time":1725131891867,"pid":8,"hostname":"93f60798ad73","service":"camera-1","msg":"Starting FFmpeg process for RTSP stream"}
{"level":30,"time":1725131891867,"pid":8,"hostname":"93f60798ad73","service":"pm3","msg":"Starting process: camera-1"}
{"level":30,"time":1725131891867,"pid":8,"hostname":"93f60798ad73","service":"pm3","msg":"Starting new process: camera-1"}
{"level":50,"time":1725131891910,"pid":8,"hostname":"93f60798ad73","service":"gstreamer","camera":"camera-1","msg":"-vsync is deprecated. Use -fps_mode"}
{"level":50,"time":1725131902025,"pid":8,"hostname":"93f60798ad73","service":"gstreamer","camera":"camera-1","msg":"[rtsp @ 0x7ff9e8b4e600] method DESCRIBE failed: 404 Not Found"}
{"level":50,"time":1725131902025,"pid":8,"hostname":"93f60798ad73","service":"gstreamer","camera":"camera-1","msg":"[in#0 @ 0x7ff9e8c458c0] Error opening input: Server returned 404 Not Found"}
{"level":50,"time":1725131902025,"pid":8,"hostname":"93f60798ad73","service":"gstreamer","camera":"camera-1","msg":"Error opening input file rtsps://stream-eu1-bravo.dropcam.com:443/sdm_live_stream/{{removed}}"}
{"level":50,"time":1725131902025,"pid":8,"hostname":"93f60798ad73","service":"gstreamer","camera":"camera-1","msg":"Error opening input files: Server returned 404 Not Found"}
{"level":30,"time":1725131902033,"pid":8,"hostname":"93f60798ad73","service":"pm3","msg":"Process exited: camera-1"}

Did you attach a network dump?

no

kev24uk commented 2 months ago

Did a bit of digging - it looks like the ExtendRtspStream functionality returns a new access token, which in turn invalidates the old rtsp url and requires a new one (with the new access token query parameter ?auth=g.0. in it)

This means that the extend functionality actually needs to start a new ffmpeg process with the new url, rather than expecting it to continue working as the code does now.

Would be nice if Google documented this better (or actually implemented it so the existing access token continued to work rather than requiring a new one...)