Wiki source code of Making a simple NVR (Frigate) Alternative
Version 18.1 by Normann P. Nielsen on 2026/11/15 15:41
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
1.1 | 1 | = The why... = |
| 2 | |||
| 3 | After playing around with [[Frigate for a while>>Main.information-technology.part-1-macbook-2019-as-frigate-nvr-with-object-detection]], I wanted to use the MacBook for "everything". Promox was considered, but I am a kind of doing it basic guy, so I settled on manual containers. | ||
| 4 | |||
| 5 | I gathered all on the MacBook: | ||
| 6 | |||
| 7 | * Home Assistent | ||
| 8 | * MQTT | ||
| 9 | * Plex | ||
| 10 | * Node-RED | ||
| 11 | * Frigate | ||
| 12 | * Unifi-controller | ||
| 13 | * Postgres (For Home Assistant) | ||
| 14 | as we know, **Frigate is quite CPU heavy**, even with a Coral; and things went fine, until using Frigate to view several streams, killed Plex streaming pretty hard. | ||
| 15 | |||
| 16 | So - a fact is the Reolink cams are not really used in terms of detection etc in the cams themselves; and I am only using Frigate to see what did happend on my property, not really for advanced detections or anything - just plain NVR... | ||
| 17 | |||
| 18 | = FTP Upload = | ||
| 19 | |||
| 20 | So I decided to do things kind of "simpler" - with the main purpose to spare ressources on the MacBook, so I set up Motion Detection (again) and FTP upload - to a VM at work: | ||
| 21 | |||
| 22 | {{success}}Frigate was storing video files locally, not optimal....{{/success}} | ||
| 23 | |||
| 24 | [[image:Screen Shot 2025-02-09 at 13.47.43.jpg||width="300"||alt="Screen Shot 2025-02-09 at 13.47.43.jpg"]] [[image:Screen Shot 2025-02-09 at 13.47.56.jpg||width="300"||alt="Screen Shot 2025-02-09 at 13.47.56.jpg"]] [[image:Screen Shot 2025-02-09 at 13.48.09.jpg||width="300"||alt="Screen Shot 2025-02-09 at 13.48.09.jpg"]] | ||
| 25 | |||
| 26 | That is the simplest way to get detections on file (and here - outside the house). | ||
| 27 | |||
| 28 | There are more settings to play around with: | ||
| 29 | |||
| 30 | [[image:Screen Shot 2025-02-09 at 13.53.40.jpg||width="300"||alt="Screen Shot 2025-02-09 at 13.53.40.jpg"]][[image:Screen Shot 2025-02-09 at 13.53.53.jpg||width="300"||alt="Screen Shot 2025-02-09 at 13.53.53.jpg"]] [[image:Screen Shot 2025-02-09 at 13.54.54.jpg||width="300"||alt="Screen Shot 2025-02-09 at 13.54.54.jpg"]] | ||
| 31 | |||
| 32 | But, we need to be able to view the movie and picture files; so I set up an Apache2 Webserver with browsing capabilites; //**but thas is really not very good**//, as view is not streaming, its more - download; then view. | ||
| 33 | |||
| 34 | I have actually done this many times before - and at some point I used something like [[Single File Gallery>>https://www.files.gallery/?gad_source=1&gclid=CjwKCAiAwaG9BhAREiwAdhv6Y81yCyEsh7BGw8CLBF1r-vhwaN-b-S0RwdJPXsfJdPQclVcyCtm3fRoCpf0QAvD_BwE]] for viewing files from cameras. That is actually quite well functioning. | ||
| 35 | |||
| 36 | = A video server = | ||
| 37 | |||
| 38 | But, this time I though of how do I easiest view movies - and the though of a Media server came to mind. | ||
| 39 | |||
| 40 | So, I could have used [[Plex>>https://www.plex.tv/]], but decided to go with [[JellyFin>>https://jellyfin.org/]]. Could also have been [[Emby>>https://emby.media/]], [[Plex>>https://www.plex.tv/]] or Kodi or a lot of other alternatives... one advantage of Jellyfin seems to be the support for Symlinks. | ||
| 41 | |||
| 42 | You should be aware of a few differences: | ||
| 43 | |||
| 44 | **Jellyfin** - free all over. Only local users. Not clients for all devices, but it has for iOS and for AppleTV use "Infuse". | ||
| 45 | |||
| 46 | **Emby** - The server is free, but iOS clients (at least) cost a small fee, and there is a Premium option availble. Only local users, at least before any premuim. | ||
| 47 | |||
| 48 | **Plex** - The server is free, but iOS clients (at least) cost a small fee, and there is a Premium option (PlexPass) availble. The main user is NOT local, but created on [[https://plex.tv.]] | ||
| 49 | |||
| 50 | {{success}}Personally I have abandoned Plex totally for Jellyfin after this article as I find it clumsy and wierd. But - there are clients for many devices, including Samsung TVs. | ||
| 51 | |||
| 52 | Update Marts 2025 - I have actually used plex for it - again - due to having Plex elsewhere, and the being able to share the Camera Libraries with my normal Plex account. | ||
| 53 | |||
| 54 | **But as a stand-alone solution JellyFin is the best.**{{/success}} | ||
| 55 | |||
| 56 | Again, very easy to spin up an Jellyfin server in a docker container: | ||
| 57 | |||
| 58 | |||
| 59 | {{code}} | ||
| 60 | version: '3.4'services: jellyfin: image: lscr.io/linuxserver/jellyfin:latest container_name: jellyfin environment: - PUID=1000 - PGID=1000 - TZ=Europe/Copenhagen - JELLYFIN_PublishedServerUrl=https://camera.mos-eisley.dk/ #optional volumes: - /data/jellyfin/library:/config - /data/jellyfin//tvseries:/data/tvshows - /ftp:/data/movies ports: - 8096:8096 - 8920:8920 #optional - 7359:7359/udp #optional - 1900:1900/udp #optional restart: unless-stopped | ||
| 61 | {{/code}} | ||
| 62 | |||
| 63 | Or a Emby: | ||
| 64 | |||
| 65 | |||
| 66 | {{code}} | ||
| 67 | version: '3.4'services: emby: image: lscr.io/linuxserver/emby:latest container_name: emby environment: - PUID=1000 - PGID=1000 - TZ=Europe/Copenhagen volumes: - /data/emby/library:/config - /tvshows:/data/tvshows - /ftp:/data/movies ports: - 8096:8096 - 8920:8920 #optional restart: unless-stopped | ||
| 68 | {{/code}} | ||
| 69 | |||
| 70 | Or a Plex: | ||
| 71 | |||
| 72 | |||
| 73 | {{code language="shell"}} | ||
| 74 | version: '3.4'services: plex: container_name: plex restart: unless-stopped image: plexinc/pms-docker volumes: - /etc/localtime:/etc/localtime:ro - /data/plex/config:/config - /data/plex/temp:/transcode - /ftp:/data ports: - "32400:32400" environment: TZ: "Europe/Copenhagen" PLEX_UID: "1000" PLEX_GID: "1000" | ||
| 75 | {{/code}} | ||
| 76 | |||
| 77 | Where** /ftp **is where my cameras drops the movies via FTP: | ||
| 78 | |||
| 79 | |||
| 80 | {{code}} | ||
| 81 | ❯ ls -ltotal 68drwxr-xr-x 3 camera www-data 4096 Jan 26 17:24 behindhousedrwxr-xr-x 3 camera www-data 4096 Jan 26 17:04 bigsheddrwxr-xr-x 4 camera www-data 4096 Feb 6 14:29 carportdrwxr-xr-x 3 camera www-data 4096 Jan 26 17:23 frontdoordrwxr-xr-x 3 camera www-data 4096 Jan 26 13:05 garden | ||
| 82 | {{/code}} | ||
| 83 | |||
| 84 | Start Jellyfin (or Emby), create a user and create 5 Libraries (one pr. cam) to the folders. make sure to select content type: **Home videos and photos** - to avoid Jellyfin trying to get IMDB metadata etc: | ||
| 85 | |||
| 86 | [[image:Screenshot 2025-02-13 at 15.28.40.png||height="250"||alt="Screenshot 2025-02-13 at 15.28.40.png"]] | ||
| 87 | |||
| 88 | Remember to enable Realtime monitoring. | ||
| 89 | |||
| 90 | Add folders: | ||
| 91 | |||
| 92 | [[image:Screenshot 2025-02-13 at 15.29.50.png||height="250"||alt="Screenshot 2025-02-13 at 15.29.50.png"]] | ||
| 93 | |||
| 94 | And go to the front: | ||
| 95 | |||
| 96 | [[image:Screenshot 2025-02-13 at 15.30.21.png||height="250"||alt="Screenshot 2025-02-13 at 15.30.21.png"]] | ||
| 97 | |||
| 98 | = Add file niceness = | ||
| 99 | |||
| 100 | Now, the above pictures is a little different, as the cameraes drops files in a filenaming as: **Carport_Cam_00_20250210120044.mp4** - which is not so fantastic for the human eyes and readbility, so I created a script that does take each dropped camerafile and moves it to a new directory with a better filename: | ||
| 101 | |||
| 102 | |||
| 103 | {{code}} | ||
| 104 | #!/bin/bash IFS=$'\n'for f in $(find /ftp/carport -type f -name "Carport*.mp4"); doTHEPATH=$(dirname "${f}")NAME=$(basename "${f}")IFS='_'read -ra strarr <<< "$NAME"CAMNAME=${strarr[0]}IFS=' 'read -ra strarr <<< "$NAME"NAME1=${strarr[1]}DATETIME=$(echo $NAME1 | sed 's/Cam_00_//g')YEAR=$(echo $DATETIME | cut -c 1-4 )MONTH=$(echo $DATETIME | cut -c 5-6 )DAY=$(echo $DATETIME | cut -c 7-8 )HOUR=$(echo $DATETIME | cut -c 9-10 )MINUTE=$(echo $DATETIME | cut -c 11-12 )mkdir -p /ftp/emby/carport/$MONTHmkdir -p /ftp/emby/carport/$MONTH/$DAYNEWNAME="$CAMNAME $DAY-$MONTH-$YEAR $HOUR:$MINUTE.mp4"mv "${f}" /ftp/emby/carport/$MONTH/$DAY/"${NEWNAME}"donechown -R camera:www-data /ftp/emby | ||
| 105 | {{/code}} | ||
| 106 | |||
| 107 | So the file named **/ftp/carport/02/10/Carport Cam_00_20250210120044.mp4** becomes **/ftp/emby/carport/02/10/carport cam 10-02-2025 12:00 **wich is readable for the human eye and in Emby | ||
| 108 | |||
| 109 | {{success}}The lines: | ||
| 110 | |||
| 111 | |||
| 112 | {{code}} | ||
| 113 | mkdir -p /ftp/emby/carport/$MONTHmkdir -p /ftp/emby/carport/$MONTH/$DAYNEWNAME="$CAMNAME $DAY-$MONTH-$YEAR $HOUR:$MINUTE.mp4"mv "${f}" /ftp/emby/carport/$MONTH/$DAY/"${NEWNAME}" | ||
| 114 | {{/code}} | ||
| 115 | |||
| 116 | Enforces a folder structure; - if You want to click less around $MONTH could be skipped (as we only have 10 days retention).{{/success}} | ||
| 117 | |||
| 118 | |||
| 119 | |||
| 120 | The scripts runs (I have a file pr cam) every 5 minutes via the crontab on the server. | ||
| 121 | |||
| 122 | Also I have a cleanup script: | ||
| 123 | |||
| 124 | |||
| 125 | {{code}} | ||
| 126 | #!/bin/bashcd /ftp/embyfind /ftp/emby -name "*.mp4" -type f -mtime +10 -deletefind /ftp/emby -type d -mtime +11 -exec rm -rf {} \; | ||
| 127 | {{/code}} | ||
| 128 | |||
| 129 | This will clean up files and folder - and retain 10 days of movies. | ||
| 130 | |||
| 131 | = Viewing camera recordings = | ||
| 132 | |||
| 133 | Going to the front of Jellyfin now shows all the recordings (movies): | ||
| 134 | |||
| 135 | [[image:Screenshot 2025-02-13 at 15.30.21.png||height="250"||alt="Screenshot 2025-02-13 at 15.30.21.png"]] | ||
| 136 | |||
| 137 | |||
| 138 | |||
| 139 | In general that is sufficient for my needs, but lets say there was a breakin/fire or something at the my property, the added capabilities regarding: | ||
| 140 | |||
| 141 | * Making playlists | ||
| 142 | * Downloading videos | ||
| 143 | * Adding Metadata | ||
| 144 | etc will come in quite handy: | ||
| 145 | |||
| 146 | [[image:Screenshot 2025-02-13 at 15.32.01.png||height="250"||alt="Screenshot 2025-02-13 at 15.32.01.png"]] | ||
| 147 | |||
| 148 | = Addding users = | ||
| 149 | |||
| 150 | In the admin settings You can add users - Familiy members - and the can have access to all cameras, or a subset of cams: | ||
| 151 | |||
| 152 | [[image:Screenshot 2025-02-13 at 15.32.39.png||width="300"||alt="Screenshot 2025-02-13 at 15.32.39.png"]] | ||
| 153 | |||
| 154 | The user will have some options about setting fullname and arranging the Home screen. | ||
| 155 | |||
| 156 | = What is Next = | ||
| 157 | |||
| 158 | Is still have all cameras in Home Assistant, so there is still posibilities to do stuff with them in there... | ||
| 159 | |||
| 160 | Next step will be adding pictures from the cameras, problably into separate folders. |