Updated readme-files and sox-command
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
This is a collection of Python scripts for various video and audio processing tasks, such as encoding video to AV1 and audio to Opus.
|
||||
|
||||
## Scripts
|
||||
|
||||
- **[anime_audio_encoder.py](anime_audio_encoder.py)**: A script tailored for encoding anime. It handles Variable Frame Rate (VFR) sources and uses `av1an` for AV1 encoding. Now supports `--autocrop` to automatically crop black bars using cropdetect logic, applied to the UTVideo intermediate file. For more details, see the [Anime Audio Encoder README](README_Anime%20Audio%20Encoder.md).
|
||||
|
||||
-
|
||||
- **av1_opus_encoder.py**: The primary script for creating high-quality AV1/Opus encodes. It handles Variable Frame Rate (VFR) sources, uses `av1an` for efficient AV1 encoding, and supports automatic black bar cropping. For more details, see the AV1 Opus Encoder README.
|
||||
-
|
||||
- **[tv_audio_encoder.py](tv_audio_encoder.py)**: A script designed for encoding TV show episodes. It uses `alabamaEncoder` for the video encoding process. Now supports `--autocrop` to automatically crop black bars using cropdetect logic, applied to the UTVideo intermediate file. For more details, see the [TV Audio Encoder README](README_TV%20Audio%20Encoder.md).
|
||||
|
||||
- **[MkvOpusEnc.py](MkvOpusEnc.py)**: A cross-platform script for batch-processing audio tracks in MKV files to the Opus format. For more details, see the [MkvOpusEnc README](README_MkvOpusEnc.md).
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
# Anime Audio Encoder
|
||||
|
||||
## Overview
|
||||
|
||||
`anime_audio_encoder.py` is a comprehensive batch-processing script for MKV files, specifically tailored for modern anime encoding workflows. It automates the entire pipeline, including advanced video encoding with AV1 (via `av1an`), sophisticated audio conversion to Opus, and intelligent handling of both Variable Frame Rate (VFR) and Constant Frame Rate (CFR) sources. To ensure transparency and aid in debugging, the script also preserves detailed, per-file logs of the entire conversion process.
|
||||
|
||||
## Features
|
||||
|
||||
* **Advanced Video Encoding:** Uses a robust VapourSynth-based pipeline with `av1an` and SVT-AV1 for efficient, high-quality AV1 video encoding.
|
||||
* **VFR Handling:** Automatically detects Variable Frame Rate (VFR) sources using `mediainfo` and converts them to Constant Frame Rate (CFR) with `HandBrakeCLI` before encoding, ensuring broader playback compatibility.
|
||||
* **Detailed Logging:** Creates a separate, detailed log file for each processed MKV in the `conv_logs/` directory, capturing the full terminal output for easy review.
|
||||
* **Sophisticated Audio Processing:** Converts common audio formats to normalized Opus files. It provides an option to downmix surround sound to stereo or preserve the original channel layout.
|
||||
* **File Organization:** Keeps your workspace tidy by automatically moving original files to `original/` and completed encodes to `completed/`.
|
||||
* **Resumable & Efficient:** The script processes files one by one and uses `av1an`'s resume feature, making it easy to continue an encoding batch if it's interrupted.
|
||||
|
||||
## Requirements
|
||||
|
||||
The following command-line tools must be installed and available in your system's PATH:
|
||||
|
||||
* `ffmpeg`
|
||||
* `ffprobe`
|
||||
* `mkvmerge`
|
||||
* `mkvpropedit`
|
||||
* `sox`
|
||||
* `opusenc`
|
||||
* `mediainfo`
|
||||
* `av1an`
|
||||
* `HandBrakeCLI`
|
||||
|
||||
## Usage
|
||||
|
||||
1. Place your `.mkv` files in the same directory as the script.
|
||||
2. Make the script executable (on Linux/macOS) by running `chmod +x anime_audio_encoder.py`.
|
||||
3. Execute the script from your terminal:
|
||||
```bash
|
||||
./anime_audio_encoder.py
|
||||
```
|
||||
|
||||
### Optional Arguments
|
||||
|
||||
* `--no-downmix`: By default, the script downmixes surround sound audio (e.g., 5.1) to stereo. Use this flag to preserve the original audio channel layout.
|
||||
```bash
|
||||
./anime_audio_encoder.py --no-downmix
|
||||
```
|
||||
|
||||
* `--autocrop`: Automatically detect and crop black bars from video using cropdetect. The crop is applied only to the UTVideo intermediate file, ensuring no image data is lost even with variable crops.
|
||||
```bash
|
||||
./anime_audio_encoder.py --autocrop
|
||||
```
|
||||
You can combine with `--no-downmix`:
|
||||
```bash
|
||||
./anime_audio_encoder.py --autocrop --no-downmix
|
||||
```
|
||||
|
||||
## Output
|
||||
|
||||
* Processed files are moved to the `completed/` directory.
|
||||
* Original files are moved to the `original/` directory.
|
||||
* Per-file logs are saved in the `conv_logs/` directory.
|
||||
|
||||
## Notes
|
||||
|
||||
* The script is primarily designed for **Linux/macOS** environments.
|
||||
* The script will check if a file can be decoded by `ffmpeg` before processing and will skip corrupted or unsupported files.
|
||||
* The entire process, especially scene detection and AV1 encoding, can be very time-consuming and
|
||||
64
README_av1_opus_encoder.md
Normal file
64
README_av1_opus_encoder.md
Normal file
@@ -0,0 +1,64 @@
|
||||
# AV1 Opus Encoder
|
||||
|
||||
## Overview
|
||||
|
||||
`av1_opus_encoder.py` is a comprehensive, all-in-one batch-processing script for MKV files, designed for modern encoding workflows. It automates the entire pipeline, including advanced video encoding with AV1 (via `av1an`), sophisticated audio conversion to Opus, and intelligent handling of both Variable Frame Rate (VFR) and Constant Frame Rate (CFR) sources. To ensure transparency and aid in debugging, the script also preserves detailed, per-file logs of the entire conversion process.
|
||||
|
||||
This script serves as the primary tool for creating high-quality, efficient AV1/Opus encodes.
|
||||
|
||||
## Features
|
||||
|
||||
* **Advanced Video Encoding:** Uses a robust VapourSynth-based pipeline with `av1an` and SVT-AV1 for efficient, high-quality AV1 video encoding.
|
||||
* **VFR Handling:** Automatically detects Variable Frame Rate (VFR) sources using `mediainfo` and converts them to Constant Frame Rate (CFR) with `HandBrakeCLI` before encoding, ensuring broader playback compatibility.
|
||||
* **Autocrop:** Includes an optional `--autocrop` flag to intelligently detect and remove black bars, maximizing encoding efficiency.
|
||||
* **Detailed Logging:** Creates a separate, detailed log file for each processed MKV in the `conv_logs/` directory, capturing the full terminal output for easy review.
|
||||
* **Loudness-Normalized Audio:** Converts all audio tracks (except AAC/Opus) to the Opus format, using EBU R 128 loudness normalization for a consistent listening experience.
|
||||
* **File Organization:** Keeps your workspace tidy by automatically moving original files to `original/` and completed encodes to `completed/`.
|
||||
* **Resumable & Efficient:** The script processes files one by one and uses `av1an`'s resume feature, making it easy to continue an encoding batch if it's interrupted.
|
||||
|
||||
## Requirements
|
||||
|
||||
The following command-line tools must be installed and available in your system's PATH:
|
||||
|
||||
* `ffmpeg`
|
||||
* `ffprobe`
|
||||
* `mkvmerge`
|
||||
* `mkvpropedit`
|
||||
* `sox` (or `sox-ng`)
|
||||
* `opusenc`
|
||||
* `mediainfo`
|
||||
* `av1an`
|
||||
* `HandBrakeCLI`
|
||||
|
||||
## Usage
|
||||
|
||||
1. Place your `.mkv` files in the same directory as the script.
|
||||
2. Make the script executable (on Linux/macOS) by running `chmod +x av1_opus_encoder.py`.
|
||||
3. Execute the script from your terminal:
|
||||
```bash
|
||||
./av1_opus_encoder.py
|
||||
```
|
||||
|
||||
### Optional Arguments
|
||||
|
||||
* `--no-downmix`: By default, the script downmixes surround sound audio (e.g., 5.1) to stereo. Use this flag to preserve the original audio channel layout.
|
||||
* `--autocrop`: Automatically detect and crop black bars from video. The crop is applied to the UTVideo intermediate file.
|
||||
* `--speed`: Override the default SVT-AV1 encoding speed (e.g., `--speed slow`).
|
||||
* `--quality`: Override the default SVT-AV1 quality level (e.g., `--quality high`).
|
||||
* `--grain`: Override the default SVT-AV1 film grain synthesis level (e.g., `--grain 8`).
|
||||
|
||||
Example with multiple arguments:
|
||||
```bash
|
||||
./av1_opus_encoder.py --autocrop --no-downmix --speed slow
|
||||
```
|
||||
|
||||
## Output
|
||||
|
||||
* Processed files are moved to the `completed/` directory.
|
||||
* Original files are moved to the `original/` directory.
|
||||
* Per-file logs are saved in the `conv_logs/` directory.
|
||||
|
||||
## Notes
|
||||
|
||||
* The script will check if a file can be decoded by `ffmpeg` before processing and will skip corrupted or unsupported files.
|
||||
* The entire process, especially scene detection and AV1 encoding, can be very time-consuming and CPU-intensive.
|
||||
@@ -69,7 +69,7 @@ def convert_audio_track(index, ch, lang, audio_temp_dir, source_file, should_dow
|
||||
|
||||
print(f" - Normalizing Audio Track #{index} with SoX...")
|
||||
run_cmd([
|
||||
"sox", str(temp_extracted), str(temp_normalized), "-S", "--temp", str(audio_temp_path), "--guard", "gain", "-n"
|
||||
"sox", str(temp_extracted), str(temp_normalized), "--temp", str(audio_temp_path), "loudness", "-18"
|
||||
])
|
||||
|
||||
# Set bitrate based on the final channel count of the Opus file.
|
||||
|
||||
Reference in New Issue
Block a user