The why...

After playing around with Frigate for a while, 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.

I gathered all on the MacBook:

  • Home Assistent
  • MQTT
  • Plex
  • Node-RED
  • Frigate
  • Unifi-controller
  • Postgres (For Home Assistant)

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.

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...

FTP Upload

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:

 Frigate was storing video files locally, not optimal....

That is the simplest way to get detections on file (and here - outside the house).

There are more settings to play around with:

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.

I have actually done this many times before - and at some point I used  something like Single File Gallery for viewing files from cameras. That is actually quite well functioning.

A video server

But, this time I though of how do I easiest view movies - and the though of a Media server came to mind.

So, I could have used Plex, but decided to go with JellyFin. Could also have been Emby, Plex or Kodi or a lot of other alternatives... one advantage of Jellyfin seems to be the support for Symlinks.

You should be aware of a few differences:

Jellyfin - free all over. Only local users. Not clients for all devices, but it has for iOS and for AppleTV use "Infuse".

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.

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. 

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.

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.

But as a stand-alone solution JellyFin is best.

Again, very easy to spin up an Jellyfin server in a docker container:

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

Or a Emby:

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


Where /ftp is where my cameres drops the movies via FTP:

❯ ls -l
total 68
drwxr-xr-x 3 camera www-data  4096 Jan 26 17:24 behindhouse
drwxr-xr-x 3 camera www-data  4096 Jan 26 17:04 bigshed
drwxr-xr-x 4 camera www-data  4096 Feb  6 14:29 carport
drwxr-xr-x 3 camera www-data  4096 Jan 26 17:23 frontdoor
drwxr-xr-x 3 camera www-data  4096 Jan 26 13:05 garden

Start Jellyfin, 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:

Remember to enable Realtime monitoring.

Add folders:

And go to the front:

Add file niceness

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:

#!/bin/bash
  
IFS=$'\n'

for f in $(find /ftp/carport -type f -name "Carport*.mp4"); do

THEPATH=$(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/$MONTH
mkdir -p /ftp/emby/carport/$MONTH/$DAY

NEWNAME="$CAMNAME $DAY-$MONTH-$YEAR $HOUR:$MINUTE.mp4"

mv "${f}" /ftp/emby/carport/$MONTH/$DAY/"${NEWNAME}"

done

chown -R camera:www-data /ftp/emby

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

The lines:

mkdir -p /ftp/emby/carport/$MONTH
mkdir -p /ftp/emby/carport/$MONTH/$DAY

NEWNAME="$CAMNAME $DAY-$MONTH-$YEAR $HOUR:$MINUTE.mp4"

mv "${f}" /ftp/emby/carport/$MONTH/$DAY/"${NEWNAME}"

Enforces a folder structure; - if You want to click less around $MONTH could be skipped (as we only have 10 days retention). 


The scripts runs (I have a file pr cam) every 5 minutes via the crontab on the server.

Also I have a cleanup script:

#!/bin/bash

cd /ftp/emby
find /ftp/emby -name "*.mp4" -type f -mtime +10 -delete
find /ftp/emby -type d -mtime +11 -exec rm -rf {} \;

This will clean up files and folder - and retain 10 days of movies.

Viewing camera recordings

Going to the front of Jellyfin now shows all the recordings (movies):


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:

  • Making playlists
  • Downloading videos
  • Adding Metadata

etc will come in quite handy:

Addding users

In the admin settings You can add users - Familiy members - and the can have access to all cameras, or a subset of cams:

The user will have some options about setting fullname and arranging the Home screen.

What is Next

Is still have all cameras in Home Assistant, so there is still posibilities to do stuff with them in there...

Next step will be adding pictures from the cameras, problably into separate folders.