An automated media conversion tool that monitors directories for video files and automatically converts them to H.265/HEVC format after a specified age threshold. This tool helps save storage space while maintaining video quality.
- 🎥 Automatic video conversion to H.265/HEVC
- 📅 Age-based conversion (configurable threshold)
- 📊 Database tracking of processed files
- 🔄 Resume capability for interrupted conversions
- 📝 Comprehensive logging
- ⚙️ Configurable conversion settings
- 🗂️ Maintains original file structure
- 🎯 Efficient resource usage
- Python 3.7 or higher
- FFmpeg installed on the system
- Sufficient disk space for temporary conversion files
sudo apt-get update
sudo apt-get install ffmpeg
brew install ffmpeg
Download from FFmpeg official website
- Clone the repository:
git clone https://github.com/patw/downscaler.git
cd downscaler
- Configure settings in
config.py
:
MEDIA_ROOT = "/path/to/your/media"
FILE_AGE_THRESHOLD = 14 # days
python main.py
To run the converter automatically, set up a cron job (Linux/macOS) or Task Scheduler (Windows).
Add to crontab:
# Run daily at 2 AM
0 2 * * * /usr/bin/python3 /path/to/downscaler/main.py
- Open Task Scheduler
- Create Basic Task
- Set trigger to daily
- Action: Start a program
- Program/script:
python
- Arguments:
path\to\main.py
Edit config.py
to customize the converter's behavior:
# File system settings
MEDIA_ROOT = "/data/Media"
SUPPORTED_FORMATS = ('.mp4', '.mkv', '.avi')
FILE_AGE_THRESHOLD = 14 # days
# FFmpeg settings
FFMPEG_PRESET = 'medium'
CRF_VALUE = '28' # Constant Rate Factor (18-28 recommended)
Logs are written to media_converter.log
in the project directory. The log includes:
- Conversion start/completion
- Errors and exceptions
- File processing status
- Database operations
The converter maintains a SQLite database (media_converter.db
) tracking:
- Processed files
- Conversion status
- File metadata
- Last check timestamps
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- FFmpeg for video processing
- Python community for various libraries
- Contributors and users of this tool
For issues, questions, or contributions, please create an issue in the GitHub repository.