Skip to content

Downscale your media files to h265 to save space

License

Notifications You must be signed in to change notification settings

patw/Downscaler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Downscale your media files to h265 to save space

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages