question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stuttery Clips and Recordings

See original GitHub issue

Describe the bug When reviewing the clips and recordings from cameras, the video is not ‘smooth’; there is some stuttering that can be seen where the video slows for a split second, then quickly speeds up to catch up to the current frame.

5 total high-resolution cameras are in my setup, each 30 FPS. The stuttering can be seen in both highres and lowres streams. I have RTMP re-streams from frigate set for the low-res camera inputs for each. The high-res streams are used for clips, snapshots, and detect (5 FPS as suggested). Nothing else runs on this VM besides rsync backups of clip files every so often. Frigate is connected to home assistant via customer component.

I give a LOT of resources to this VM… 12 CPU cores and 18GB of RAM. I also don’t notice any of this stuttering in the stream direct from the cameras.

Any help in troubleshooting this annoying issue would be extremely helpful. Thank you for this wonderful project it was so easy to get going!

Version of frigate 0.8.4-5043040

Config file Include your full config file wrapped in triple back ticks.

  coral:
    type: edgetpu
    device: usb

mqtt:
  host: XXX.XXX.XX.XX
  topic_prefix: frigate
  user: frigate
  password: <password>

ffmpeg:
  input_args:
    - -avoid_negative_ts
    - make_zero
    - -fflags
    - nobuffer
    - -flags
    - low_delay
    - -strict
    - experimental
    - -fflags
    - +genpts+discardcorrupt
    - -rw_timeout
    - '5000000'
    - -use_wallclock_as_timestamps
    - '1'

objects:
  track:
    - person
    - bicycle
    - car
    - truck
    - cat
    - dog
  filters:
    person:
      min_score: 0.5
      threshold: 0.65
    bicycle:
      min_score: 0.5
      threshold: 0.7
    car:
      min_score: 0.5
      threshold: 0.7
    truck:
      min_score: 0.5
      threshold: 0.7
    dog:
      min_score: 0.5
      threshold: 0.7
    cat:
      min_score: 0.5
      threshold: 0.7

record:             
  enabled: True                                                 
  retain_days: 60                 
                    
cameras:                                                        
  doorbell:                       
    ffmpeg:          
      input_args:                                               
        - -avoid_negative_ts      
        - make_zero                                             
        - -flags     
        - low_delay               
        - -strict   
        - experimental  
        - -fflags                 
        - +genpts+discardcorrupt
        - -rtsp_transport
        - tcp                     
        - -stimeout             
        - '5000000'      
        - -use_wallclock_as_timestamps
        - '1'                   
      inputs:               
        - path: rtsp://<user>:<pass>@192.168.xx.xx:554/h264/ch01/main/av_stream
          roles:                
            - clips               
#            - rtmp                                                           
            - detect            
        - path: rtsp://<user>:<pass>@192.168.xx.xx:554/h264/ch01/sub/av_stream
          roles:                                                              
            - record            
            - rtmp                                                           
    width: 1536                                                               
    height: 2048                
    fps: 5                                                                   
                                                                              
    mqtt:                       
      enabled: True                                                          
      timestamp: False                                                        
      bounding_box: True        
      crop: True                                                             
      height: 1080                                                            
                                
    motion:                                                                  
      mask:                                                                   
        - 0,1262,523,1182,710,1189,1142,1198,1139,1332,1536,1383,1536,0,0,0
        - 476,1817,1058,1814,1050,1770,473,1771                              
                                                                              
    zones:                                                                 
      walkway:                                                               
        coordinates: 701,1477,629,1638,1103,1696,1132,1492                    
                                                                           
    objects:                                                                 
      track:                                                                  
        - person                                                           

    objects:                                                                  
      track:                                                               
        - person                                                                                                         
                                                                              
    clips:                                                                                                              
      enabled: True                                                                                                      
      pre_capture: 2                                                          
      post_capture: 2                                                                                                   
                                                                                                                         
    snapshots:                                                                
      enabled: True                                                                                                     
      timestamp: False                                                                                                   
      bounding_box: True                                                      
      crop: False                                                                                                       
                                                                                                                         
  frontyard1:                                                                 
    ffmpeg:                                                                                                             
      inputs:                                                                                                            
        - path: rtmp://192.168.xx.xx/bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password={FRIGATE_RTSP_PASSWORD}
          roles:                                                                                                        
            - detect                                                                                                     
            - clips                                                           
