Created
January 20, 2023 07:17
-
-
Save KennyStier/df149aefc7a6084acd926eca3e84acd9 to your computer and use it in GitHub Desktop.
Frigate Export Clip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Frigate Export Script | |
# By Kenny Stier (kstr.us) | |
# Based on https://github.com/blakeblackshear/frigate/issues/2369#issuecomment-1268359613 | |
# Menu taken from https://stackoverflow.com/a/28326129 | |
URL='http://192.168.0.14:5000' | |
OUTDIR='./archive' | |
mkdir -p $OUTDIR | |
# cams list from frigate api: | |
mycam=$(curl -s ${URL}/api/config |jshon -e cameras -k) | |
declare -a camarray=($mycam) | |
createmenu () | |
{ | |
select option; do # in "$@" is the default | |
if [ "$REPLY" -eq "$#" ]; | |
then | |
echo "Exiting..." | |
break; | |
elif [ 1 -le "$REPLY" ] && [ "$REPLY" -le $(($#-1)) ]; | |
then | |
echo "You selected $option" | |
break; | |
else | |
echo "Incorrect Input: Select a number 1-$#" | |
fi | |
done | |
} | |
echo "Choose your camera:" | |
createmenu "${camarray[@]}" | |
read -p "Enter start time (Format: Jan 1, 1980 16:20:00):" startstring | |
read -p "Enter end time (Format: Jan 1, 1980 18:30:00):" endstring | |
start=$(date +%s -d"${startstring}") | |
end=$(date +%s -d"${endstring}") | |
startname=$(date +%Y-%m-%d_%H-%M-%S -d"${startstring}") | |
ffmpeg -y -i ${URL}/vod/$option/start/$start/end/$end/index.m3u8 -c copy ${OUTDIR}/${option}-${startname}.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Let me start this with two caveats; 1) I stole/used @KennyStier's script above, who based it on @artlov's . 2) I am not a designer and this doesn't look fancy at all. But, so far it is working and is easier than using a script for those who prefer the visual aspect.
Below are the two main files;
index.html: (camera names & descriptions need to be updated)
frigate-export.php: (server IP/port need to be updated)
Notes; I am running nginx in docker. The index.html & frigate-export.php files are in one of the web hosting files, I created a sub-folder called archive. This folder is where all the exported clips go into. You need to have ffmpeg installed and I also have the two attached files daterangepicker.css & daterangepicker.js due to the visual date selection.
Hopefully this makes sense and may be helpful for someone else...