blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
18.01k stars 1.65k forks source link

Clips: The media could not be loaded #1606

Closed steveax79 closed 2 years ago

steveax79 commented 3 years ago

1.- Clips worked fine previous version 0.9.0-8fd12f0-amd64, after updating 0.9.0-beta2-amd64, adapting settings for events recording (clips settings deprecated): https://github.com/blakeblackshear/frigate/blob/master/docs/docs/configuration/cameras.md

Clips display snapshot correctly but event recording does not play in browser.

Error : "The media could not be loaded, either because the server or network failed or because the format is not supported."

imagen I have intentionally cropped the image after error msg, looks good in the browser.

imagen

2.- Can I only activate event recording without activating 24/7 recording?

Thanks!

Version of frigate 0.9.0-3340952

Config file

  host: 192.168.10.90
  user: user
  password: pass
  topic_prefix: frigate
cameras:
  jardin:
    ffmpeg:
      inputs:
        - path: rtsp://user:pass@192.168.10.103:554/Streaming/Channels/101
          roles:
            - detect
            - clips
            - rtmp
    snapshots:
      enabled: true
      crop: false
      bounding_box: true
    objects:
      track:
        - person
    record:
      enabled: True
      retain_days: 0
      events:
        enabled: true
        max_seconds: 300
        pre_capture: 5
        post_capture: 10
        retain:
          default: 10
    detect:
      width: 2560
      height: 1440
      fps: 5
detectors:
  coral:
    type: edgetpu
    device: usb
birdseye:
  enabled: True
  width: 1920
  height: 1080
  quality: 1
  mode: continuous
ffmpeg:
  hwaccel_args:
    - -hwaccel
    - vaapi
    - -hwaccel_device
    - /dev/dri/renderD128
    - -hwaccel_output_format
    - yuv420p

Frigate container logs

No errors found

Frigate stats

{
  "coches": {
    "camera_fps": 5.1,
    "capture_pid": 240,
    "detection_fps": 2,
    "pid": 230,
    "process_fps": 5.1,
    "skipped_fps": 0
  },
  "detection_fps": 10.5,
  "detectors": {
    "coral": {
      "detection_start": 0,
      "inference_speed": 15.79,
      "pid": 215
    }
  },
  "dormitorios": {
    "camera_fps": 5,
    "capture_pid": 242,
    "detection_fps": 0,
    "pid": 231,
    "process_fps": 5,
    "skipped_fps": 0
  },
  "entrada": {
    "camera_fps": 5,
    "capture_pid": 238,
    "detection_fps": 0,
    "pid": 228,
    "process_fps": 5,
    "skipped_fps": 0
  },
  "hall": {
    "camera_fps": 5.1,
    "capture_pid": 236,
    "detection_fps": 2.9,
    "pid": 226,
    "process_fps": 5.1,
    "skipped_fps": 0
  },
  "jardin": {
    "camera_fps": 5.1,
    "capture_pid": 232,
    "detection_fps": 0,
    "pid": 221,
    "process_fps": 5.1,
    "skipped_fps": 0
  },
  "piscina": {
    "camera_fps": 5.1,
    "capture_pid": 235,
    "detection_fps": 5.6,
    "pid": 222,
    "process_fps": 5,
    "skipped_fps": 0
  },
  "service": {
    "storage": {
      "/dev/shm": {
        "free": 2123,
        "mount_type": "tmpfs",
        "total": 2147.5,
        "used": 24.5
      },
      "/media/frigate/clips": {
        "free": 32623.6,
        "mount_type": "ext4",
        "total": 58011.6,
        "used": 22410.7
      },
      "/media/frigate/recordings": {
        "free": 32623.6,
        "mount_type": "ext4",
        "total": 58011.6,
        "used": 22410.7
      },
      "/tmp/cache": {
        "free": 2000,
        "mount_type": "tmpfs",
        "total": 2000,
        "used": 0
      }
    },
    "uptime": 459,
    "version": "0.9.0-3340952"
  }
}

Computer Hardware

lawm commented 3 years ago
  1. Can you play the same event in the Recordings UI? Maybe it's related to #1515 -- I guess if the event fits in 1 recording clip there's a problem playing it in the Event page.
