167 lines
4.2 KiB
Markdown
167 lines
4.2 KiB
Markdown
# AV1 Batch Video Transcoder
|
|
|
|
A high-performance batch video transcoding tool using NVIDIA's **AV1 NVENC** codec with intelligent audio/subtitle handling and automatic quality optimization.
|
|
|
|
## ✨ Key Features
|
|
|
|
- **10-bit AV1 Encoding** - NVIDIA GPU acceleration (p010le, preset p1)
|
|
- **Smart Audio Processing** - Auto-detects bitrate, downmixes, re-encodes only when needed
|
|
- **Subtitle Embedding** - Auto-detects and embeds subtitles (.vtt, .srt, .ass, .ssa, .sub)
|
|
- **Smart Resolution** - Scales 4K→1080p, preserves lower resolutions
|
|
- **Two-Phase Encoding** - CQ mode first, automatic Bitrate fallback if size threshold exceeded
|
|
- **Automatic Cleanup** - Deletes originals + subtitles after successful encoding
|
|
- **Test Mode** - Encode one file, check compression ratio before batch processing
|
|
- **Optional Language Tagging** - Tag audio streams with language codes
|
|
- **CSV Tracking** - Detailed conversion logs with compression ratios
|
|
|
|
## 🚀 Quick Start
|
|
|
|
### Requirements
|
|
|
|
- **Python 3.8+**
|
|
- **FFmpeg** with libfdk-aac support
|
|
- **NVIDIA GPU** (GeForce RTX 2060+, Quadro, or newer)
|
|
- **NVIDIA CUDA Toolkit** (for av1_nvenc support)
|
|
|
|
### Installation
|
|
|
|
```bash
|
|
# Clone repository
|
|
git clone https://github.com/yourusername/conversion_project.git
|
|
cd conversion_project
|
|
|
|
# Install Python dependencies (if any needed in future)
|
|
# pip install -r requirements.txt
|
|
```
|
|
|
|
### Basic Usage
|
|
|
|
```bash
|
|
# Encode a TV folder (smart mode)
|
|
python main.py "P:\tv\Show Name"
|
|
|
|
# Test single file before batch processing
|
|
python main.py "P:\tv\Show Name" --test
|
|
|
|
# Force specific quality (CQ 30)
|
|
python main.py "P:\movies\Movie" --cq 30
|
|
|
|
# Force bitrate mode
|
|
python main.py "P:\tv\Show" --m bitrate
|
|
|
|
# Specific resolution
|
|
python main.py "P:\movies" --r 720
|
|
|
|
# Tag audio with language
|
|
python main.py "P:\tv\Show" --language eng
|
|
```
|
|
|
|
## 📖 Documentation
|
|
|
|
- **[Full Usage Guide](README_RESTRUCTURE.md)** - Detailed commands, features, troubleshooting
|
|
- **[Technical Architecture](PROJECT_STRUCTURE.md)** - Module breakdown, workflow, config reference
|
|
|
|
## ⚙️ Configuration
|
|
|
|
Edit `config.xml` to customize:
|
|
|
|
```xml
|
|
<!-- CQ quality per content type -->
|
|
<cq>
|
|
<tv_1080>28</tv_1080>
|
|
<tv_720>32</tv_720>
|
|
<movie_1080>32</movie_1080>
|
|
<movie_720>34</movie_720>
|
|
</cq>
|
|
|
|
<!-- Audio bitrate buckets -->
|
|
<audio>
|
|
<stereo>
|
|
<high>192000</high>
|
|
<medium>160000</medium>
|
|
</stereo>
|
|
<multi_channel>
|
|
<medium>448000</medium>
|
|
<low>384000</low>
|
|
</multi_channel>
|
|
</audio>
|
|
|
|
<!-- Subtitle auto-detection -->
|
|
<subtitles>
|
|
<enabled>true</enabled>
|
|
<extensions>.vtt,.srt,.ass,.ssa,.sub</extensions>
|
|
</subtitles>
|
|
```
|
|
|
|
## 📊 Example Output
|
|
|
|
**Input:**
|
|
```
|
|
Show.S01E01.mkv (1.5GB)
|
|
Show.S01E01.en.vtt (subtitle)
|
|
```
|
|
|
|
**Output:**
|
|
```
|
|
Show.S01E01 - [EHX].mkv (450MB, subtitle embedded, audio tagged)
|
|
```
|
|
|
|
**Compression:** 1.5GB → 450MB (30% ratio, 70% reduction)
|
|
|
|
## 🔧 Encoding Specs
|
|
|
|
| Setting | Value |
|
|
|---------|-------|
|
|
| Video Codec | AV1 (av1_nvenc) |
|
|
| Bit Depth | 10-bit (p010le) |
|
|
| GPU Preset | p1 (high quality) |
|
|
| Audio Codec | AAC |
|
|
| Audio Mode | Smart (copy or re-encode) |
|
|
| Container | MKV |
|
|
| Subtitles | Embedded SRT |
|
|
|
|
## 🎯 Workflow
|
|
|
|
1. **Scan** folder for video files
|
|
2. **Detect** subtitles, audio streams, resolution
|
|
3. **Encode** with AV1 codec (Phase 1: CQ)
|
|
4. **Check** size threshold (default 75%)
|
|
5. **Retry** with Bitrate mode if needed (Phase 2)
|
|
6. **Move** encoded file to original location
|
|
7. **Cleanup** original + subtitles + temp files
|
|
8. **Log** results to CSV tracker
|
|
|
|
## 📋 Requirements
|
|
|
|
- Windows 10/11 or Linux
|
|
- NVIDIA GPU with NVENC support
|
|
- NVIDIA CUDA Toolkit 11.0+
|
|
- FFmpeg compiled with av1_nvenc support
|
|
- Python 3.8+
|
|
|
|
## 🛠️ Troubleshooting
|
|
|
|
**Files not moving?**
|
|
- Check `reduction_ratio_threshold` in config.xml (default 0.75)
|
|
- Run with `--test` to see compression ratio
|
|
|
|
**Subtitles not embedding?**
|
|
- Verify filename: `video.en.vtt` or `video.vtt`
|
|
- Check config.xml `<subtitles><enabled>true</enabled>`
|
|
|
|
**Wrong audio quality?**
|
|
- Adjust CQ values in config.xml per content type
|
|
- Use `--cq` override: `python main.py folder --cq 30`
|
|
|
|
See [Full Guide](README_RESTRUCTURE.md) for more help.
|
|
|
|
## 📄 License
|
|
|
|
MIT
|
|
|
|
## 📞 Support
|
|
|
|
For detailed usage, see [README_RESTRUCTURE.md](README_RESTRUCTURE.md)
|
|
|
|
For technical architecture, see [PROJECT_STRUCTURE.md](PROJECT_STRUCTURE.md)
|