Reolink 4k cameras with Frigate, Home Assistant and 24 hour recording

As I ranted about in this post I really struggled with my Reolink RLC-820A and Reolink RLC-810A cameras with Blue Iris. This was particularly frustrating as so many quality you tubers recommended the cameras and Blue Iris but failed to mention that the two together are not a great combination.

My hardware set up was am Intel i7 NUC with proxmox running HA OS, Windows 10 and Open Media Vault sharing a large external HDD using Samba share. The idea was that Win 10 would run Blue Iris saving streaming video to the hard drive and I would then be able to trigger automations in Home Assistant using MQTT. An alternative was to also use Frigate in Home Assistant for the object recognition and automations and to keep Blue Iris purely for the 24/7 recording.

The problems

  1. I could not get quality streams recoding on Blue Iris despite many attempts
  2. I could not get pass through for a USB coral accelerator which I bought to improve Frigate performance.
  3. I started to get performance issues in Home Assistant due to the extra resources required by Frigate. I probably had my proxmox allocations set up incorrectly.

Under the guidance of Pavol, a very helpful member of the Home Assistant Face Book group, I decided to go down a different path:

Use Frigate and forget Blue iris!

The main benefit of this is that I no longer need Windows 10 on the NUC, allowing me to install Home Assistant without using Proxmox, making it much easier to access the Coral accelerator, for example.

