diff --git a/anime_audio_helper.py b/anime_audio_helper.py index f09b70e..e3ae843 100644 --- a/anime_audio_helper.py +++ b/anime_audio_helper.py @@ -161,7 +161,21 @@ def convert_video(source_file_base, source_file_full, is_vfr, target_cfr_fps_for # --- SVT-AV1 ENCODING (ffmpeg pipe to SvtAv1EncApp) --- print(" - Starting AV1 encode with ffmpeg -> SvtAv1EncApp pipe (this will take a long time)...") - svtav1_param_list = [] + # Probe UTVideo file for width and height + ffprobe_dim_cmd = [ + "ffprobe", "-v", "error", "-select_streams", "v:0", + "-show_entries", "stream=width,height", "-of", "json", ut_video_full_path + ] + ffprobe_dim_json = run_cmd(ffprobe_dim_cmd, capture_output=True) + ffprobe_dim = json.loads(ffprobe_dim_json) + width = ffprobe_dim['streams'][0]['width'] + height = ffprobe_dim['streams'][0]['height'] + + svtav1_param_list = [ + f"--width {width}", + f"--height {height}", + f"--input-depth 10" + ] for k, v in SVT_AV1_PARAMS.items(): if isinstance(v, bool): v = int(v) @@ -175,7 +189,7 @@ def convert_video(source_file_base, source_file_full, is_vfr, target_cfr_fps_for "-pix_fmt", "yuv420p10le", "-f", "yuv4mpegpipe", "-an", "-sn", "-dn", "-map", "0:v:0", "-" ] svtav1_cmd = [ - "SvtAv1EncApp2", "--input", "-", "--output", str(encoded_video_file) + "SvtAv1EncApp2", "-i", "-", "-b", str(encoded_video_file) ] + svtav1_param_list print(f" - Running: {' '.join(ffmpeg_pipe_cmd)} | {' '.join(svtav1_cmd)}")