47cf1c6dd5691b896b7d8eefeb196e73d03bace0
anime_audio_copilot.py
Overview
anime_audio_copilot.py is a batch-processing script for MKV files, designed for anime encoding workflows. It automates video encoding (with AV1 via SVT-AV1 and av1an), audio conversion (to Opus with normalization and optional downmixing), and preserves detailed per-file logs. The script also handles VFR-to-CFR conversion using HandBrakeCLI when needed.
Features
- Video encoding: Uses UTVideo intermediate, VapourSynth, and AV1 encoding via
av1anand SVT-AV1. - Audio processing: Converts non-Opus/AAC tracks to normalized Opus, with optional downmixing for surround audio.
- VFR handling: Detects Variable Frame Rate sources and converts to Constant Frame Rate using HandBrakeCLI.
- Logging: Creates a log file for each processed MKV in the
conv_logsdirectory. - Cleanup: Moves original files to
original/, completed files tocompleted/, and deletes temporary files.
Requirements
The following tools must be installed and available in your PATH:
- ffmpeg
- ffprobe
- mkvmerge
- mkvpropedit
- sox
- opusenc
- mediainfo
- av1an
- HandBrakeCLI
Usage
Place your .mkv files in the working directory. Run the script:
python3 anime_audio_copilot.py
Optional Arguments
--no-downmix
Preserve original audio channel layout (do not downmix surround audio to stereo).
Example:
python3 anime_audio_copilot.py --no-downmix
Output
- Processed files are moved to the
completed/directory. - Originals are moved to the
original/directory. - Per-file logs are saved in the
conv_logs/directory.
Notes
- The script will skip files that cannot be decoded by ffmpeg.
- Temporary files are cleaned up automatically after processing.
- Scene detection and AV1 encoding may take a long time depending on file size and system performance.
License
See repository for
Description
Languages
Python
100%