However an issue with Frigate when it is installed in Home Assistant supervisor is that the video is saved to the media folder and not to a USB or SAMBA drive. This meant the the best method for me was to install Frigate not on supervisor, but on Portainer on the same machine that runs home assistant. So these were the steps.

 

 

      1. Install the beta firmware on the reolink cameras by contacting reolink support. This may not be necessary now as they may have changed their firmware. The cameras will only wrk on Frigate up to 2.7k not the full 4k, again this may be fixed by the time you read this. Here are my Reolink settings for your guide:
      2. Backup home assistant and copy the files somewhere safe
      3. Wipe the entire NUC
      4. Instal Debian 11 on the NUC
      5. Install cockpit for easy access to Debian using SSH and Terminal
      6. Share USB hard drive connected to the NUC using SAMBA on Cockpit
      7. Install Home assistant Supervised on Debian
      8. Restore backup of home assistant and test
      9. Remove Portainer from home assistant supervisor if you use it (I had it to run the excellent RAKOMQTT)
      10. Install Portainer on Debian
      11. Create a stack in Portainer for Frigate
        My one, for guide looks like this, you will need to change the source to where you want to save the video stream

        version: "3.9"
        volumes:
          config:  
        services
          frigate:
            container_name: frigate
            privileged: true # this may not be necessary for all setups
            restart: unless-stopped
            image: blakeblackshear/frigate:0.9.0-rc3-amd64
            shm_size: "256mb" # update for your cameras using formula: (2560 width * 1440 height * 1.5 * 9 + 270480)/1048576 * 4 cameras = 190 ~= 256
            devices:
            - /dev/bus/usb:/dev/bus/usb
              - /dev/dri/renderD128 # for intel hwaccel, needs to be updated for your hardware
            volumes:
              - /etc/localtime:/etc/localtime:ro
              - config:/config:ro
              - source: /mnt/HDD_10TB/Frigate
                target: /media/frigate
                type: bind
              - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
                target: /tmp/cache
                tmpfs:
                  size: 1000000000
            ports:
              - "5000:5000"
              - "1935:1935" # RTMP feeds
        
        
      12. created a config.yml file in /var/lib/docker/volumes/frigate_config/_data. My one looks like this for 4 cameras I have changed some passwords for security, your IP addresses for cameras and MQTT client will be different.  I am assuming you already have an MQTT client installed. If you want different objects being detected, cars for example, make sure you add them too and entities for those will be created.
    mqtt:
      host: 192.168.1.11
      user: homeassistant
      password: MQTTPASSWORD
    
    #database:
      #path: /frigate.db
    
    #https://blakeblackshear.github.io/frigate/configuration/advanced#logger
    #logger:
      #default: debug #info
    
    detectors:
      coral:
        type: edgetpu
        device: usb
    
    detect:
      width: 640
      height: 360
      fps: 7
    
    objects:
      track:
        - person
        - dog
      filters: 
        person: 
          # Optional: minimum width*height of the bounding box for the detected object (default: 0) 
          min_area: 8000 
          # Optional: maximum width*height of the bounding box for the detected object (default: 24000000) 
          #max_area: 100000 
          # Optional: minimum score for the object to initiate tracking (default: 0.5) 
          #min_score: 0.5 
          # Optional: minimum decimal percentage for tracked object's computed score to be considered a true positive (default: 0.7) 
          threshold: 0.75
    record: 
      enabled: True 
      retain_days: 30 
      events: 
        max_seconds: 300 
        pre_capture: 10 
        post_capture: 10 
        retain: 
          default: 30 
    snapshots: 
      enabled: True 
      timestamp: True 
      bounding_box: True 
      crop: True 
      retain: 
        default: 30 
    rtmp: 
      enabled: True 
    birdseye: 
      enabled: True 
      width: 1280 
      height: 720 
      quality: 8 
      mode: continuous #objects #motion 
       
    timestamp_style: 
      format: "%m.%d.%Y %H:%M:%S"
    
    ffmpeg: 
      global_args: -hide_banner -loglevel warning #panic #info 
      hwaccel_args: 
        -hwaccel qsv -qsv_device /dev/dri/renderD128 
      #input_args: #https://ffmpeg.org/ffmpeg-formats.html 
        #-avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1 
      output_args: 
        #detect: -f rawvideo -pix_fmt yuv420p 
        record: -f segment -segment_time 60 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy #-an removed to hear sound 
        #rtmp: -c copy -f flv
    cameras: 
      front: #REOLINK RLC-810A 
        ffmpeg: 
          inputs: 
            - path: rtsp://USERNAME:PASSWORD@192.168.1.22:554//h264Preview_01_sub 
              roles: 
                - detect 
                - rtmp 
            - path: rtsp://USERNAME:PASSWORD@192.168.1.22:554/          
              roles: 
                - record 
      gate: #REOLINK RLC-820A  
        ffmpeg: 
          inputs: 
            - path: rtsp://USERNAME:PASSWORD@192.168.1.21:554//h264Preview_01_sub 
              roles: 
                - detect 
                - rtmp 
            - path: rtsp://USERNAME:PASSWORD@192.168.1.21:554/           
              roles:  
                - record
      side: #REOLINK RLC-810A  
        ffmpeg: 
          inputs: 
            - path: rtsp://USERNAME:PASSWORD@192.168.1.23:554//h264Preview_01_sub 
              roles: 
                - detect 
                - rtmp 
            - path: rtsp://USERNAME:PASSWORD@192.168.1.23:554/           
              roles:  
                - record
      back: #REOLINK RLC-820A  
        ffmpeg: 
          inputs: 
            - path: rtsp://USERNAME:PASSWORD@192.168.1.24:554//h264Preview_01_sub 
              roles: 
                - detect 
                - rtmp 
            - path: rtsp://USERNAME:PASSWORD@192.168.1.24:554/           
              roles:  
                - record
    

    12. Install Frigate NVR Proxy on Supervisor to give entities in Home Assistant

    That should pretty much be it! 4 cameras all streaming to the HDD with entities for persons detected at each camera. I can recommend Frigate HASS card to display on Lovelace.

  1. Here is a sample automation to send me a message to my phone if a person is at the gate.
  action:
  - service: notify.mobile_app_petes_12
    data:
      title: Gate notification
      message: Person at gate
      data:
        entity_id: camera.gate_person
  - service: notify.mobile_app_pete_s_ipad_pro
    data:
      data:
        entity_id: camera.gate_person
      message: Person at gate
      title: Gate notification
  mode: single

Thank you again to Pavol for all the help on getting this up and running

6 thoughts on “Reolink 4k cameras with Frigate, Home Assistant and 24 hour recording”

  1. Hi,

    I’m in the same situation .. blueiris IS good but not very satisfied. I also have a nuc7i7bnh but if possible i woule like to install frigate on a debian vm on esxi and save the file to m’y Synology. Could you tell me if you think that it’s a good Idea ?

    1. Sounds like a similar situation to the one that I was in, can’t tell you if it’s a good idea but it worked for me!

  2. Are you recording the full 4K streams 24/7 or the sub-streams? One of the things that Blue Iris does well is allow you to record the sub-streams until triggered and then capture the full stream at that point.

    1. I’m recording full quality because I have a big hard drive but I believe I could record the sub stream and record full quality when triggered. You just need to change the configuration file above.

      I did not play with blue iris for long and it seems more configurable than frigate. However I have all the features I need without having to run a windows 10 machine 24/7.

      1. Hi, I got 6 rlc-810a and trying to get them work with Frigate with too many problems. I suppose al linux based software are problematic with these reolink’s. Can you kindly share the beta firmware? I’m using blueiris and deepstack but it’s not satisfying me much.

Leave a Reply

Your email address will not be published. Required fields are marked *