2.6 KiB
2.6 KiB
HandBrake Batch Converter Script
This Bash script converts video files in bulk using HandBrakeCLI with predefined presets for Blu-ray and DVD sources.
It supports recursive folder scanning and preserves the folder structure in the output directory.
Features
- Converts all
.mkvfiles from the source directory and its subfolders. - Preserves the original folder structure in the destination directory.
- Select between Blu-ray and DVD presets.
- Skips already converted files to avoid duplication.
- Logs all conversion activity.
Requirements
-
Install HandBrakeCLI
- Ubuntu/Debian:
sudo apt update sudo apt install handbrake-cli - Fedora:
sudo dnf install HandBrake-cli - macOS (Homebrew):
brew install handbrake - Windows: Download from HandBrake Downloads
- Ubuntu/Debian:
-
Preset JSON files in the
./profiles/directory:BluRay H.265 HEVC.jsonDVD 720p H.265.json
Installation
Clone the repository:
git clone https://github.com/yourusername/handbrake-batch-converter.git
cd handbrake-batch-converter
chmod +x convert.sh
Usage
./convert.sh --source /path/to/source --destination /path/to/destination --mode [bluray|dvd]
Example
./convert.sh \
--source "/media/movies_raw" \
--destination "/media/movies_converted" \
--mode bluray
This will:
- Search
/media/movies_rawfor all.mkvfiles, including in subdirectories. - Re-create the same folder structure under
/media/movies_converted. - Convert each file using the
BluRay H.265 HEVCpreset. - Skip files that already exist in the destination.
Modes
| Mode | Preset File | Description |
|---|---|---|
| bluray | ./profiles/BluRay H.265 HEVC.json |
For high-quality Blu-ray rips |
| dvd | ./profiles/DVD 720p H.265.json |
For standard DVD conversions |
Log File
All conversion logs are saved to:
./handbrake_convert.log
Directory Structure Example
Source:
/source
├── Movie1
│ ├── video1.mkv
│ └── video2.mkv
└── Movie2
└── video1.mkv
Destination after conversion:
/destination
├── Movie1
│ ├── video1.mkv
│ └── video2.mkv
└── Movie2
└── video1.mkv
License
This project is licensed under the MIT License.