A Python application that downloads and processes video clips from a Frigate NVR server. The application can be run either directly with Python or using Docker.
- Downloads video clips from Frigate NVR based on specified criteria
- Processes downloaded videos using FFmpeg
- Supports scheduled execution via cron
- MongoDB integration for data storage
- Configurable video processing options
- Python 3.9 or higher
- FFmpeg installed on your system
- MongoDB (if using database features)
- Docker (optional, for containerized deployment)
- Clone the repository:
git clone https://github.com/benblustey/frigate-export-ffmpeg.git
cd frigate-export-ffmpeg- Install dependencies:
pip install -r requirements.txtNo additional installation steps required. Docker will handle all dependencies.
Create a .env file in the project root with the following variables:
# Required
FRIGATE_SERVER=http://your-frigate-server:5000/api/events
# Optional
CRON_SCHEDULE=0 * * * * # Default: Run every hour
DOWNLOADS_DIR=./downloads # Default: ./downloads
PROCESS_VIDEO=false # Default: false- Basic usage:
python main.py- Running download_frigate.py directly with options:
python download_frigate.py [options]Available options:
-t: Test run (only outputs txt files, no downloads)-d YYYY-MM-DD: Process specific date-f: Force reprocess (removes date folder)-s YYYY-MM-DD: Set custom start time-e YYYY-MM-DD: Set custom end time-o PATH: Set custom output directory-p: Enable video processing
Example:
python download_frigate.py -d 2024-03-20 -p- Build and start the container:
docker-compose up -d- View logs:
docker-compose logs -f- Stop the container:
docker-compose downThe following environment variables can be configured:
| Variable | Description | Default |
|---|---|---|
| FRIGATE_SERVER | Frigate NVR API endpoint | Required |
| CRON_SCHEDULE | Cron schedule for automated runs | 0 * * * * |
| DOWNLOADS_DIR | Directory for downloaded videos | ./downloads |
| PROCESS_VIDEO | Enable video processing | false |
frigate-export-ffmpeg/
├── main.py # Main entry point
├── download_frigate.py # Download script
├── analyze_directory.py # Directory analysis
├── upload_mongodb.py # MongoDB upload
├── process_video.py # Video processing
├── requirements.txt # Python dependencies
├── Dockerfile # Docker configuration
├── docker-compose.yaml # Docker Compose configuration
└── downloads/ # Downloaded videos directory
Logs are written to both:
- Console output
frigate_export.logfile
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
** Add Attributes About Event **
- Include the
label:<camera_name>for adding multiple sources - Include the
data.scoreto allow wider range of downloads with manual or future inteligent analyzing
This project is licensed under the MIT License - see the LICENSE file for details.