Installing Frigate NVR On the Raspberry Pi

In this project, we will show you how to Install Frigate NVR on your Raspberry Pi.

Raspberry Pi Frigate NVR

Frigate is an open-source and free network video recorder that can process your camera streams in real-time.

While the Raspberry Pi isn’t the most powerful device, it can handle a couple of cameras on Frigate. Additionally, combining the Pi with a Coral accelerator can even run AI models on your streams.

Frigate will integrate nicely with Home Assistant if you have that and MQTT installed on your Raspberry Pi.

Over the following sections, we will show you how to install Frigate on your Raspberry Pi and configure it to utilize hardware acceleration.

For the best experience with Frigate, we highly recommend using a Raspberry Pi 4. It is highly recommended that you invest in a Coral TPU, as that will substantially improve the performance of Frigate on your Pi.

Before continuing with this tutorial, be sure to taper your expectations. The Raspberry Pi will only be able to handle a couple of cameras if they use the H264 codec. H265 will cause significant slowdowns as there is no hardware acceleration for that codec on the Pi.

Equipment

Below is the equipment we used to set up Frigate NVR on our Raspberry Pi.

Recommended

Optional

This tutorial was tested on a Raspberry Pi 400, running the latest version of Raspberry Pi OS Bullseye.

Installing Frigate NVR on the Raspberry Pi

In the following section, you will learn how to install Frigate NVR and get it to run on your Raspberry Pi.

Installing the software will is a relatively straightforward process. However, configuring Frigate NVR takes some time and reading.

Preparing your Raspberry Pi for Frigate

1. Our first step is to ensure we have an up-to-date system to work off.

You can upgrade all existing packages and update the package list by using the following two commands.

sudo apt update
sudo apt upgrade -y

2. Next, follow our guide on installing Docker on the Raspberry Pi.

Docker makes running Frigate a super straightforward process. You can install Docker by running the following command.

3. Once you have Docker installed, you can continue with this guide.

Increasing GPU Memory Allocation

4. Frigate can be more demanding on the Raspberry Pi’s GPU allocation, so you must increase it from the default value of 64.

To change this value, you must open the Raspberry Pi configuration tool.

sudo raspi-config

5. Next, navigate down to and open the “4 Performance Options” menu.

You can navigate these menus using the ARROW keys to move around and the ENTER key to select the option.

6. Once in this menu, select the “P2 GPU Memory” option. This option will allow you to specify the memory that the Raspberry Pi will allocate to the GPU.

7. Now specify the memory allocated to your Raspberry Pi’s GPU.

The Frigate NVR team recommends that you should at least set the value to “128“, but you can increase this up to “256“.

Once you have entered the new value, press the ENTER key.

8. If prompted to restart, select “<Yes>” to continue. Alternatively, run the following command to restart your Raspberry Pi.

Creating Directories for Frigate NVR

9. Our next step is to create a directory to store our docker-compose file for Frigate on our Raspberry Pi.

We will be creating this directory by using the mkdir command. It will be called “frigate-nvr” and stored within the current user’s home directory.

mkdir ~/frigate-nvr

10. Next, we will create a directory for Frigate NVR to store its data on our Raspberry Pi.

If you want your data to be stored on a mounted drive or a network drive, mount it before continuing with this guide and note the mount point.

mkdir ~/frigate-nvr/storage

Writing a Basic Config File for Frigate NVR On your Raspberry Pi

11. For Frigate NVR to run on your Raspberry Pi, it does require a basic configuration file to be created. You will need your camera to be set up and with a readable input stream.

We can begin writing this configuration file by using the command below.

nano ~/frigate-nvr/config.yml

12. Within this file, you will want to start with a basic configuration you can add to as you grow your NVR setup. We won’t be delving too much into this as it can get complicated and is out of the scope of this install guide.

We have included the “hwaccel” tag so that Frigate NVR on your Raspberry Pi will use hardware acceleration when dealing with h264 streams.

If you want to learn more about configuring Frigate NVR, check out their official guides. Particular cameras will require additional settings to work within Frigate.

mqtt:
  enabled: False

ffmpeg:
  hwaccel_args: preset-rpi-64-h264 #Enable Hardware Acceleration

cameras:
  name_of_your_camera: #Name for your comment
    ffmpeg:
      inputs:
        - path: rtsp://10.0.10.10:554/rtsp #The Stream you want to monitor
          roles:
            - detect
    detect:
      enabled: False # Detection is disabled
      width: 1280 # The Cameras resolution
      height: 720 # The Cameras resolution