#            - rtmp                                                                                                     
        - path: rtmp://192.168.xx.xx/bcs/channel0_sub.bcs?channel=0&stream=0&user=admin&password={FRIGATE_RTSP_PASSWORD} 
          roles:                                                              
            - record                                                                                                    
            - rtmp                                                                                                       
    width: 2560                                                               
    height: 1920                                                                                                        
    fps: 10                                                                                                              
                                                          
    mqtt:                                                                                                               
      enabled: True                                                                                                      
      timestamp: False                                                        
      bounding_box: True                                                                                                
      crop: True                                                                                                         
      height: 1080                                                            
                                                                                                                        
    objects:                                                                                                             
      track:                                                                  
        - person                                                                                                        
        - cat                                                                                                            
        - dog                                                                 
        - bicycle                                                                                                       
                                                                                                                         
    motion:                                                                   
      mask:                                                                                                             
        - 0,0,1186,0,744,198,0,670                                                                                       
        - 0,1899,765,1899,757,1832,0,1834                                     
                                                                                                                        
    zones:                                                                                                               
      walkway:                                                                                                           
        coordinates: 2087,1249,2384,842,2124,418,1849,328                                                               
      driveway:                                                                                                          
        coordinates: 2560,580,2560,263,1817,58,1473,0,1129,0,743,150,1101,188,1867,334

    clips:                                                                                                              
      enabled: True                                                                                                      
      pre_capture: 2                                                                                                     
      post_capture: 2                                                                                                   
                                                                                                                         
    snapshots:                                                                                                           
      enabled: True                                                                                                     
      timestamp: False                                                                                                   
      bounding_box: True                                                                                                 
      crop: False                                                                                                       
                                                                                                                         
  frontyard2:                                                                                                            
    ffmpeg:                                                                                                             
      inputs:                                                                                                            
        - path: rtmp://192.168.xx.xx/bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password={FRIGATE_RTSP_PASSWORD}
          roles:                                                                                                        
            - detect                                                                                                     
            - clips                                                                                                      
#            - rtmp                                                                                                      
        - path: rtmp://192.168.xx.xx/bcs/channel0_sub.bcs?channel=0&stream=0&user=admin&password={FRIGATE_RTSP_PASSWORD}
          roles:                                                                                                         
            - record                                                                                                    
            - rtmp                                                                                                      
    width: 2560                                                                                                          
    height: 1920                                                              
    fps: 5                                                                                                              
                                                                                                                         
    mqtt:                                                                     
      enabled: True                                                                                                     
      timestamp: False                                                                                                   
      bounding_box: True                                  
      crop: True                                                                                                        
      height: 1080                                                                                                       
                                                                              
    motion:                                                                                                             
      mask:                                                                                                              
        - 1289,864,1561,390,1981,451,1900,1388,1785,1920,2560,1920,2560,0,0,0,0,1307
#        - 594,282,1374,320,2222,485,2384,908,2560,924,2560,0,0,0,0,644                                                 
                                                                                                                         
    zones:                                                                          
      walkway:                                                                                                          
        coordinates: 610,1447,956,1330,1104,1058,552,1153,0,1322,0,1654                                                  
      driveway:                                                                     
        coordinates: 1840,1920,1984,376,1594,321,964,1371,582,1920                                                      
                                                                                                                         
    clips:                                                                          
      enabled: True                                                                                                     
      pre_capture: 2                                                                                                     
      post_capture: 2                                                               
                                                                                                                        
    snapshots:                                                                                                           
      enabled: True                                                                                                      
      timestamp: False                                                                                                  
      bounding_box: True                                                                                                 
      crop: False                 

  backyard1:                                                                                                             
    ffmpeg:                                                                                                             
      inputs:                                                                                                            
        - path: rtmp://192.168.xx.xx/bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password={FRIGATE_RTSP_PASSWORD}
          roles:                                                                                                        
            - detect                                                                                                     
            - clips                                                                                                      
