# 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 - **8-bit AV1 Encoding** - NVIDIA GPU acceleration (yuv420p, preset p7) - **Smart Audio Processing** - Auto-detects bitrate, AAC for stereo, EAC3 for 5.1, downmixes, re-encodes only when needed - **Audio Filtering** - Keep only best English audio + Commentary tracks (remove other languages) - **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 28 32 32 34 true .vtt,.srt,.ass,.ssa,.sub ``` ## 📊 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 | 8-bit (yuv420p) | | 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 `true` **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)