13. Once you have filled out this configuration file, save and quit by pressing CTRL + X, then Y, followed by the ENTER key.

Setting up the Docker Compose File

14. Our next step is to write a compose file for Docker to manage Frigate NVR on the Raspberry Pi.

Begin writing this file by using the following command in the terminal.

nano ~/frigate-nvr/docker-compose.yml

15. Within this file, type out the following lines.

Ensure that you replace “<USERNAME>” with the name of your user. Additionally, you will want to replace “<PASSWORD>” with a password of your choosing.

Also, you can change “/home/<USERNAME>/frigate-nvr/storage” to point to where you want Frigate to store its recordings on your Raspberry Pi.

version: "3.9"
services:
  frigate:
    container_name: frigate
    privileged: true # this may not be necessary for all setups
    restart: unless-stopped
    image: ghcr.io/blakeblackshear/frigate:stable
    shm_size: "64mb"
    devices:
      - /dev/bus/usb:/dev/bus/usb #Used for Coral if Available
      - /dev/video10 #Map the Pi hardware acceleration
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /home/<USERNAME>/frigate-nvr/config.yml:/config/config.yml
      - /home/<USERNAME>/frigate-nvr/storage:/media/frigate
      - type: tmpfs #Remove this if using a Pi with 2GB or Less RAM
        target: /tmp/cache
        tmpfs:
          size: 1000000000
    ports:
      - "5000:5000"
      - "8554:8554" # RTSP feeds
      - "8555:8555/tcp" # WebRTC over tcp
      - "8555:8555/udp" # WebRTC over udp
    environment:
      FRIGATE_RTSP_PASSWORD: "<PASSWORD>"

16. With the file filled out, save and quit by pressing CTRL + X, followed by Y, then the ENTER key.

Launching Frigate NVR On your Raspberry Pi

17. We now need to ensure that we are in the directory where we wrote the Docker compose file earlier.

To change to this directory, use the following command.

cd ~/frigate-nvr

18. Now that we are in the right place, we can bring Frigate NVR online on our Raspberry Pi by using the command below.

After running this command, Docker will download Frigate’s container and start it up immediately.

docker compose up -d

By using the “-d” option we are telling Docker to start the application detached. If for some reason Frigate didn’t launch, try removing this option to view the logs from Frigate.

Accessing the Frigate NVR Web Interface

19. You will now have Frigate NVR up and running on your Raspberry Pi.

You will now want to access its web interface by going to the following address in your web browser. Ensure you replace “<RASPBERRYPIIP>” with the IP of your device.

http://<RASPBERRYPIIP>:5000

20. You should now see a screen similar to the one below.

As the black screen indicates, we haven’t configured our camera correctly yet. If you see something similar, you will need to adjust your settings.

Frigate NVR Web Interface on the Raspberry Pi

Conclusion

You should now have Frigate NVR on the Raspberry Pi at this point in the tutorial.

While the Raspberry Pi can’t process too many video feeds, it is helpful if you only need to manage a couple of cameras. Pairing the Pi with a Coral Accelerator will even let you perform AI detections on a video feed.

Please comment below if you have questions about getting Frigate NVR to run on your device.

If you found this tutorial useful, be sure to check out our many other Raspberry Pi projects.

5 Comments

  1. Avatar for Alex
    Alex on

    Another question sorry, if I use an old laptop such as Dell XPS15 would I still need something like the Coral TPU, or is that mainly for RPis?

  2. Avatar for Alex
    Alex on

    How is it like on a Pi5? Or shall I get a mini pc for this, what spec and I looking for exactly? I don’t need a powerful graphics card right?

    1. Avatar for Emmet
      Emmet on
      Editor

      Hi Alex,

      You can definitely get away with a Raspberry Pi 5 but if you want to use AI detections something like the Coral TPU is a must.

      On the case of wanting to use your old laptop instead, I would still highly recommend a Coral TPU as it significantly reduces the processing requirement when dealing with AI detections.

      Please let me know if that helps answer your question.

      Kind regards,
      Emmet

  3. Avatar for Galo Aguirre
    Galo Aguirre on

    Worked like a charm! is there a linke where I can buy you a coffee or beer or something?

    thanks again, have a good one!

    1. Avatar for Emmet
      Emmet on
      Editor

      Hi Galo,

      Glad to hear that this worked perfectly for you. If you are interested in supporting us we do offer a “Premium” which gives you ad-free access to the website.

      Kind regards,
      Emmet

Leave a Reply

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