#            - rtmp                                                                                                     
        - path: rtmp://192.168.xx.xx/bcs/channel0_sub.bcs?channel=0&stream=0&user=admin&password={FRIGATE_RTSP_PASSWORD} 
          roles:                                                                                                         
            - record                                                                                                    
            - rtmp                                                                                                       
    width: 2560                                                                                                          
    height: 1920                                                                                                        
    fps: 5                                                                                                               
                                                                                                                         
    mqtt:                                                                                                               
      enabled: True                                                                                                      
      timestamp: False                                                                                                   
      bounding_box: True                                                                                                 
      crop: True                                                                                                        
      height: 1080                                                                                                       
                                                                                                                        
    motion:                                                                                                             
      mask:                                                                                                              
        - 1785,251,955,0,2560,0,2560,573,2560,1920,2560,1920,2375,1920,2380,707,2354,503
        - 607,0,0,0,0,146                                                                                               
                                                                                                                         
    zones:                                                                              
      patio:                                                                                                            
        coordinates: 1457,1419,1060,1920,0,1920,0,720,171,628                                                            
                                                                                        
    objects:                                                                                                            
      track:                                                                                                             
        - person                                                                        
        - cat                                                                                                           
        - dog                                                                                                            
        - bicycle                                                                       
                                                                                                                        
    clips:                                                                                                               
      enabled: True                                                                     
      pre_capture: 2                                                                                                    
      post_capture: 2                                                                                                    
                                                                                        
    snapshots:                                                                                                          
      enabled: True                                                                                                      
      timestamp: False                                                                  
      bounding_box: True                                                                                                
      crop: False                                                                                

     backyard2:                                                                                                             
    ffmpeg:                                                                                                              
      inputs:                                                                                                           
        - path: rtmp://192.168.xx.xx/bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password={FRIGATE_RTSP_PASSWORD}
          roles:                                                                                                         
            - detect                                                                                                    
            - clips                                                                                                      
#            - rtmp                                                                                                      
        - path: rtmp://192.168.xx.xx/bcs/channel0_sub.bcs?channel=0&stream=0&user=admin&password={FRIGATE_RTSP_PASSWORD}
          roles:                                                                                                         
            - record                                                                                                     
            - rtmp                                                                                                       
    width: 2560                                                                                                          
    height: 1920                                                                                                         
    fps: 5                                                                                                              
                                                                                                                         
    mqtt:                                                                                                                
      enabled: True                                                                                                     
      timestamp: False                                                                                                   
      bounding_box: True                                                                                                 
      crop: True                                                                                                        
      height: 1080                                                                                                       
                                                                                                                         
    motion:                                                                                                             
      mask:                                                                                                              
        - 768,1894,761,1833,0,1837,0,1898                                                                                
                                                                                                                        
    zones:                                                                                                               
      patio:                                                                                                             
        coordinates: 2508,0,2457,578,2180,474,1999,1032,857,488,1231,0                                                  
      garage_walkway:                                                                                                    
        coordinates: 1968,1920,2307,1170,2457,604,2186,501,2015,1040,1495,1920                                           
                                                                                                                        
    objects:                                                                                                             
      track:                                                                                                             
        - person                                                                                                        
        - cat                                                                                                            
        - dog                                                                                                            
        - bicycle                                                                                                       
                                                                                                                         
    clips:                                                                                                               
      enabled: True                                                                                                     
      pre_capture: 2                                                                                                     
      post_capture: 2                                                                                                    
                                                                                                                         
    snapshots:                                                                                                           
      enabled: True                                                                                                      
      timestamp: False                                                                                                   
      bounding_box: True                                                                                                 
      crop: False                           

Frigate container logs

 * Starting nginx nginx
   ...done.
Starting migrations
peewee_migrate                 INFO    : Starting migrations
There is nothing to migrate
peewee_migrate                 INFO    : There is nothing to migrate
detector.coral                 INFO    : Starting detection process: 49
frigate.app                    INFO    : Camera processor started for doorbell: 52
frigate.app                    INFO    : Camera processor started for frontyard1: 53
frigate.app                    INFO    : Camera processor started for frontyard2: 55
frigate.app                    INFO    : Camera processor started for backyard1: 68
frigate.app                    INFO    : Camera processor started for backyard2: 92
frigate.app                    INFO    : Capture process started for doorbell: 93
frigate.app                    INFO    : Capture process started for frontyard1: 105
frigate.app                    INFO    : Capture process started for frontyard2: 108
frigate.app                    INFO    : Capture process started for backyard1: 112
frigate.app                    INFO    : Capture process started for backyard2: 119
frigate.mqtt                   INFO    : MQTT connected
frigate.edgetpu                INFO    : Attempting to load TPU as usb
frigate.edgetpu                INFO    : TPU found

