diff --git a/av1_opus_encoder.py b/av1_opus_encoder.py index 102d5f0..16413e3 100644 --- a/av1_opus_encoder.py +++ b/av1_opus_encoder.py @@ -11,7 +11,7 @@ from pathlib import Path REQUIRED_TOOLS = [ "ffmpeg", "ffprobe", "mkvmerge", "mkvpropedit", - "opusenc", "mediainfo", "av1an", "HandBrakeCLI" # Added HandBrakeCLI + "opusenc", "mediainfo", "av1an", "HandBrakeCLI", "ffmsindex" # Added HandBrakeCLI and ffmsindex ] DIR_COMPLETED = Path("completed") DIR_ORIGINAL = Path("original") @@ -196,11 +196,16 @@ def convert_video(source_file_base, source_file_full, is_vfr, target_cfr_fps_for ffmpeg_args += ["-vf", autocrop_filter] ffmpeg_args += video_codec_args + [str(ut_video_file)] run_cmd(ffmpeg_args) + + print(" - Indexing UTVideo file with ffmsindex for VapourSynth...") + ffmsindex_args = ["ffmsindex", "-f", str(ut_video_file)] + run_cmd(ffmsindex_args) + ut_video_full_path = os.path.abspath(ut_video_file) vpy_script_content = f"""import vapoursynth as vs core = vs.core core.num_threads = 4 -clip = core.lsmas.LWLibavSource(source=r'''{ut_video_full_path}''') +clip = core.ffms2.Source(source=r'''{ut_video_full_path}''') clip = core.resize.Point(clip, format=vs.YUV420P10, matrix_in_s="709") # type: ignore clip.set_output() """ @@ -683,6 +688,7 @@ def main(no_downmix=False, autocrop=False, speed=None, quality=None, grain=None) current_dir / f"{file_path.stem}.ut.mkv", current_dir / f"temp-{file_path.stem}.mkv", # This is encoded_video_file current_dir / f"{file_path.stem}.ut.mkv.lwi", + current_dir / f"{file_path.stem}.ut.mkv.ffindex", ] if handbrake_intermediate_for_cleanup and handbrake_intermediate_for_cleanup.exists(): video_temp_files_on_success.append(handbrake_intermediate_for_cleanup)