steveax79 commented 3 years ago

camera -> recordings No recordings found. (Recordings enabled in config.yml) OS recordings directory empty

imagen

camera -> events Events in event list ok, event snapshot ok, event clip play not working. 502 Bad Gateway

imagen

imagen

imagen

imagen

blakeblackshear commented 3 years ago

Are these h265 cameras?

steveax79 commented 3 years ago

h264 cameras.

Video clip events in previous version 0.9.0-8fd12f0-amd64 works fine.

Config.yml it's ok ¿?

record: enabled: True retain_days: 0 events: enabled: true max_seconds: 300 pre_capture: 5 post_capture: 10 retain: default: 10

ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04) configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libfreetype --enable-libvidstab --enable-libmfx --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-vaapi --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 Input #0, rtsp, from 'rtsp://user:pass@192.168.10.103:554/Streaming/Channels/101': Metadata: title : Media Presentation Duration: N/A, start: 0.550000, bitrate: N/A Stream #0:0: Video: h264, yuvj420p(pc, bt709, progressive), 2560x1440, 10 fps, 10 tbr, 90k tbn, 20 tbc

ozett commented 3 years ago

1 - related? 2 - related ?

steveax79 commented 3 years ago

1.- I've changed old deprecated role clips to record in config.yml. Partially resolved problem.

cameras:
  jardin:
    ffmpeg:
      inputs:
        - path: rtsp://user:pass@192.168.10.103:554/Streaming/Channels/101
          roles:
            - detect
            - clips <<<<<<<<<<<<<<<< Change this to record >>>>>>>>>>>
            - rtmp
ozett commented 3 years ago

Are these h265 cameras? https://github.com/blakeblackshear/frigate/issues/1606#issuecomment-905951098

looks like newer hikvison cameras, in h264 but with "yuvj420p" (! J !) instead "yuv420p". (mine with yuvj420p also not working out-of-the-box )

rtsp://user:pass@192.168.10.103:554/Streaming/Channels/101': Metadata: title : Media Presentation Duration: N/A, start: 0.550000, bitrate: N/A Stream #0:0: Video: h264, yuvj420p(pc, bt709, progressive), 2560x1440, 10 fps, 10 tbr, 90k tbn, 20 https://github.com/blakeblackshear/frigate/issues/1606#issuecomment-906170418

steveax79 commented 3 years ago

1.- v0.9.0-rc1 tested. SOLVED!

New event list works like a charm!

2.- ¿?

AlexanderSch90 commented 3 years ago

I have pretty much the same problem. Is it really right now that I have to activate 24/7 recording for at least 1 day, otherwise it is not possible to only save object clips? For me it would be a step backwards. I just need the object clips. With Beta 1 it was still possible ...

steveax79 commented 3 years ago

UPDATE: Since yesterday with RC1. All events are not recorded, some are recorded, others are not.

imagen

"The media could not be loaded, either because the server or network failed or because the format is not supported."


config.yml

record:
      enabled: yes
      retain_days: 0
      events:
        enabled: true
        max_seconds: 300
        pre_capture: 15
        post_capture: 15
        objects:
          - person
        retain:
          default: 10
ozett commented 3 years ago

UPDATE: Since yesterday with RC1. All events are not recorded, some are recorded, others are not.

my guess is, that failure has it cause in the config for the rtsp-format of the cam ( and ffmpeg-options in frigate.yml for output_args:. general or per camera)

if it is h264 and yuv420p, than all is ok. its not ok if the cam sends h265 or Video: h264, yuvj420p

may check of streams with ffprobe against this theory?

steveax79 commented 3 years ago

I have 8 cameras of different models connected, Foscam 1080, Foscam 720, Hikvision 1080, Hikvision 2k. All h264.

Is your theory applicable if the same camera sometimes works and sometimes not? In my case, same camera sometimes works and sometimes give error. "The media could not be loaded, either because the server or network failed or because the format is not supported."

ffprobes

