Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Help about MediaWiki
FUTO
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Introduction to a Self Managed Life: a 13 hour & 28 minute presentation by FUTO software
(section)
Main Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Step 3: Installing Docker and Setting Up Frigate with Specific Version 0.13.2 == Frigate is a lovely network video recorder. Next, we’re going to clone the Frigate repository. I’m going to download Frigate, but I’m using the old version of Frigate rather than the new version. I’ll show you why once I’m done installing. The new version, in my opinion, took a well thought through user interface and destroyed it. I don’t mean minor changes; think Amber Heard doing plastic surgery on Johnny Depp. It’s that bad. Johnny Depp would still look better after that than Frigate looked from 0.13 —> 0.14. That’s what happened to Frigate from version 0.13 to 0.14. They destroyed it. You can’t even view events for more than one day at a time. It’s horrifically bad. I’m downloading an old version, and I’ll show you the differences so you can decide for yourself. The setup routines are IDENTICAL with regards to configuring alerts in Home Assistant, etc. This project still deserves donations, purchases, & funding for how good Frigate 0.13 is, as well as thanks & praise for keeping it open source so we even HAVE the option to use older versions. <span id="install-docker"></span> ==== 3.1 Install Docker ==== <ol style="list-style-type: decimal;"> <li><p>'''Verify Existing Docker Installation:'''</p> <p>Run the command to check if Docker is installed: <code>docker --version</code>. Make sure the version is 24.0.0 or later. If it’s an older version, remove it by using:</p> <pre>sudo apt remove docker docker-engine docker.io containerd runc</pre></li> <li><p>'''Install the Latest Version of Docker:'''</p> <p>Download and install Docker using the official installation script. Run:</p> <pre>curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh</pre></li></ol> <blockquote>'''Note:''' Use the official Docker installation, not the Snap version. The Snap version is [https://www.reddit.com/r/docker/comments/shztqs/wow_docker_works_a_lot_better_when_you_dont_have/ ''horrible''] & causes tons of issues. If you got tricked into installing Docker at the end of the Ubuntu server installation prompts, I am sorry, but you have to remove that, it’s garbage. Run <code>sudo snap remove docker</code> and never look back. </blockquote> <ol start="3" style="list-style-type: decimal;"> <li><p>'''Install Docker Compose:'''</p> <pre>sudo apt install docker-compose-plugin -y</pre></li> <li><p>'''Verify Docker Compose Installation:'''</p></li> <li><p>Make sure Docker Compose version is 2.0 or higher by running:</p> <pre>docker compose version</pre></li> <li><p>'''Set Proper Permissions for Docker:'''</p> <ul> <li><p>Docker typically requires root permissions, but you can add your user to the Docker group to avoid using <code>sudo</code>. Run:</p> <pre>sudo usermod -aG docker $USER</pre></li> <li><p>Log out and log back in, or run:</p> <pre>newgrp docker</pre></li></ul> </li></ol> <span id="install-frigate"></span> ==== 3.2 Install Frigate ==== <ol style="list-style-type: decimal;"> <li><p>'''Create a Directory for Frigate:'''</p> <ul> <li><p>Run the following command to create a directory to store Frigate files:</p> <pre>mkdir -p /home/$USER/Downloads/programs cd ~/Downloads/programs</pre></li></ul> </li> <li><p>'''Clone the Frigate Repository:'''</p> <ul> <li><p>Clone the Frigate GitHub repository by running:</p> <pre>git clone https://github.com/blakeblackshear/frigate.git cd frigate</pre></li></ul> </li> <li><p>'''Set Up Docker Compose for Frigate:'''</p> <ul> <li><p>Create and edit the <code>docker-compose.yml</code> file. '''Make sure it specifies Frigate version 0.13.2. New versions use a horrible user interface that is [https://www.youtube.com/watch?v=uiFLqqKkj3M&t=117s rage inducing.]''' My example file below specifies version 0.13.2 for you. You’ll need to set the container name, restart policy, image version, shared memory size, devices (e.g., USB Coral, PCIe Coral, video device for Raspberry Pi), and volumes for storing local time, config files, media, and cache. Be sure to open necessary ports (e.g., 5000, 8971, 8554, 8555).</p></li> <li><p>*'''If any of what I said''' in the last bulletpoint after the “rage inducing” part '''confuses the hell out of you''', don’t worry: you have the easiest path there is; '''JUST COPY AND PASTE BELOW WITHOUT MESSING WITH IT!'''</p></li></ul> </li></ol> <pre>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:0.13.2 # Last good version shm_size: "64mb" # Update for your cameras based on requirements devices: - /dev/bus/usb:/dev/bus/usb # USB Coral, modify for other hardware - /dev/apex_0:/dev/apex_0 # PCIe Coral, modify based on your setup - /dev/video11:/dev/video11 # For Raspberry Pi 4B - /dev/dri/renderD128:/dev/dri/renderD128 # Intel hwaccel, update for your hardware volumes: - /etc/localtime:/etc/localtime:ro - ./config:/config - ./storage:/media/frigate - ./database:/data/db - type: tmpfs # Optional: Reduces SSD wear target: /tmp/cache tmpfs: size: 1000000000 ports: - "8971:8971" - "5000:5000" # Internal unauthenticated access. Be careful with exposure. - "8554:8554" # RTSP feeds - "8555:8555/tcp" # WebRTC over TCP - "8555:8555/udp" # WebRTC over UDP environment: FRIGATE_RTSP_PASSWORD: "password"</pre> <blockquote>'''IMPORTANT NOTE:''' This is going to record to your solid state drive for your main drive by default, which is very bad practice. The only reason it is configured this way is because we have not gotten to the zfs pool creation part of the guide, where we will create a redundant, encrypted, self-healing array of drives as a zfs pool. We want to record camera footage to large hard drives, not tiny solid state drives. Later on in the guide, you will want to change this once ZFS is set up. The two lines of interest will be: </blockquote> <pre> - ./storage:/media/frigate - ./database:/data/db</pre> * This is still set to record everything to main drive: we will come back to edit this later once we have set up a ZFS pool at the end. > '''DOCKER CHEAT SHEET: breaking down the <code>docker-compose.yml</code> File for Frigate''' > Every line of this <code>docker-compose.yml</code> is there for a reason. You likely have no clue what this is all for if you are reading this, so let’s go through it. > > '''1. <code>version: "3.9"</code>''' > This is the version of Docker Compose file format. Version <code>3.9</code> is compatible with new Docker setups > > '''2. <code>services:</code>''' > This section defines the “services” you want to run, which are containers. Here, we only have one container: <code>frigate</code>. > > '''3. <code>frigate:</code>''' > This is the name of the service(container). It helps you identify the container in logs or commands like <code>docker ps</code>. You can name it anything you like, but <code>frigate</code> makes sense since that’s the application we’re running. > > '''4. <code>container_name: frigate</code>''' > Custom name for the frigate container so it is easy to find when you type <code>docker ps -a</code> . Sometimes while debugging things that are not working you may want to enter the environment of the virtual container''(this is like sshing into your server, but into the virtual server that runs frigate)'', which you can do by typing <code>docker exec -it frigate bash</code> - but to do that you need to know which container is which! This is where using sensible names comes into play. > > '''5. <code>privileged: true</code>''' > Running the container in “privileged mode” allows it to access hardware devices like USB or PCIe directly. This is done because frigate can use devices you plug in(like a coral) to improve the performance of the machine learning for detecting items on camera(car, human, bird, etc) > > ''Warning:'' This gives the container elevated permissions, so only use it if absolutely needed (like here). > > '''6. <code>restart: unless-stopped</code>''' > This tells Docker to restart the container unless you stop it. If the computer reboots or the container crashes, it will turn back on automatically > > '''7. <code>image: ghcr.io/blakeblackshear/frigate:0.13.2</code>''' > This tells it what Docker image to use. Here, we’re pulling version <code>0.13.2</code> of Frigate from github container registry (<code>ghcr.io</code>) instead of the newest one because the user interface was tortured & butchered to death with new releases. They destroyed it. It makes me sad how bad new versions are. > > '''8. <code>shm_size: "64mb"</code>''' > This sets the size of shared memory available to the container. frigate uses shared memory for hardware acceleration and video processing. frigate documentation tells you how to increase this based on how many cameras you have running. > > '''9. <code>devices:</code>''' > This part of the docker-compose file maps hardware devices from your host system''(the physical computer you are installing this program onto)'' into the container. Frigate needs access to specific hardware for video processing. Let’s explain each line: > > - <code>/dev/bus/usb:/dev/bus/usb</code>: Maps USB devices for hardware like a USB Coral accelerator which can improve/speed up object detection & take the load off of the host computer. > - <code>/dev/apex_0:/dev/apex_0</code>: Maps a pci express coral thing for faster object detection. > - <code>/dev/video11:/dev/video11</code>: Maps a video input device, like a camera, for systems like Raspberry Pi. > - <code>/dev/dri/renderD128:/dev/dri/renderD128</code>: Maps Intel hardware acceleration for video encoding/decoding. > > '''10. <code>volumes:</code>''' > This section maps directories or volumes between the host and the container. Volumes are where we save configuration, media, and data outside the container so they continue existing even if the container is restarted/deleted/shut off. > > - <code>/etc/localtime:/etc/localtime:ro</code>: This maps the time of the host computer to the time of the container(“computer”) running frigate. The <code>:ro</code> means “read-only,” so the container can’t cause the host machine to time travel. Time travel is cool though. If you agree, watch the movie '''Primer''' - you won’t be disappointed. '''Triangle''' is a close second. The ending messes me up every time. > - <code>./config:/config</code>: Maps the <code>config</code> directory on the host to <code>/config</code> in the container, where Frigate expects its configuration file. > - <code>./storage:/media/frigate</code>: Maps the <code>storage</code> directory on the host to <code>/media/frigate</code> in the container, where Frigate saves camera recordings. > - <code>./database:/data/db</code>: Maps the <code>database</code> directory on the host to <code>/data/db</code> in the container, where Frigate stores metadata and video analytics. > - <code>type: tmpfs</code>: Creates a temporary file system in memory. This reduces wear on SSDs by storing cache data in RAM. > - <code>target: /tmp/cache</code>: Specifies the location of the cache inside the container. > - <code>tmpfs.size: 1000000000</code>: Limits the cache size to 1 GB. > > '''11. <code>ports:</code>''' > This section maps network ports on the host to ports in the container. It allows you to access Frigate’s web interface and services. > - <code>"8971:8971"</code>: Exposes Frigate’s main web interface on port <code>8971</code>. > - <code>"5000:5000"</code>: Exposes an internal port for access without username/password authentication. We will fix this later using nginx & an authentication setup. > - <code>"8554:8554"</code>: Exposes Real-Time Streaming Protocol (RTSP) feeds for viewing video streams. > - <code>"8555:8555/tcp"</code> and <code>"8555:8555/udp"</code>: Expose WebRTC services over TCP and UDP, allowing low-latency streaming. > > '''12. <code>environment:</code>''' > This section defines environment variables, which are key-value pairs that configure the container. > > - <code>FRIGATE_RTSP_PASSWORD: "password"</code>: Sets the password for accessing RTSP streams in Frigate. > '''13. Important Warning About Default Storage''' > By default, this configuration saves camera footage (<code>./storage:/media/frigate</code>) and metadata (<code>./database:/data/db</code>) to your main drive. This is fine for testing, but long-term use will fill up and wear out your SSD. Later in the guide, you’ll learn to change these paths to a ZFS pool for redundant, self-healing storage that provides us with way more space than our operating system’d SSD. <span id="create-frigate-configuration-file"></span> ==== 3.3 Create Frigate Configuration File ==== <ol style="list-style-type: decimal;"> <li>'''Create and Edit the <code>config.yml</code> File:''' <ul> <li><p>Create a <code>config/config.yml</code> file to define your cameras & MQTT setup.</p></li> <li><p>''I have provided a template below. Creating yml files is painful and very easy to mess up. So I provided a known-working file for you to start with.''</p></li> <li><p>'''YOU WILL HAVE TO EDIT THE IP ADDRESSES, USERNAMES, AND PASSWORDS IN EACH PATH LINE TO THE URL OF YOUR ACTUAL CAMERA. YOUR CAMERAS WILL ALSO HAVE DIFFERENT URLS THAN MINE. I DID MOST OF THE WORK FOR YOU, BUT DON’T BE SO LAZY THAT YOU DON’T EVEN CHANGE THE CAMERA IPs & USERNAMES & PASSWORDS TO YOURS!'''</p></li> <li><p>To find the RTSP URLs of your camera, you can install <code>nmap</code> on Ubuntu with:</p> <pre>sudo apt install nmap -y</pre></li> <li><p>Then you go to your terminal and type the following, replacing the IP address of <code>192.168.3.120</code> with the IP address of your camera:</p> <pre>sudo nmap --script rtsp-url-brute -p 554 192.168.5.19 sudo nmap --script rtsp-url-brute -p 8554 192.168.5.19</pre></li> <li><p>You will receive a list of stream URLs. Let’s say one of them is <code>"rtsp://192.168.5.19/Streaming/Channels/101"</code>.</p></li></ul> </li></ol> * You need to add your username & password here. So <code>rtsp://192.168.5.19/Streaming/Channels/101</code> will become <code>rtsp://username:password@192.168.5.19/Streaming/Channels/101</code>. * Test that this works in a video player like VLC. In VLC, go '''Media''' → '''Open Network Stream''' → '''Network URL''' → enter the URL → click '''Play'''. * If it works, it can be entered into the <code>path</code> line and replace my URLs in the config file below. * The first four lines are going to be for MQTT, which sends messages to Home Assistant so that Home Assistant can send alerts to your phone when someone tries to steal your catalytic converter. <pre>mqtt: host: homeassistant.home.arpa port: 1883 user: louis password: passwordman cameras: front_door_closeup: ffmpeg: inputs: - path: rtsp://CAMERAUSERNAMEGOESHERE:CAMERAPASSWORDGOESHERE@192.168.3.101:554/Streaming/Channels/101 roles: - record - path: rtsp://CAMERAUSERNAMEGOESHERE:CAMERAPASSWORDGOESHERE@192.168.3.101:554/Streaming/Channels/102 roles: - detect output_args: record: -f segment -segment_time 60 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy detect: width: 640 height: 360 fps: 20 objects: track: - person - car - motorcycle - bird - cat - dog - horse - sheep - cow - bear - zebra - giraffe - elephant - mouse filters: person: mask: 570,299,545,0 cat: min_score: 0.01 threshold: 0.02 dog: min_score: 0.01 threshold: 0.02 bird: min_score: 0.01 threshold: 0.02 motion: mask: - 473,0,21,156,53,317,140,312 record: enabled: true events: pre_capture: 5 post_capture: 5 objects: - person - car - motorcycle - bird - cat - dog - horse - sheep - cow - bear - zebra - giraffe - elephant - mouse driveway: ffmpeg: inputs: - path: rtsp://CAMERAUSERNAMEGOESHERE:CAMERAPASSWORDGOESHERE@192.168.3.102:554/Streaming/Channels/101 roles: - record - path: rtsp://CAMERAUSERNAMEGOESHERE:CAMERAPASSWORDGOESHERE@192.168.3.102:554/Streaming/Channels/102 roles: - detect output_args: record: -f segment -segment_time 60 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy detect: width: 640 height: 360 fps: 20 objects: track: - person - car - motorcycle - bird - cat - dog - horse - sheep - cow - bear - zebra - giraffe - elephant - mouse filters: car: min_score: 0.01 threshold: 0.03 cat: min_score: 0.01 threshold: 0.02 dog: min_score: 0.01 threshold: 0.02 bird: min_score: 0.01 threshold: 0.02 record: enabled: true events: pre_capture: 5 post_capture: 5 objects: - person - car - motorcycle - bird - cat - dog - horse - sheep - cow - bear - zebra - giraffe - elephant - mouse side_door_closeup: ffmpeg: inputs: - path: rtsp://CAMERAUSERNAMEGOESHERE:CAMERAPASSWORDGOESHERE@192.168.3.104:554/Streaming/Channels/101 roles: - record - path: rtsp://CAMERAUSERNAMEGOESHERE:CAMERAPASSWORDGOESHERE@192.168.3.104:554/Streaming/Channels/102 roles: - detect output_args: record: -f segment -segment_time 60 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy detect: width: 640 height: 360 fps: 20 objects: track: - person - bird - cat - dog - horse - sheep - cow - bear - zebra - giraffe - elephant - mouse filters: car: min_score: 0.01 threshold: 0.03 cat: min_score: 0.01 threshold: 0.02 dog: min_score: 0.01 threshold: 0.02 bird: min_score: 0.70 threshold: 0.75 record: enabled: true events: pre_capture: 5 post_capture: 5 objects: - person - car - bird - cat - dog - horse - sheep - cow - bear - zebra - giraffe - elephant - mouse back_door_closeup: ffmpeg: inputs: - path: rtsp://CAMERAUSERNAMEGOESHERE:CAMERAPASSWORDGOESHERE@192.168.3.103:554/Streaming/Channels/101 roles: - record - path: rtsp://CAMERAUSERNAMEGOESHERE:CAMERAPASSWORDGOESHERE@192.168.3.103:554/Streaming/Channels/102 roles: - detect output_args: record: -f segment -segment_time 60 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy detect: width: 640 height: 360 fps: 20 objects: track: - person - car - bird - cat - dog - horse - sheep - cow - bear - zebra - giraffe - elephant - mouse filters: car: min_score: 0.75 threshold: 0.75 cat: min_score: 0.01 threshold: 0.02 dog: min_score: 0.01 threshold: 0.02 bird: min_score: 0.01 threshold: 0.02 record: enabled: true events: pre_capture: 5 post_capture: 5 objects: - person - car - bird - cat - dog - horse - sheep - cow - bear - zebra - giraffe - elephant - mouse front_porch_wide_angle: ffmpeg: inputs: - path: rtsp://CAMERAUSERNAMEGOESHERE:CAMERAPASSWORDGOESHERE@192.168.3.106:554/Streaming/Channels/101 roles: - record - path: rtsp://CAMERAUSERNAMEGOESHERE:CAMERAPASSWORDGOESHERE@192.168.3.106:554/Streaming/Channels/102 roles: - detect output_args: record: -f segment -segment_time 60 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy detect: width: 640 height: 360 fps: 20 objects: track: - person - car - motorcycle - bird - cat - dog - horse - sheep - cow - bear - zebra - giraffe - elephant - mouse filters: person: min_score: 0.8 threshold: 0.8 car: min_score: 0.6 threshold: 0.7 cat: min_score: 0.01 threshold: 0.02 dog: min_score: 0.01 threshold: 0.02 bird: min_score: 0.6 threshold: 0.65 record: enabled: true events: pre_capture: 5 post_capture: 5 objects: - person - car - motorcycle - bird - cat - dog - horse - sheep - cow - bear - zebra - giraffe - elephant - mouse fishcam: ffmpeg: inputs: - path: rtsp://louis:passwordroflcopter@192.168.3.120:554/stream1 roles: - record - path: rtsp://louis:passwordroflcopter@192.168.3.120:554/stream1 roles: - detect output_args: record: -f segment -segment_time 60 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy detect: width: 640 height: 360 fps: 20 objects: track: - person filters: person: min_score: 0.3 threshold: 0.3 record: enabled: true events: pre_capture: 15 post_capture: 15 objects: - fish database: path: /data/db/frigate.db #version: 0.14</pre> <blockquote>'''Note:''' For each camera, configure the RTSP inputs for recording and detection streams. Define output arguments, detection settings (e.g., width, height, fps), and tracked objects (e.g., person, car, bird, dog). You can set filters for specific objects, mask areas for motion detection, and enable event recording with pre-capture and post-capture times. Repeat for additional cameras as needed. </blockquote> <span id="running-frigate"></span> ==== 3.4 Running Frigate ==== # '''Start Frigate:''' #* Start Frigate by running: <code>docker compose up -d</code>. # '''Access the Frigate Web Interface:''' #* Open your web browser and navigate to <code>http://192.168.5.2:5000</code>. # '''Configure Additional Settings:''' #* Edit the <code>config.yml</code> file as needed to add or modify cameras, object tracking settings, or motion detection masks. # '''Note on Storage:''' #* It’s recommended to use a separate storage device for Frigate’s media to avoid unnecessary wear on your primary SSD. We’ll go into detail about setting up ZFS pools & external storage later. <gallery mode="packed-hover" heights=250 widths=400 perrow=2> File:lu55028jxdtp_tmp_54097ca6.png </gallery> <span id="enjoy-frigate"></span> ==== 3.5 Enjoy Frigate! ==== You have the best NVR software there is, and no cancerous hideous modern UI. Enjoy! <span id="step-4-make-sure-it-all-works."></span>
Summary:
Please note that all contributions to FUTO may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
FUTO:Copyrights
for details).
Do not submit copyrighted work without permission!
To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:
Cancel
Editing help
(opens in new window)