Updated readme and added additional optional parameters
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# Anime Audio Helper
|
# SVT-AV1-Essential-helper
|
||||||
|
|
||||||
A batch-processing tool for MKV files, designed for high-quality AV1 video encoding and efficient audio handling. This script is tailored for anime and similar content, with a focus on automation, quality, and flexibility.
|
A batch-processing tool for MKV files, designed for high-quality AV1 video encoding and efficient audio handling. This script is tailored for anime and similar content, with a focus on automation, quality, and flexibility.
|
||||||
|
|
||||||
@@ -27,11 +27,14 @@ A batch-processing tool for MKV files, designed for high-quality AV1 video encod
|
|||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
python anime_audio_helper.py [--no-downmix] [--autocrop]
|
python anime_audio_helper.py [--no-downmix] [--autocrop] [--speed <value>] [--quality <value>] [--grain <value>]
|
||||||
```
|
```
|
||||||
|
|
||||||
- `--no-downmix` : Preserve original audio channel layout (do not force stereo)
|
- `--no-downmix` : Preserve original audio channel layout (do not force stereo)
|
||||||
- `--autocrop` : Automatically detect and crop black bars from video
|
- `--autocrop` : Automatically detect and crop black bars from video
|
||||||
|
- `--speed` : Set the encoding speed. Possible values: `slower`, `slow`, `medium`, `fast`, `faster`.
|
||||||
|
- `--quality` : Set the encoding quality. Possible values: `lowest`, `low`, `medium`, `high`, `higher`.
|
||||||
|
- `--grain` : Set the film-grain value (number). Adjusts the film grain synthesis level.
|
||||||
|
|
||||||
Place your `.mkv` files in the script directory. Processed files will be moved to `completed/`, and originals to `original/`. Logs are saved in `conv_logs/`.
|
Place your `.mkv` files in the script directory. Processed files will be moved to `completed/`, and originals to `original/`. Logs are saved in `conv_logs/`.
|
||||||
|
|
||||||
|
|||||||
@@ -465,8 +465,16 @@ def detect_autocrop_filter(input_file, significant_crop_threshold=5.0, min_crop=
|
|||||||
return None
|
return None
|
||||||
return _analyze_video_cropdetect(input_file, duration, width, height, max(1, os.cpu_count() // 2), significant_crop_threshold, min_crop, debug)
|
return _analyze_video_cropdetect(input_file, duration, width, height, max(1, os.cpu_count() // 2), significant_crop_threshold, min_crop, debug)
|
||||||
|
|
||||||
def main(no_downmix=False, autocrop=False):
|
def main(no_downmix=False, autocrop=False, speed=None, quality=None, grain=None):
|
||||||
check_tools()
|
check_tools()
|
||||||
|
# Update SVT_AV1_PARAMS with any provided arguments
|
||||||
|
if speed is not None:
|
||||||
|
SVT_AV1_PARAMS['speed'] = speed
|
||||||
|
if quality is not None:
|
||||||
|
SVT_AV1_PARAMS['quality'] = quality
|
||||||
|
if grain is not None:
|
||||||
|
SVT_AV1_PARAMS['film-grain'] = grain
|
||||||
|
|
||||||
current_dir = Path(".")
|
current_dir = Path(".")
|
||||||
files_to_process = sorted(
|
files_to_process = sorted(
|
||||||
f for f in current_dir.glob("*.mkv")
|
f for f in current_dir.glob("*.mkv")
|
||||||
@@ -544,7 +552,7 @@ def main(no_downmix=False, autocrop=False):
|
|||||||
print(f" - Detected VFR based on MediaInfo FrameRate_Mode: {frame_rate_mode}")
|
print(f" - Detected VFR based on MediaInfo FrameRate_Mode: {frame_rate_mode}")
|
||||||
original_fps_str = video_track_info.get("FrameRate_Original_String")
|
original_fps_str = video_track_info.get("FrameRate_Original_String")
|
||||||
if original_fps_str:
|
if original_fps_str:
|
||||||
match = re.search(r'\((\d+/\d+)\)', original_fps_str)
|
match = re.search(r'\\((\\d+)/(\\d+)\\)', original_fps_str)
|
||||||
if match:
|
if match:
|
||||||
target_cfr_fps_for_handbrake = match.group(1)
|
target_cfr_fps_for_handbrake = match.group(1)
|
||||||
else:
|
else:
|
||||||
@@ -752,5 +760,8 @@ if __name__ == "__main__":
|
|||||||
parser = argparse.ArgumentParser(description="Batch-process MKV files with resumable video encoding, audio downmixing, per-file logging, and optional autocrop.")
|
parser = argparse.ArgumentParser(description="Batch-process MKV files with resumable video encoding, audio downmixing, per-file logging, and optional autocrop.")
|
||||||
parser.add_argument("--no-downmix", action="store_true", help="Preserve original audio channel layout.")
|
parser.add_argument("--no-downmix", action="store_true", help="Preserve original audio channel layout.")
|
||||||
parser.add_argument("--autocrop", action="store_true", help="Automatically detect and crop black bars from video using cropdetect.")
|
parser.add_argument("--autocrop", action="store_true", help="Automatically detect and crop black bars from video using cropdetect.")
|
||||||
|
parser.add_argument("--speed", type=str, help="Set the encoding speed. Possible values: slower, slow, medium, fast, faster.")
|
||||||
|
parser.add_argument("--quality", type=str, help="Set the encoding quality. Possible values: lowest, low, medium, high, higher.")
|
||||||
|
parser.add_argument("--grain", type=int, help="Set the film-grain value (number). Adjusts the film grain synthesis level.")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
main(no_downmix=args.no_downmix, autocrop=args.autocrop)
|
main(no_downmix=args.no_downmix, autocrop=args.autocrop, speed=args.speed, quality=args.quality, grain=args.grain)
|
||||||
|
|||||||
Reference in New Issue
Block a user