122 lines
2.6 KiB
Markdown
122 lines
2.6 KiB
Markdown
# 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 `.mkv` files 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
|
|
|
|
1. **Install HandBrakeCLI**
|
|
- **Ubuntu/Debian:**
|
|
```bash
|
|
sudo apt update
|
|
sudo apt install handbrake-cli
|
|
```
|
|
- **Fedora:**
|
|
```bash
|
|
sudo dnf install HandBrake-cli
|
|
```
|
|
- **macOS (Homebrew):**
|
|
```bash
|
|
brew install handbrake
|
|
```
|
|
- **Windows:** Download from [HandBrake Downloads](https://handbrake.fr/downloads2.php)
|
|
|
|
2. **Preset JSON files** in the `./profiles/` directory:
|
|
- `BluRay H.265 HEVC.json`
|
|
- `DVD 720p H.265.json`
|
|
|
|
---
|
|
|
|
## Installation
|
|
|
|
Clone the repository:
|
|
|
|
```bash
|
|
git clone https://github.com/yourusername/handbrake-batch-converter.git
|
|
cd handbrake-batch-converter
|
|
chmod +x convert.sh
|
|
```
|
|
|
|
---
|
|
|
|
## Usage
|
|
|
|
```bash
|
|
./convert.sh --source /path/to/source --destination /path/to/destination --mode [bluray|dvd]
|
|
```
|
|
|
|
### Example
|
|
|
|
```bash
|
|
./convert.sh \
|
|
--source "/media/movies_raw" \
|
|
--destination "/media/movies_converted" \
|
|
--mode bluray
|
|
```
|
|
|
|
This will:
|
|
1. Search `/media/movies_raw` for all `.mkv` files, including in subdirectories.
|
|
2. Re-create the same folder structure under `/media/movies_converted`.
|
|
3. Convert each file using the `BluRay H.265 HEVC` preset.
|
|
4. 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.
|
|
|