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.

[0.8.0-rc3] /api/events/<id>/thumbnail.jpg - not cropped during event + missing bounding box

See original GitHub issue

Describe the bug When the event is in progress, the thumbnail endpoint shows full image and is missing the bounding box. After the event has ended, the image is replaced by a cropped version. It would be nice if we could also set to have the bounding box as it was before with the /api/events/<id>/snapshot.jpg endpoint and show this in the Media browser in HA (guessing it uses same endpoint)

Version of frigate 0.8.0-rc3

Config file

detectors:
  coral:
    type: edgetpu
    device: usb

# Required: mqtt configuration
mqtt:
  host: 10.10.1.10
  port: 1883
  topic_prefix: frigate
  client_id: frigate
  user: mqtt_frigate
  password: mqtt_pass_redacted

# Optional: Global configuration for saving clips
clips:
  max_seconds: 300

  tmpfs_cache_size: 512m
  retain:
    default: 7
    objects:
      person: 7

ffmpeg:
  hwaccel_args:
    - -hwaccel
    - vaapi
    - -hwaccel_device
    - /dev/dri/renderD128
    - -hwaccel_output_format
    - yuv420p
    
motion:
  threshold: 35
  contour_area: 100
  delta_alpha: 0.15
  frame_alpha: 0.3


objects:
  track:
    - person
  filters:
    person:
      min_area: 2000
      max_area: 1000000
      min_score: 0.55

detect:
  max_disappeared: 25    

cameras:
  # Required: name of the camera
  entry:
    # Required: ffmpeg settings for the camera
    ffmpeg:
      inputs:
        - path: rtsp://user:pass@10.10.3.242/third
          roles:
            - detect
            - clips

    height: 1080
    width: 1920
    fps: 5

    clips:
      enabled: True
      pre_capture: 3
      post_capture: 3
        
    snapshots:
      enabled: True
      timestamp: True
      bounding_box: True
      height: 1080
      
    mqtt:
      enabled: True
      timestamp: True
      bounding_box: True
      crop: True
      height: 400

    rtmp:
      enabled: False
    
    motion:    
      mask: 4,242,6,5,968,5,969,80,654,139
    
    zones:
      at_door:
        coordinates: 823,890,673,597,686,376,808,241,986,210,1091,37,1232,75,1420,144,1782,309,1656,636,1539,892,1465,973,1056,977
      getting_to_door:
        coordinates: 75,1068,50,792,65,500,269,344,476,258,664,248,818,225,788,249,683,373,669,607,818,894,1063,983,1273,1078,688,1072,311,1066

    objects:
      track:
        - person
        
  frontyard:
    ffmpeg:
      inputs:
        - path: rtsp://user:pass@10.10.3.243/third
          roles:
            - detect
            - clips

    height: 1080
    width: 1920
    fps: 5
    
    rtmp:
      enabled: False
      
    clips:
      enabled: True
      pre_capture: 3
      post_capture: 3
        
    snapshots:
      enabled: True
      timestamp: True
      bounding_box: True
      height: 1080
      
    mqtt:
      enabled: True
      timestamp: True
      bounding_box: True
      crop: True
      height: 400
      
    motion:
      mask: 966,63,969,3,1912,8,1919,236,1756,195,1531,141,1324,95,1166,71
      
    zones:
      driveway:
        coordinates: 6,1072,18,451,147,365,528,307,835,292,1154,288,1495,293,1848,363,1897,456,1902,529,1916,722,1897,919,1895,1055,1297,1066,523,1066
      outside_road:
        coordinates: 4,363,8,239,13,124,160,112,428,86,688,58,893,66,1105,78,1241,119,1327,195,1268,258,1034,297,727,298,447,297,276,317
      

    objects:
      track:
        - person
        
  east:
    ffmpeg:
      inputs:
        - path: rtsp://user:pass@10.10.3.246/third
          roles:
            - detect
            - clips

    height: 1080
    width: 1920
    fps: 5
    
    rtmp:
      enabled: False
      
    clips:
      enabled: True
      pre_capture: 3
      post_capture: 3
        
    snapshots:
      enabled: True
      timestamp: True
      bounding_box: True
      height: 1080
      
    mqtt:
      enabled: True
      timestamp: True
      bounding_box: True
      crop: True
      height: 400
            
    zones:
      east_close:
        coordinates: 900,1075,913,115,1071,47,1222,0,1354,12,1919,15,1919,463,1919,804,1919,1075,1816,1078,1722,1075,1283,1072
        
    objects:
      track:
        - person
        
  north:
    ffmpeg:
      inputs:
        - path: rtsp://user:pass@10.10.3.245/third
          roles:
            - detect
            - clips

    height: 1080
    width: 1920
    fps: 5
    
    motion:
      mask: 1,381,4,0,929,0,930,58
    
    rtmp:
      enabled: False
      
    clips:
      enabled: True
      pre_capture: 3
      post_capture: 3
        
    snapshots:
      enabled: True
      timestamp: True
      bounding_box: True
      height: 1080
      
    mqtt:
      enabled: True
      timestamp: True
      bounding_box: True
      crop: True
      height: 400
            

    objects:
      track:
        - person
        