Hikvision 2k

ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libfreetype --enable-libvidstab --enable-libmfx --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-vaapi --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, rtsp, from 'rtsp://user:pass@192.168.10.103:554/Streaming/Channels/101':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.600000, bitrate: N/A
    Stream #0:0: Video: h264, yuvj420p(pc, bt709, progressive), 2560x1440, 10 fps, 10 tbr, 90k tbn, 20 tbc

Foscam 720

ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libfreetype --enable-libvidstab --enable-libmfx --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-vaapi --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, rtsp, from 'rtsp://user:pass@192.168.10.101:554/videoMain':
  Metadata:
    title           : videoMain
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264, yuvj420p(pc, bt709, progressive), 1280x720, 10 tbr, 90k tbn, 180k tbc
    Stream #0:1: Audio: pcm_mulaw, 8000 Hz, 1 channels, s16, 64 kb/s

Foscam 1080 - It seems that there are some errors, I don't know what they are ...


ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libfreetype --enable-libvidstab --enable-libmfx --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-vaapi --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65548
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65550
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65552
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65554
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65556
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65558
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65560
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65562
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65564
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65566
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65568
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65570
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65572
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65574
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65576
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65578
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65580
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65582
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65584
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65586
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65588
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65590
[h264 @ 0x561a05d5eb40] Missing reference picture, default is 65592
Input #0, rtsp, from 'rtsp://user:pass@192.168.10.100:88/videoMain':
  Metadata:
    title           : IP Camera Video
    comment         : videoMain
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264, yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 tbr, 90k tbn, 2108081.20 tbc
    Stream #0:1: Audio: pcm_mulaw, 8000 Hz, 1 channels, s16, 64 kb/s

Hikvision 1080

ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libfreetype --enable-libvidstab --enable-libmfx --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-vaapi --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, rtsp, from 'rtsp://user:pass2018@192.168.10.104:554/Streaming/Channels/101':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.120000, bitrate: N/A
    Stream #0:0: Video: h264, yuvj420p(pc, bt709, progressive), 1920x1080, 25 tbr, 90k tbn, 180k tbc
golfvert commented 3 years ago

@steveax79 thanks for the thorough analysis. I have two foscam and two hikvision. I have the same behaviour as you described. Being completely new to frigate, I started with 0.9.0-rc1-armv7 (running on odroid c2 with coral USB). Clips were not working (same error "The media could not be loaded...") and no mp4 in the clips folder. Switching to recording works, with the same caveats, I don't want 24/7 recordings... Downgrading to blakeblackshear/frigate:stable-armv7 (and adapting to conf accordingly), clips were working. All my cameras are H264. Happy to test further, if required. And, blakeblackshear thanks for the fantastic tool!

ozett commented 3 years ago

@steveax79 any cam has wlan? or all with cable?

i can spot only one obvious difference between your cams on the ffmpeg: as you marked the Foscam 1080 as mostly faulty. that is the only one with "yuv420p" that format in your cam-list.

i am too much unexperienced with ffmpeg to give any guess how to set suitable output-args for correct recordings...

quenthal commented 3 years ago

@steveax79 thanks for the thorough analysis. I have two foscam and two hikvision. I have the same behaviour as you described. Being completely new to frigate, I started with 0.9.0-rc1-armv7 (running on odroid c2 with coral USB). Clips were not working (same error "The media could not be loaded...") and no mp4 in the clips folder. Switching to recording works, with the same caveats, I don't want 24/7 recordings... Downgrading to blakeblackshear/frigate:stable-armv7 (and adapting to conf accordingly), clips were working. All my cameras are H264. Happy to test further, if required. And, blakeblackshear thanks for the fantastic tool!

Same problem here. Clips are no longer recorded, unless 24/7 recording is enabled as well. Clips as a capability is now deprecated, it is using recordings instead and it makes many things better. However, better wait for documentation, as with older versions I have different parameters for clips and recordings and I am (was) using only clips for some use cases without 24/7 recording. I'd like to retain only clips, so will have to check if retain setting 0 would make it similar how it used to work for that use case.

blakeblackshear commented 3 years ago

The clips folder is no longer used in 0.9.0 as the concept of clips has been replaced by events. You won't see any new mp4 files in the clips folder after upgrading to 0.9.0. See https://github.com/blakeblackshear/frigate/discussions/1502#discussioncomment-1168133

