Stream Network error on Video on Lovlace card

I’ve searched all over every forum for this problem. The video stream keeps crashing and showing an error message like “Stream network error”. This is when showing the dashboard on my iPad.
I’ve tried the following:

  1. Just an ordinary picture card for showing a video. Works for a while and then crashes. Tested both main and substream with rtsp. Using Foscams.
  2. Then tested with video proxy which actually works. But the back draw was a high CPU load. And I would like to avoid this as my next step would be adding Frigate for object detection.
  3. My next step was to add Frigate. I did that and also the Frigate Hass card for showing the video on the dashboard. But the video keeps crashing in the dashboard with the same problem. While the video in the Frigate addon is working flawlessly. So the problem must be in the dashboard showing a video.

I’m not using the Foscam integration for the Frigate hass card.

I’ve not seen any problems in any logs before, but the Frigate addon actually gave me some logs when the card crashed. I think… See the log at the bottom.

My frigate.yaml looks like this if it can add some info on this. But I think the problem is somewhere else.
Hope that someone can help out ono this. :slight_smile:

mqtt:
  host: 192.168.0.161
  user: !secret mqtt-user
  password: !secret mqtt-password

cameras:

#######################
# Entré Camera Config
#######################
  camera_entre: 
    ffmpeg:
      inputs:
        # High resolution Stream
        - path: rtsp://XXX:XXX@1xxx:88/videoMain 
          roles:
            - record
        # Low resolution Stream
        - path: rtsp://XXX:XXX@1xxx:88/videoSub 
          roles:
            - detect
            - rtmp
    detect:
      width: 640 #1280 # <---- update for your camera's detect resolution
      height: 480 #720 # <---- update for your camera's detect resolution
      fps: 5
    objects:
      track:
        - person
        - cat
    record:
      enabled: True
      retain:
        days: 1
        mode: active_objects
      events:
        retain:
          default: 2
          mode: active_objects
    snapshots:
      enabled: True
          

  #######################
  # Carport Camera Config
  #######################
  camera_carport: 
    ffmpeg:
      inputs:
        # High resolution Stream
        - path: rtsp://XXX:XXX@1xxx:88/videoMain 
          roles:
            - record
        # Low resolution Stream
        - path: rtsp://XXX:XXX@1xxx:88/videoSub 
          roles:
            - detect
            - rtmp
    detect:
      width: 1280 #2304 # <---- update for your camera's detect resolution
      height: 720 #1296 # <---- update for your camera's detect resolution
      fps: 5
    objects:
      track:
        - person
        - cat
        - car        
    record:
      enabled: True
      retain:
        days: 1
        mode: active_objects
      events:
        retain:
          default: 2
          mode: active_objects
    snapshots:
      enabled: True

FRIGATE ADDON LOG:

[2023-02-11 07:45:54] ffmpeg.camera_carport.record   ERROR   : [h264 @ 0x5652550a5f80] decode_slice_header error
[2023-02-11 07:45:54] ffmpeg.camera_carport.record   ERROR   : [h264 @ 0x5652550a5f80] no frame!
[2023-02-11 07:45:54] ffmpeg.camera_carport.record   ERROR   : [h264 @ 0x5652550a5f80] non-existing PPS 0 referenced

[2023-02-11 07:45:54] ffmpeg.camera_carport.record   ERROR   : Guessed Channel Layout for Input Stream #0.1 : mono
[2023-02-11 07:45:54] ffmpeg.camera_carport.record   ERROR   : rtsp://xxx:xxx@1xxx:88/videoMain: Connection timed out
[2023-02-11 07:45:54] watchdog.camera_carport        INFO    : Terminating the existing ffmpeg process...
[2023-02-11 07:45:54] watchdog.camera_carport        INFO    : Waiting for ffmpeg to exit gracefully...
[2023-02-11 07:46:11] frigate.video                  ERROR   : camera_carport: Unable to read frames from ffmpeg process.
[2023-02-11 07:46:11] frigate.video                  ERROR   : camera_carport: ffmpeg process is not running. exiting capture thread...
[2023-02-11 07:46:14] watchdog.camera_carport        ERROR   : Ffmpeg process crashed unexpectedly for camera_carport.
[2023-02-11 07:46:14] watchdog.camera_carport        ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
[2023-02-11 07:46:14] ffmpeg.camera_carport.detect   ERROR   : [h264 @ 0x563067548f00] non-existing PPS 0 referenced
[2023-02-11 07:46:14] ffmpeg.camera_carport.detect   ERROR   : [h264 @ 0x563067548f00] decode_slice_header error
[2023-02-11 07:46:14] ffmpeg.camera_carport.detect   ERROR   : [h264 @ 0x563067548f00] no frame!
[2023-02-11 07:46:14] ffmpeg.camera_carport.detect   ERROR   : [h264 @ 0x563067548f00] non-existing PPS 0 referenced
[2023-02-11 07:46:14] ffmpeg.camera_carport.detect   ERROR   : Guessed Channel Layout for Input Stream #0.1 : mono
[2023-02-11 07:46:14] ffmpeg.camera_carport.detect   ERROR   : [swscaler @ 0x563067720340] [swscaler @ 0x56306772d300] deprecated pixel format used, make sure you did set range correctly
[2023-02-11 07:46:14] ffmpeg.camera_carport.detect   ERROR   : rtsp://xxx:xxx@1xxx:88/videoSub: Connection timed out
[2023-02-11 07:46:14] ffmpeg.camera_carport.detect   ERROR   :     Last message repeated 4 times
[2023-02-11 07:46:14] ffmpeg.camera_carport.detect   ERROR   : [flv @ 0x563067562ec0] Failed to update header with correct duration.
[2023-02-11 07:46:14] ffmpeg.camera_carport.detect   ERROR   : [flv @ 0x563067562ec0] Failed to update header with correct filesize.
[2023-02-11 09:09:35] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:46820]
[2023-02-11 09:09:40] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:46820]
[2023-02-11 09:10:25] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38798]
[2023-02-11 09:10:42] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38798]

What hardware are you running this on? Seems like the camera is sending bad data which causes ffmpeg to crash. RTMP is also very sensitive to this which is why in frigate 0.12 we are moving to a RTSP restream instead of RTMP restream which will be more stable.

Thanks for answering! I’m running Home Assistant on a Lenovo ThinkCentre M72e USFF Intel i3 4GB RAM 120GB SSD. And using an iPad in the kitchen for the dashboard.

The strange thing, as I see it, is that the video seems stable in the Frigate tab for the actual addon. But not on the dashboard card.

Made some more testing. So far I can only see that this error occurs on the iPad.
And regarding RTMP, should I just disable that in Frigate? But I guess something else is needed then?

But I’m not sure that it will solve the problem since it did crash before when just using the standard picture card in Lovelace and fed it with an RTSP stream.

I found out how to put a bandaid on a broken bone. :slight_smile:

If I leave one instance of the dashboard running that also shows the Frigate card on a computer that never goes to sleep, the iPad card won’t crash. Has been stable now for more than 12h.

My conclusion is that the card struggles on the iPad when it does some kind of page refresh and the card goes grey for a couple of seconds. This refresh seems to work better and stable on the desktop.

Does anyone know what this can be or is this perhaps a bug to be reported?

I seem to have a similar issue, but did not yet find a conviniant way to keep a stream open on another device… hope this could be fixed somehow in the app