blakeblackshear / frigate

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

[Support]: 1080p recording camera gets buggy fragments #8000

Closed sgrossiP closed 1 year ago

sgrossiP commented 1 year ago

Hello Everyone. Im facing this issue no matter what camera, camera settings or frigate i use. running in different network conditions or pcs with different specs i obtain the same result The problem is that in several mp4 fragment there are some frozen miliseconds.

The cameras i tested are hikvision DS-2CV1021G0-IDW1 and dvr dahua XVR1B08-I with several different cameras

the key to me is that rtsp works 100% smoothly what i tried with no success:

playing with bitrate, lower resolution, change network conditions ( use wifi or ethernet ) disabling detection to preserve hardware resources using differents onvif version using another frigate ffmpeg presets

mp4 examples with errors

https://drive.google.com/file/d/1KN77_3ZA2vKbM7_dXj4Mf5jhL1zvJZMp/view?usp=sharing

https://drive.google.com/file/d/1ilQ1XgmT-oA4cGDurjdtccQrDkheIapB/view?usp=sharing

https://drive.google.com/file/d/1-xt3f0uOrLSqCDkYnoIu_yuJiT6Q_mrM/view?usp=sharing

Note that the error usually occurs when there is sudden movement

why is this important? i own a little tennis club where people ask me for their videos using our Instagram page so you can imagine what those seconds matter in a tennis match

does anyone have any clue of what is happening?

Santiago :)

Version

0.12.1

Frigate config file

mqtt:
  host: 192.168.1.243
  user: publico
  password: 12sgrossi34
record:
  enabled: True
  retain_days: 3
  events:
    retain:
      default: 3
snapshots:
  enabled: True
  bounding_box: True
  crop: false
  retain:
    default: 3
cameras:
  testdos:
    ffmpeg:
      output_args:
          record: preset-record-generic-audio-aac
      inputs:
        - path: rtsp://admin:12publico34@192.168.1.148:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - rtmp
            - record
      hwaccel_args: preset-vaapi
    rtmp:
      enabled: False
    detect:
        enabled: False
  test:
    ffmpeg:
      output_args:
          record: preset-record-generic-audio-aac
      inputs:
        - path: rtsp://admin:12publico34@192.168.1.148:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - rtmp
            - record
      hwaccel_args: preset-vaapi
    rtmp:
      enabled: False
    detect:
        enabled: False
  sinaudio:
    ffmpeg:
      output_args:
          record: preset-record-generic-audio-aac
      inputs:
        - path: rtsp://admin:12publico34@192.168.1.148:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - rtmp
            - record
      hwaccel_args: preset-vaapi
    rtmp:
      enabled: False
    detect:
        enabled: False

Relevant log output

nothing relevant

FFprobe output from your camera

Stream 0:
Return Code: 0

Video:

Codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
Resolution: 1920x1080
FPS: 25/1

Audio:

Codec: PCM mu-law / G.711 mu-law

Frigate stats

