blakeblackshear / frigate

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

[Support]: Issues with video playback #3142

Closed stu1811 closed 2 years ago

stu1811 commented 2 years ago

Describe the problem you are having

I have 3x Amcrest IP POE cameras ([IP8M-2597EB-28MM). Sometimes video playback is ok and other times the video is distorted (see screenshot below). Live video playback in Frigate looks fine. I've tried playback in firefox and chrome.

Frigate version: 0.10.1-83481AF HA Frigate Version: 3.1

image

Live image image

Version

0.10.1-83481AF

Frigate config file

# frigate.yml
detectors:
  coral_pci1:
    type: edgetpu
    device: pci
mqtt:
  host: core-mosquitto
  port: 1883
  topic_prefix: frigate
  client_id: frigate
  user: XXXX
  password: XXX
  stats_interval: 60
cameras:
  driveway:
    ffmpeg:
      output_args:
        record: -f segment -segment_time 600 -segment_format yuv420p -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac
      input_args: -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt  -use_wallclock_as_timestamps 1
      inputs:
        - path: rtsp://admin:XXXXXX@192.168.42.220:554/cam/realmonitor?channel=1&subtype=1
          roles:
            - detect
            - rtmp
        - path: rtsp://admin:XXXX@192.168.42.220:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - record
    objects: 
      track:
        - person
        - dog
        - truck
        - horse
        - car
        # Optional: save clips configuration
    record:
      enabled: true
      retain_days: 30
      events:
        pre_capture: 5
        post_capture: 5
        required_zones: []
        retain:
          # Required: Default retention days (default: shown below)
          default: 10
          # Optional: Per object retention days
          objects:
            person: 15
    snapshots:
      enabled: true
    detect:
      width: 704
      height: 480
      fps: 5

Relevant log output

I don't see any

FFprobe output from your camera

ffprobe 'rtsp://admin:xxxxxx@192.168.42.220:554/cam/realmonitor?channel=1&subtype=1'
ffprobe version 4.4-6ubuntu5 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-7ubuntu1)
  configuration: --prefix=/usr --extra-version=6ubuntu5 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, rtsp, from 'rtsp://admin:XXXX@192.168.42.220:554/cam/realmonitor?channel=1&subtype=1':
  Metadata:
    title           : Media Server
  Duration: N/A, start: 0.400000, bitrate: N/A
  Stream #0:0: Video: h264 (Main), yuv420p(progressive), 704x480, 100 tbr, 90k tbn, 180k tbc

ffprobe 'rtsp://admin:XXXXX@192.168.42.220:554/cam/realmonitor?channel=1&subtype=0'                                                                                                                             
ffprobe version 4.4-6ubuntu5 Copyright (c) 2007-2021 the FFmpeg developers                                                                                                                                                               
  built with gcc 11 (Ubuntu 11.2.0-7ubuntu1)                                                                                                                                                                                             
  configuration: --prefix=/usr --extra-version=6ubuntu5 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --en
able-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme 
--enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --en
able-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable
-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libi
ec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared                                                                                                                                             
  libavutil      56. 70.100 / 56. 70.100                                                                                                                                                                                                 
  libavcodec     58.134.100 / 58.134.100                                                                                                                                                                                                 
  libavformat    58. 76.100 / 58. 76.100                                                                                                                                                                                                 
  libavdevice    58. 13.100 / 58. 13.100                                                                                                                                                                                                 
  libavfilter     7.110.100 /  7.110.100                                                                                                                                                                                                 
  libswscale      5.  9.100 /  5.  9.100                                                                                                                                                                                                 
  libswresample   3.  9.100 /  3.  9.100                                                                                                                                                                                                 
  libpostproc    55.  9.100 / 55.  9.100                                                                                                                                                                                                 
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets                                                                                                                                                                                            
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet                                                                                                                                                                        
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets                                                                                                                                                                                            
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet                                                                                                                                                                        
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets                                                                                                                                                                                            
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet             
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 2 packets
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets
[rtsp @ 0x561c012a5ac0] max delay reached. need to consume packet
[rtsp @ 0x561c012a5ac0] RTP: missed 1 packets
[h264 @ 0x561c012ab440] concealing 15205 DC, 15205 AC, 15205 MV errors in I frame
Input #0, rtsp, from 'rtsp://admin:XXXXX@192.168.42.220:554/cam/realmonitor?channel=1&subtype=0':
  Metadata:
    title           : Media Server
  Duration: N/A, start: 0.200000, bitrate: N/A
  Stream #0:0: Video: h264 (Main), yuv420p(progressive), 3840x2160, 100 tbr, 90k tbn, 180k tbc