You have to turn on record to save video from a camera. Set retain_days to 0 and configure event retention to only save recordings where events occur.

golfvert commented 3 years ago

Thanks for the answer. Can you detail a bit more how to "You have to turn on record to save video from a camera. Set retain_days to 0 and configure event retention to only save recordings where events occur.". Any documentation available on that?

blakeblackshear commented 3 years ago

There is an example in this issue: https://github.com/blakeblackshear/frigate/issues/1606#issuecomment-907606473

golfvert commented 3 years ago

Thanks. I saw that. However, I had "real" records in the recording folder. What retain_days: 0 should do? Delete after 1 day or immediately?

blakeblackshear commented 3 years ago

It should retain up to the max_seconds configured for events to make sure it doesn't delete video for events in progress. The default is 5 minutes of video.

golfvert commented 3 years ago

Thanks for the explanations!! Again, great tool :) Now my "clips" are there.

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.

HSB-collab commented 2 years ago

I have a similar but different problem: my events are not always being recorded. I am running Supervised HA in a Virtualbox VM on an Ubuntu 20.04 host. I have Frigate version 0.9.1-800F33E running in a separate docker container. I have 10 cameras in my setup but to make it simpler I show below the config.yml file for just 1 camera. When an event occurs, I get a snapshot and the Frigate events menu thinks there is a video recording but when I try and play it I get a messasge saying "The media could not be loaded, either because the server or network failed or because the format is not supported.".

Any ideas as to what I am doing wrong? Also, how do I get the logs out of the Docker container? Also, how do I run ffprobe in the container?

Sorry about the questions. I am guessing I am doing something dumb but what???

My config.yml file is:

mqtt:
  host: 10.0.0.251
  user: mqtt_user
  password: *****
ffmpeg:
  hwaccel_args:
    - -hwaccel
    - vaapi
    - -hwaccel_device
    - /dev/dri/renderD128
    - -hwaccel_output_format
    - yuv420p
  global_args: -hide_banner -loglevel debug    
cameras:
 # Name of your camera
  Camera1:
    ffmpeg:
      inputs:
        - path: rtsp://****:*****@10.0.0.120/img/video.sav
          roles:
            - detect
            - rtmp
            - record
    detect:    
      width: 1280
      height: 720
      fps: 5  
    objects:
      track:
        - person
        - car
      filters:
        person:
           min_score: 0.6
          threshold: 0.66
    record:
      enabled: true
      retain_days: 0
      events:
        max_seconds: 60
        retain:
          default: 10
    snapshots:
      enabled: true

 detectors:
  coral:
    type: edgetpu
    device: pci
pepsinio commented 2 years ago

Same problem here

HSB-collab commented 2 years ago

Same problem here

I started a separate thread on this: https://github.com/blakeblackshear/frigate/issues/2076#issuecomment-950312617

jschwalbe commented 2 years ago

There is an example in this issue: #1606 (comment)

I'd like to just point out that the second enabled: true line is not allowed and needs to be removed.

HSB-collab commented 2 years ago

Thank you @jschwalbe for responding but I don't understand. The first enabled: true is to enable recording and the 2nd enabled: true is to enable snapshots?

Sloth-on-meth commented 2 years ago

still having this issue

radinsky commented 2 years ago

Still the same issue on the latest version..

mspinolo commented 1 year ago

I have the same issue, 6 camera and happening on all of them by time to time (10% of the clips....more or less)

HSB-collab commented 1 year ago

I have the same issue, 6 camera and happening on all of them by time to time (10% of the clips....more or less)

As I recall, the reason I had the problem was because I had record set to false by default. As soon as I changed the default for record to true it started working.

mspinolo commented 1 year ago

doesn't look to be my case, record is set to true and not set at camera level. Also record works most of the times but sometimes not, which is very strange

tonydm commented 1 year ago

@HSB-collab - I'm here researching the "media could not be loaded..." error msg and saw your questions. You've probably figured out your questions by now. But in case not:

