Skip to content

Latest commit

 

History

History
130 lines (95 loc) · 2.83 KB

README.md

File metadata and controls

130 lines (95 loc) · 2.83 KB

Downscaler

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.

Features

  • 🎥 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

Prerequisites

  • Python 3.7 or higher
  • FFmpeg installed on the system
  • Sufficient disk space for temporary conversion files

Installing FFmpeg

Ubuntu/Debian

sudo apt-get update
sudo apt-get install ffmpeg

macOS (using Homebrew)

brew install ffmpeg

Windows

Download from FFmpeg official website

Installation

  1. Clone the repository:
git clone https://github.com/patw/downscaler.git
cd downscaler
  1. Configure settings in config.py:
MEDIA_ROOT = "/path/to/your/media"
FILE_AGE_THRESHOLD = 14 # days

Usage

Running Manually

python main.py

Setting up Automated Conversion

To run the converter automatically, set up a cron job (Linux/macOS) or Task Scheduler (Windows).

Linux/macOS Cron Setup

Add to crontab:

# Run daily at 2 AM
0 2 * * * /usr/bin/python3 /path/to/downscaler/main.py

Windows Task Scheduler

  1. Open Task Scheduler
  2. Create Basic Task
  3. Set trigger to daily
  4. Action: Start a program
  5. Program/script: python
  6. Arguments: path\to\main.py

Configuration

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)

Logging

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

Database

The converter maintains a SQLite database (media_converter.db) tracking:

  • Processed files
  • Conversion status
  • File metadata
  • Last check timestamps

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • FFmpeg for video processing
  • Python community for various libraries
  • Contributors and users of this tool

Support

For issues, questions, or contributions, please create an issue in the GitHub repository.