Frigate stats

No response

Operating system

Other Linux

Install method

HassOS Addon

Coral version

M.2

Network connection

Wired

Camera make and model

Amcrest IP8M-2597EB-28MM

Any other information that may be helpful

No response

DrSpaldo commented 2 years ago

My suggestion would be your input_args has too many things in it. Mine only has 2 args for a similar camera and works fine. -c:v and the nvidia one

stu1811 commented 2 years ago

I was able to cut the config to this. I'll monitor and report back.

ffmpeg:
      output_args:
        record: -f segment -segment_time 600 -segment_format yuv420p  -c copy -an
      input_args: -fflags nobuffer 

EDIT: Errors

[2022-04-25 10:57:19] ffmpeg.garage_rear.record      ERROR   : [rtsp @ 0x5654bc95d6c0] RTP: missed 1 packets
[2022-04-25 10:57:19] ffmpeg.garage_rear.record      ERROR   : [rtsp @ 0x5654bc95d6c0] max delay reached. need to consume packet
[2022-04-25 10:57:19] ffmpeg.garage_rear.record      ERROR   : [rtsp @ 0x5654bc95d6c0] RTP: missed 1 packets
[2022-04-25 10:57:19] ffmpeg.garage_rear.record      ERROR   : [rtsp @ 0x5654bc95d6c0] max delay reached. need to consume packet
[2022-04-25 10:57:19] ffmpeg.garage_rear.record      ERROR   : [rtsp @ 0x5654bc95d6c0] RTP: missed 1 packets
[2022-04-25 10:57:19] ffmpeg.garage_rear.record      ERROR   : [rtsp @ 0x5654bc95d6c0] max delay reached. need to consume packet
[2022-04-25 10:57:19] ffmpeg.garage_rear.record      ERROR   : [rtsp @ 0x5654bc95d6c0] RTP: missed 1 packets
[2022-04-25 10:57:19] ffmpeg.garage_rear.record      ERROR   : [rtsp @ 0x5654bc95d6c0] max delay reached. need to consume packet
[2022-04-25 10:57:19] ffmpeg.garage_rear.record      ERROR   : [rtsp @ 0x5654bc95d6c0] RTP: missed 1 packets
[2022-04-25 10:57:19] ffmpeg.garage_rear.record      ERROR   : [rtsp @ 0x5654bc95d6c0] max delay reached. need to consume packet
[2022-04-25 10:57:19] ffmpeg.garage_rear.record      ERROR   : [rtsp @ 0x5654bc95d6c0] RTP: missed 1 packets
[2022-04-25 10:57:19] ffmpeg.garage_rear.record      ERROR   : [rtsp @ 0x5654bc95d6c0] max delay reached. need to consume packet
[2022-04-25 10:57:19] ffmpeg.garage_rear.record      ERROR   : [rtsp @ 0x5654bc95d6c0] RTP: missed 1 packets
[2022-04-25 10:57:19] ffmpeg.garage_rear.record      ERROR   : [h264 @ 0x5654bc961740] left block unavailable for requested intra mode
[2022-04-25 10:57:19] ffmpeg.garage_rear.record      ERROR   : [h264 @ 0x5654bc961740] error while decoding MB 0 36, bytestream 915095
[2022-04-25 10:57:19] ffmpeg.garage_rear.record      ERROR   : [mp4 @ 0x5654bc9a0080] Invalid segment filename template '/tmp/cache/garage_rear-%Y%m%d%H%M%S.mp4'
[2022-04-25 10:57:19] ffmpeg.garage_rear.record      ERROR   : Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
[2022-04-25 10:57:19] ffmpeg.garage_rear.record      ERROR   : 
stu1811 commented 2 years ago

Any other suggestions?

george-asda commented 2 years ago

I had similar errors displayed in ffprobe and eradicated them with -rtsp_transport tcp which has helped a great deal. It's a wifi camera though so a much worse signal than I'd expect with PoE. Also the distortion was visible through VLC and the live frigate playback so not quite the same, but worth a shot.

stu1811 commented 2 years ago

I had similar errors displayed in ffprobe and eradicated them with -rtsp_transport tcp which has helped a great deal. It's a wifi camera though so a much worse signal than I'd expect with PoE. Also the distortion was visible through VLC and the live frigate playback so not quite the same, but worth a shot.

The tcp flag fixed my issue. Thanks!