{"cpu_usages":{"%Cpu(s):":{"cpu":"id,","mem":"0.5"},"1":{"cpu":"0.0","mem":"0.0"},"103":{"cpu":"1.0","mem":"0.6"},"104":{"cpu":"0.0","mem":"0.0"},"119":{"cpu":"0.0","mem":"0.0"},"134":{"cpu":"0.0","mem":"0.2"},"135":{"cpu":"0.0","mem":"0.0"},"136":{"cpu":"0.0","mem":"0.2"},"137":{"cpu":"0.0","mem":"0.1"},"146":{"cpu":"0.0","mem":"0.0"},"15":{"cpu":"0.0","mem":"0.0"},"165":{"cpu":"0.0","mem":"0.1"},"17":{"cpu":"0.0","mem":"0.0"},"182":{"cpu":"0.0","mem":"0.1"},"18734":{"cpu":"0.0","mem":"0.0"},"18762":{"cpu":"0.0","mem":"0.0"},"18764":{"cpu":"0.0","mem":"0.0"},"199":{"cpu":"0.0","mem":"0.1"},"24":{"cpu":"0.0","mem":"0.0"},"25":{"cpu":"0.0","mem":"0.0"},"26":{"cpu":"0.0","mem":"0.0"},"27":{"cpu":"0.0","mem":"0.0"},"28":{"cpu":"0.0","mem":"0.0"},"29":{"cpu":"0.0","mem":"0.0"},"30":{"cpu":"0.0","mem":"0.0"},"31":{"cpu":"0.0","mem":"0.0"},"32":{"cpu":"0.0","mem":"0.0"},"41":{"cpu":"0.0","mem":"0.0"},"42":{"cpu":"0.0","mem":"0.0"},"426":{"cpu":"0.0","mem":"0.2"},"432":{"cpu":"0.0","mem":"0.0"},"433":{"cpu":"0.3","mem":"0.3"},"435":{"cpu":"0.7","mem":"0.3"},"438":{"cpu":"0.3","mem":"0.3"},"439":{"cpu":"0.0","mem":"0.1"},"440":{"cpu":"0.3","mem":"0.3"},"441":{"cpu":"0.3","mem":"0.3"},"442":{"cpu":"1.0","mem":"0.3"},"443":{"cpu":"0.0","mem":"0.1"},"446":{"cpu":"0.7","mem":"0.3"},"449":{"cpu":"0.7","mem":"0.3"},"451":{"cpu":"3.3","mem":"0.3"},"454":{"cpu":"4.3","mem":"0.3"},"457":{"cpu":"3.7","mem":"0.3"},"459":{"cpu":"0.0","mem":"0.1"},"460":{"cpu":"0.0","mem":"0.1"},"78":{"cpu":"0.0","mem":"0.0"},"79":{"cpu":"0.0","mem":"0.0"},"82":{"cpu":"0.0","mem":"0.0"},"86":{"cpu":"0.0","mem":"0.1"},"MiB":{"cpu":"15989.2","mem":"avail"},"PID":{"cpu":"%CPU","mem":"%MEM"},"Tasks:":{"cpu":"stopped,","mem":"0"},"top":{"cpu":"average:","mem":"1.85,"}},"detection_fps":0.0,"detectors":{"cpu":{"detection_start":0.0,"inference_speed":10.0,"pid":433}},"gpu_usages":{"intel-vaapi":{"gpu":"22.18 %","mem":"- %"}},"service":{"last_updated":1696017265,"latest_version":"0.12.1","storage":{"/dev/shm":{"free":62.2,"mount_type":"tmpfs","total":67.1,"used":4.9},"/media/frigate/clips":{"free":867714.4,"mount_type":"fuseblk","total":1000203.1,"used":132488.7},"/media/frigate/recordings":{"free":867714.4,"mount_type":"fuseblk","total":1000203.1,"used":132488.7},"/tmp/cache":{"free":992.0,"mount_type":"tmpfs","total":1000.0,"used":8.0}},"temperatures":{},"uptime":18745,"version":"0.12.1-367d724"},"sinaudio":{"camera_fps":5.0,"capture_pid":449,"detection_enabled":0,"detection_fps":0.0,"ffmpeg_pid":454,"pid":441,"process_fps":5.0,"skipped_fps":0.0},"test":{"camera_fps":5.0,"capture_pid":446,"detection_enabled":0,"detection_fps":0.0,"ffmpeg_pid":451,"pid":440,"process_fps":5.0,"skipped_fps":0.0},"testdos":{"camera_fps":5.1,"capture_pid":442,"detection_enabled":0,"detection_fps":0.0,"ffmpeg_pid":457,"pid":438,"process_fps":5.1,"skipped_fps":0.0}}

Operating system

Other Linux

Install method

Docker CLI

Coral version

CPU (no coral)

Network connection

Wired

Camera make and model

hikvision DS-2CV1021G0-IDW1

Any other information that may be helpful

No response

NickM-27 commented 1 year ago

maybe try

ffmpeg:
  input_args: preset-rtsp-restream
sgrossiP commented 1 year ago

maybe try

ffmpeg:
  input_args: preset-rtsp-restream

Hey Nick, not understanding why but it worked like charm I'm really happy about it lol Thx <3

NickM-27 commented 1 year ago

yeah, depending on the network config sometimes the extra args we have in preset-rtsp-generic cause issues with frame timing. preset-rtsp-restream is a simpler set of args