Q2: View docker log You could use docker-compose logs -f <replace with your service/container name> or docker logs -f <replace with your service/container name>. I prefer to get the container's log file path/name and use tail. Docker's log is unreliable and I find myself having to always terminate the process with kill -9

~/DockerServices/frigate-nvr .................................................................................................................. INT 07:32:51 AM
> docker inspect <replace with your service/container name> | grep log
        "LogPath": "/var/lib/docker/containers/8111ad80ee7635248503e17cd1c9c2887511289f404a073fcec1f5d71398d6b0/8111ad80ee7635248503e17cd1c9c2887511289f404a073fcec1f5d71398d6b0-json.log",

$ sudo tail -f /var/lib/docker/containers/8111ad80ee7635248503e17cd1c9c2887511289f404a073fcec1f5d71398d6b0/8111ad80ee7635248503e17cd1c9c2887511289f404a073fcec1f5d71398d6b0-json.log

Q3:

docker exec -it <replace with your service/container name> bash (depending on your arch [amd64, arm], you may need to use ash).. This will drop you into the container as user root

~/DockerServices/frigate-nvr ...................................................................................................................... 07:32:54 AM
> docker exec -it frigate-nvr bash
root@8111ad80ee76:/opt/frigate#
root@8111ad80ee76:/opt/frigate# ffprobe /media/frigate/recordings/2023-07-13/13/Frontgate_Cam1/19.24.mp4
ffprobe version n5.1-2-g915ef932a3-20220731 Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-mbedtls --enable-librist --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20220731
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/media/frigate/recordings/2023-07-13/13/Frontgate_Cam1/19.24.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Media Presentation
    encoder         : Lavf59.27.100
  Duration: 00:00:10.00, start: 0.000000, bitrate: 5043 kb/s
  Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc, progressive), 2688x1520 [SAR 1:1 DAR 168:95], 5041 kb/s, 15.01 fps, 50 tbr, 15360 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
root@8111ad80ee76:/opt/frigate#
tonydm commented 1 year ago

I'm here trying to resolve the "The media could not be loaded, either because the server or network failed or because the format is not supported." issue.

I recently replaced most of my WyzeCam v3 cameras with Hikvision. A recent conversation with and suggestion from @NickM-27 (link here) recommended that I replace the WyzeCams. So I did.

All of the new cameras (Hikvision) are configured for h264. Following a delete of all Frigate data and a fresh start of Frigate, streams are consistent and reliable and "Event" recordings can be played/viewed. However, after the system has run for some time, the "Event" recordings are not playable and I get the The media could not be loaded, either because the server or network failed or because the format is not supported. message. This includes Event Recordings that were initially able to be played/viewed but later are not. If Event recordings are able to be viewed initially and then can't be viewed later, I find it hard to believe it's a "format" issue. To me, this indicates a problem not with the camera and it's stream format setting, but with Frigate, the host, network, NAS, or a combination of all. If I delete the data dir and restart Frigate, Event recordings (new ones) can be viewed again.

