diff --git a/Windows DVR/LinuxDVR.sh b/Windows DVR/LinuxDVR.sh new file mode 100644 index 0000000..5cc5a4c --- /dev/null +++ b/Windows DVR/LinuxDVR.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Load variables from the .env file +if [ -f .env ]; then + export $(grep -v '^#' .env | xargs) +else + echo ".env file not found" + exit 1 +fi + +# Check if variables are set +if [ -z "$OUTPUT_PATH" ] || [ -z "$RTSP_URL" ] || [ -z "$CHUNK_SIZE" ]; then + echo "One or more required variables (OUTPUT_PATH, RTSP_URL, CHUNK_SIZE) are not set in the .env file." + exit 1 +fi + +# Start FFmpeg to record in segments +ffmpeg -i "$RTSP_URL" -c copy -f segment -segment_time "$CHUNK_SIZE" -segment_format mp4 -strftime 1 "$OUTPUT_PATH/%Y-%m-%d_%H-%M-%S.mp4" \ No newline at end of file