Removed extra scene-detection step
This commit is contained in:
@@ -103,7 +103,6 @@ def convert_audio_track(index, ch, lang, audio_temp_dir, source_file, should_dow
|
|||||||
def convert_video(source_file_base, source_file_full, is_vfr, target_cfr_fps_for_handbrake, autocrop_filter=None):
|
def convert_video(source_file_base, source_file_full, is_vfr, target_cfr_fps_for_handbrake, autocrop_filter=None):
|
||||||
print(" --- Starting Video Processing ---")
|
print(" --- Starting Video Processing ---")
|
||||||
# source_file_base is file_path.stem (e.g., "my.anime.episode.01")
|
# source_file_base is file_path.stem (e.g., "my.anime.episode.01")
|
||||||
scene_file = Path(f"{source_file_base}.txt")
|
|
||||||
vpy_file = Path(f"{source_file_base}.vpy")
|
vpy_file = Path(f"{source_file_base}.vpy")
|
||||||
ut_video_file = Path(f"{source_file_base}.ut.mkv")
|
ut_video_file = Path(f"{source_file_base}.ut.mkv")
|
||||||
encoded_video_file = Path(f"temp-{source_file_base}.mkv")
|
encoded_video_file = Path(f"temp-{source_file_base}.mkv")
|
||||||
@@ -176,15 +175,6 @@ clip.set_output()
|
|||||||
with vpy_file.open("w", encoding="utf-8") as f:
|
with vpy_file.open("w", encoding="utf-8") as f:
|
||||||
f.write(vpy_script_content)
|
f.write(vpy_script_content)
|
||||||
|
|
||||||
if not scene_file.exists():
|
|
||||||
print(" - Performing scene detection with av1an...")
|
|
||||||
av1an_sc_args = [
|
|
||||||
"av1an", "-i", str(vpy_file), "-s", str(scene_file), "--sc-only", "--verbose"
|
|
||||||
]
|
|
||||||
run_cmd(av1an_sc_args)
|
|
||||||
else:
|
|
||||||
print(" - Found existing scene file, skipping detection.")
|
|
||||||
|
|
||||||
print(" - Starting AV1 encode with av1an (this will take a long time)...")
|
print(" - Starting AV1 encode with av1an (this will take a long time)...")
|
||||||
total_cores = os.cpu_count() or 4 # Fallback if cpu_count is None
|
total_cores = os.cpu_count() or 4 # Fallback if cpu_count is None
|
||||||
workers = max(1, (total_cores // 2) - 1) # Half the cores minus one, with a minimum of 1 worker.
|
workers = max(1, (total_cores // 2) - 1) # Half the cores minus one, with a minimum of 1 worker.
|
||||||
@@ -195,7 +185,7 @@ clip.set_output()
|
|||||||
print(f" - Using SVT-AV1 parameters: {av1an_video_params_str}")
|
print(f" - Using SVT-AV1 parameters: {av1an_video_params_str}")
|
||||||
|
|
||||||
av1an_enc_args = [
|
av1an_enc_args = [
|
||||||
"av1an", "-i", str(vpy_file), "-o", str(encoded_video_file), "-s", str(scene_file), "-n",
|
"av1an", "-i", str(vpy_file), "-o", str(encoded_video_file), "-n",
|
||||||
"-e", "svt-av1", "--resume", "--sc-pix-format", "yuv420p", "-c", "mkvmerge",
|
"-e", "svt-av1", "--resume", "--sc-pix-format", "yuv420p", "-c", "mkvmerge",
|
||||||
"--set-thread-affinity", "2", "--pix-format", "yuv420p10le", "--force",
|
"--set-thread-affinity", "2", "--pix-format", "yuv420p10le", "--force",
|
||||||
"-w", str(workers),
|
"-w", str(workers),
|
||||||
@@ -657,7 +647,6 @@ def main(no_downmix=False, autocrop=False, speed=None, quality=None, grain=None)
|
|||||||
|
|
||||||
print("Cleaning up persistent video temporary files (after successful processing)...")
|
print("Cleaning up persistent video temporary files (after successful processing)...")
|
||||||
video_temp_files_on_success = [
|
video_temp_files_on_success = [
|
||||||
current_dir / f"{file_path.stem}.txt",
|
|
||||||
current_dir / f"{file_path.stem}.vpy",
|
current_dir / f"{file_path.stem}.vpy",
|
||||||
current_dir / f"{file_path.stem}.ut.mkv",
|
current_dir / f"{file_path.stem}.ut.mkv",
|
||||||
current_dir / f"temp-{file_path.stem}.mkv", # This is encoded_video_file
|
current_dir / f"temp-{file_path.stem}.mkv", # This is encoded_video_file
|
||||||
|
|||||||
Reference in New Issue
Block a user