I think I recall @blakeblackshear or @NickM-27 (sorry I can't remember which), said the error msg was vague. Is there room to improve the error message and/or provide some "key" in the log file to filter out and identify the source cause of the error? Reporting that it's either the server or network failed or the format is not supported leaves way too many places to look. Anyone with an IT background knows this leads to a wild goose chase. Is it really a "format" issue, a problem reading the data from the local drive or NAS, i.e. a block error on the local drive/out of disk space or the NAS isn't responding/reachable?

Are there specific config.yml settings to make things work correctly? There are so many setting options and after reviewing a many posts here and elsewhere on the net, it's unclear, to me, what settings, if any, would resolve this issue.

Thank you again! You're efforts and diligence in working to resolve issues and improve your project are greatly appreciated!

NickM-27 commented 1 year ago

All of the new cameras (Hikvision) are configured for h264. Following a delete of all Frigate data and a fresh start of Frigate, streams are consistent and reliable and "Event" recordings can be played/viewed. However, after the system has run for some time, the "Event" recordings are not playable and I get the The media could not be loaded, either because the server or network failed or because the format is not supported. message. This includes Event Recordings that were initially able to be played/viewed but later are not. If Event recordings are able to be viewed initially and then can't be viewed later, I find it hard to believe it's a "format" issue.

yes that is very odd, I would expect errors in the frigate logs

I think I recall @blakeblackshear or @NickM-27 (sorry I can't remember which), said the error msg was vague. Is there room to improve the error message and/or provide some "key" in the log file to filter out and identify the source cause of the error? Reporting that it's either the server or network failed or the format is not supported leaves way too many places to look. Anyone with an IT background knows this leads to a wild goose chase. Is it really a "format" issue, a problem reading the data from the local drive or NAS, i.e. a block error on the local drive/out of disk space or the NAS isn't responding/reachable?

The error message / handling comes from the browser, there is nothing for us to do to improve that because it is the browser that is not specific about what is causing the failure to playback.

tonydm commented 1 year ago

I agree. The question is, what error are we looking for? Regarding the error message coming from the Browser... I agree that the browser can display errors that are self generated. However, a request is made from the browser to the server/Frigate. That request on the server should be logged and the result of said request. I don't know if you are using a third party Javascript lib. If so, if it's not compressed, one could inject some debug code. If it is, then that's a no go.

I've included some Javascript console information below related directly to the error in question and the related code source line references. Between that and the server side request process, I would think we could narrow down the source. As it is now, what I'm getting is that we don't have a clue what is causing the error. I can't believe that to be the case. While I'm not familiar with this projects code, I've coded enough backend and frontend projects in my 50 years to believe that there's room to get closer to the issue. I don't want to just complain but try to offer some support from this end to find and resolve this issue. It's a big deal. There's little point in an NVR if we can't reliably view our recordings.

A Google search for "VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED)" returns a number of links to issues with the video.js library. I think that's what you are using but could be wrong. Here's one result on Stackoverflow for example: [VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED)] (Link here)

My Chrome browser's dev javascript console.

Error Source
GET https:///vod/event/1689123734.693478-yuombe/master.m3u8 502 videojs-seek-buttons-fa3a5bd5.js:10
VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) The media could not be loaded, either because the server or network failed or because the format is not supported. Ke {code: 4, message: 'The media could not be loaded, either because the …rk failed or because the format is not supported.'} videojs-seek-buttons-fa3a5bd5.js:31
Uncaught (in promise) DOMException: Failed to load because no supported source was found. events:1
GET https://MY_DOMAIN/api/sub_labels?split_joined=1 500 index-40e1e50b.js:16
NickM-27 commented 1 year ago

I agree. The question is, what error are we looking for? Regarding the error message coming from the Browser... I agree that the browser can display errors that are self generated. However, a request is made from the browser to the server/Frigate. That request on the server should be logged and the result of said request.

It is not that simple. The request is simply for an m3u8 playlist and frigate returns that to nginx. Nginx then does the preparations to generate the .ts files and then have videojs in the browser commence playback. Then the browser has to try to play it back or fail at that point.

Frigate backend has no way of knowing at which point the error occurred unless it occurred at the time of generating the m3u8 metadata (which it rarely is).

As it is now, what I'm getting is that we don't have a clue what is causing the error. I can't believe that to be the case. While I'm not familiar with this projects code, I've coded enough backend and frontend projects in my 50 years to believe that there's room to get closer to the issue.

again there is not really any "narrowing it down" in a general sense. The error can be caused by trying to play h265 recordings in a browser that only supports h264, it can be because the recordings files don't exist where they should, and many other issues. So in your specific case, sure it can be narrowed down. But there is no single cause for this error.

I don't want to just complain but try to offer some support from this end to find and resolve this issue. It's a big deal. There's little point in an NVR if we can't reliably view our recordings.

The majority of cases of this issue were due to browser codec support, camera, or configuration issues, once those were resolved users did not have this come up again. It has been months since I have seen this issue at all myself and that was back when I was using reolink cameras which are known to have many issues.

I would suggest checking the nginx logs for errors regarding the vod api, and checking frigate backend logs as well.

tonydm commented 1 year ago

Thanks @NickM-27

I'm struggling a bit here... but let's take it one at a time.