Logs

Include relevant log output here

Frigate debug stats

{
detection_fps: 0,
detectors: {
coral: {
detection_start: 0,
inference_speed: 12.64,
pid: 34
}
},
east: {
camera_fps: 5.2,
capture_pid: 46,
detection_fps: 0,
pid: 38,
process_fps: 5.2,
skipped_fps: 0
},
entry: {
camera_fps: 5.1,
capture_pid: 42,
detection_fps: 0,
pid: 36,
process_fps: 5.1,
skipped_fps: 0
},
frontyard: {
camera_fps: 5.2,
capture_pid: 43,
detection_fps: 0,
pid: 37,
process_fps: 5.2,
skipped_fps: 0
},
north: {
camera_fps: 4.9,
capture_pid: 47,
detection_fps: 0,
pid: 40,
process_fps: 4.9,
skipped_fps: 0
},
service: {
uptime: 1573,
version: "0.8.0-7b4e510"
}
}


FFprobe from your camera

Run the following command and paste output below

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 --e
nable-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 --enab
le-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-vaapi --extra-cflags=-I/opt/ffmp
eg/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@10.10.3.245/third':                                                                                                       
  Metadata:                                                                                                                                                               
    title           : RTSP/RTP stream from IPNC                                                                                                                           
    comment         : third                                                                                                                                               
  Duration: N/A, start: 0.000000, bitrate: N/A                                                                                                                            
    Stream #0:0: Video: h264, yuvj420p(pc, bt709, progressive), 1920x1080, 25 tbr, 90k tbn, 180k tbc                                                                      
    Stream #0:1: Audio: pcm_mulaw, 8000 Hz, 1 channels, s16, 64 kb/s                                                                                                      
    Stream #0:2: Data: none                                                                                                                                               
Unsupported codec with id 0 for input stream 2   

Screenshots chrome_2021-01-21_14-03-04 chrome_2021-01-21_14-17-17

Computer Hardware

  • OS: Synology DSM 6.2
  • Virtualization: Docker directly on DSM
  • Coral Version: USB
  • Network Setup: Wired

Camera Info:

  • Manufacturer: Milesight
  • Model: MS-C5373-PB
  • Resolution: 1080p
  • FPS: 5

Additional context

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
blakeblackshearcommented, Jan 24, 2021

Thumbnails will never be larger because they are stored in the database. If you want larger images, use the snapshot endpoint. The snapshots will always be from the detect stream. Frigate never decodes the other video streams, so I can’t take a snapshot of them easily.

0reactions
InToSSHcommented, Jan 24, 2021

Tried the new implementation of snapshot.jpg, which allows setting the crop, size and bbox with parameters even during an event and it works beautifully and also the thumbnail during event is now cropped.

Now instead of the thumbnail.jpg I am using this for Telegram notifications: http://10.10.1.2:23500/api/events/{{payload.after.id}}/snapshot.jpg?h=500&crop=1&bbox=1&timestamp=1

Since it’s all resolved now I am gonna go ahead and close this issue. Thank you for your awesome work.

@Halytskyi Frigate can’t process your main stream - well it could, but it would present more overhead and CPU load, which is not a good idea for normal use case. If your camera supports MJPEG or static snapshot endpoints for your main stream I would suggest using an automation and then with Node-Red for example you could grab the full resolution screenshot. You can even go as far as transposing the bounding box from the coordinates provided in the event and drawing your own bounding box on the full resolution screenshot 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: Selection tool is missing bounding box... show bou...
My selection tool is missing the bounding box, i am unable to transform anything. under View where show bounding box is suppost to...
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