Frigate stats

  "backyard1": {
    "camera_fps": 5.0, 
    "capture_pid": 112, 
    "detection_fps": 10.5, 
    "pid": 68, 
    "process_fps": 3.9, 
    "skipped_fps": 0.0
  }, 
  "backyard2": {
    "camera_fps": 5.1, 
    "capture_pid": 119, 
    "detection_fps": 8.0, 
    "pid": 92, 
    "process_fps": 4.6, 
    "skipped_fps": 0.0
  }, 
  "detection_fps": 28.4, 
  "detectors": {
    "coral": {
      "detection_start": 1615314836.569279, 
      "inference_speed": 29.2, 
      "pid": 12242
    }
  }, 
  "doorbell": {
    "camera_fps": 5.0, 
    "capture_pid": 93, 
    "detection_fps": 3.5, 
    "pid": 52, 
    "process_fps": 5.0, 
    "skipped_fps": 0.0
  }, 
  "frontyard1": {
    "camera_fps": 10.1, 
    "capture_pid": 105, 
    "detection_fps": 6.4, 
    "pid": 53, 
    "process_fps": 9.0, 
    "skipped_fps": 0.0
  }, 
  "frontyard2": {
    "camera_fps": 5.0, 
    "capture_pid": 108, 
    "detection_fps": 0.0, 
    "pid": 55, 
    "process_fps": 5.0, 
    "skipped_fps": 0.0
  }, 
  "service": {
    "storage": {
      "/dev/shm": {
        "free": 3143.2, 
        "mount_type": "tmpfs", 
        "total": 3221.2, 
        "used": 78.1
      }, 
      "/media/frigate/clips": {
        "free": 2781252.2, 
        "mount_type": "ext4", 
        "total": 2951816.1, 
        "used": 20548.2
      }, 
      "/media/frigate/recordings": {
        "free": 2781252.2, 
        "mount_type": "ext4", 
        "total": 2951816.1, 
        "used": 20548.2
      }, 
      "/tmp/cache": {
        "free": 641.8, 
        "mount_type": "tmpfs", 
        "total": 1000.0, 
        "used": 358.2
      }
    }, 
    "uptime": 12772, 
    "version": "0.8.4-5043040"
  }
}

FFprobe from your camera

Run the following command and paste output below

ffprobe http://192.168.20.21:5001/api/backyard1
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, mpjpeg, from 'http://192.168.20.21:5001/api/backyard1':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 480x360 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc

ffprobe http://192.168.20.21:5001/api/doorbell
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, mpjpeg, from 'http://192.168.20.21:5001/api/doorbell':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 270x360 [SAR 1:1 DAR 3:4], 25 tbr, 25 tbn, 25 tbc

Computer Hardware

  • OS: Alpine Linux
  • Install method: Docker Compose
  • Virtualization: Proxmox VM
  • Coral Version: USB
  • Network Setup: Wired]

Camera Info:

  • Manufacturer: 4x Reolink RLC-420-5MP, 1x Laview Halo One (doorbell cam)
  • Model: (unknown for Halo One)
  • Resolution: [e.g. 720p] multiple
  • FPS: [e.g. 5] multiple

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:19 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
extincommented, May 7, 2021

Update: I was able to get smooth video clips after omitting all ffmpeg input args but “- -avoid_negative_ts make_zero”

Edit: forgot to mention that I tested the input parameters directly with ffmpeg copy to drive of the RTMP main stream. I’m pretty confident that this is a ffmpeg issue rather than issue in Frigate.

0reactions
stale[bot]commented, Jun 9, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix Choppy or Jerky Videos playback smoothly?
This post highlights some of the common reasons that lead to choppy videos and shares how to fix choppy video recordings using 8...
Read more >
Why do all my recorded clips have that stutter? Happens ...
The stuttering and freezing occurs every few seconds, particularly in scenes where there is fast action happening. Actual gameplay is unaffected ...
Read more >
7 Proven Ways to Fix OBS Stuttering
Part 2: How to Fix the "OBS Recording Stuttering" Issue? · 1. Run OBS in Admin Mode · 2. Improve Frame Rate ·...
Read more >
Audio and image stuttering/halting/jumping (whatever you ...
I have audio and image stuttering/halting/jumping (whatever you want to call it) when trying to edit videos in Camtasia 9. These are vids...
Read more >
Video recording stuttering | XDA Forums
Lately I have observed that capturing videos on my phone is lagging a lot and has huge FPS drops. ... Video recording stuttering....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found