again there is not really any "narrowing it down" in a general sense. The error can be caused by trying to play h265 recordings in a browser that only supports h264, it can be because the recordings files don't exist where they should, and many other issues. So in your specific case, sure it can be narrowed down. But there is no single cause for this error.

Solution?

NickM-27 commented 1 year ago

It seems that you are misunderstanding what I am saying. My points that you are quoting were in the general sense as to why it is so difficult for frigate to have a more specific error message. I was not referring to your setup specifically in what you quoted.

As for the goal of solving your specific issue, you have ignored my request twice now for frigate and nginx logs which is a clear way to narrow down where the issue is coming from

NickM-27 commented 1 year ago

also like it suggests in the docs, chrome://media-internals/ is another good tool for understanding why playback is failing

HSB-collab commented 1 year ago

@HSB-collab - I'm here researching the "media could not be loaded..." error msg and saw your questions. You've probably figured out your questions by now. But in case not:

Q2: View docker log You could use docker-compose logs -f <replace with your service/container name> or docker logs -f <replace with your service/container name>. I prefer to get the container's log file path/name and use tail. Docker's log is unreliable and I find myself having to always terminate the process with kill -9

~/DockerServices/frigate-nvr .................................................................................................................. INT 07:32:51 AM
> docker inspect <replace with your service/container name> | grep log
        "LogPath": "/var/lib/docker/containers/8111ad80ee7635248503e17cd1c9c2887511289f404a073fcec1f5d71398d6b0/8111ad80ee7635248503e17cd1c9c2887511289f404a073fcec1f5d71398d6b0-json.log",

$ sudo tail -f /var/lib/docker/containers/8111ad80ee7635248503e17cd1c9c2887511289f404a073fcec1f5d71398d6b0/8111ad80ee7635248503e17cd1c9c2887511289f404a073fcec1f5d71398d6b0-json.log

Q3:

docker exec -it <replace with your service/container name> bash (depending on your arch [amd64, arm], you may need to use ash).. This will drop you into the container as user root

~/DockerServices/frigate-nvr ...................................................................................................................... 07:32:54 AM
> docker exec -it frigate-nvr bash
root@8111ad80ee76:/opt/frigate#
root@8111ad80ee76:/opt/frigate# ffprobe /media/frigate/recordings/2023-07-13/13/Frontgate_Cam1/19.24.mp4
ffprobe version n5.1-2-g915ef932a3-20220731 Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-mbedtls --enable-librist --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20220731
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/media/frigate/recordings/2023-07-13/13/Frontgate_Cam1/19.24.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Media Presentation
    encoder         : Lavf59.27.100
  Duration: 00:00:10.00, start: 0.000000, bitrate: 5043 kb/s
  Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc, progressive), 2688x1520 [SAR 1:1 DAR 168:95], 5041 kb/s, 15.01 fps, 50 tbr, 15360 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
root@8111ad80ee76:/opt/frigate#

Hi @tonydm thanks for the advice on docker compose logs (very useful). However, my problem was fixed by setting the default for "record" to "true" and I have not seen the problem you are experiencing. With the latest version of Frigate (v0.12.1) I am not getting any playback issues using a number of different cameras (Wyze, Tapo and some old Sercomm). I did have issues with go2rtc and stopped using it.

bobskee commented 10 months ago

Issue https://github.com/blakeblackshear/frigate/issues/8253 was related in my case. Clip playback works on all my devices except for my Google Pixel 8 Pro. The suggested workaround to install Chrome Beta on Android solved my playback problems. Hopefully this is a temporary workaround.

Thanks to @NickM-27 his suggestion I was able to use chrome://media-internals/ while remotely debugging Chrome on my phone to see the following playback logging:

[debug] Video rendering in low delay mode.
[info] Cannot select MediaCodecVideoDecoder for video decoding
[info] Cannot select VpxVideoDecoder for video decoding
[info] Cannot select Dav1dVideoDecoder for video decoding
[error] video decoder initialization failed

That helped me finding the other issue. Thanks!

edit: In my case the codecs used in clip playback (.ts files) are:

Video: H264 - MPEG-4 AVC (part 10) (h264)
Audio: ADTS

I think the problem on my phone has something to do with support for the pixel format of the video stream (yuvj420p)