From b3c993b4a06ea3f3c7e93d036195362f49400965 Mon Sep 17 00:00:00 2001 From: pat-e Date: Sat, 2 Aug 2025 13:47:23 +0200 Subject: [PATCH] added "frames" counter for pipe-encoding --- anime_audio_helper.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/anime_audio_helper.py b/anime_audio_helper.py index c2750bc..39394c5 100644 --- a/anime_audio_helper.py +++ b/anime_audio_helper.py @@ -161,7 +161,7 @@ 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)...") - # Probe UTVideo file for width and height + # Probe UTVideo file for width, height, and frame count ffprobe_dim_cmd = [ "ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries", "stream=width,height", "-of", "json", ut_video_full_path @@ -171,10 +171,20 @@ def convert_video(source_file_base, source_file_full, is_vfr, target_cfr_fps_for width = ffprobe_dim['streams'][0]['width'] height = ffprobe_dim['streams'][0]['height'] + ffprobe_framecount_cmd = [ + "ffprobe", "-v", "error", "-select_streams", "v:0", + "-count_frames", "-show_entries", "stream=nb_read_frames", + "-of", "json", ut_video_full_path + ] + ffprobe_framecount_json = run_cmd(ffprobe_framecount_cmd, capture_output=True) + ffprobe_framecount = json.loads(ffprobe_framecount_json) + frame_count = int(ffprobe_framecount['streams'][0].get('nb_read_frames', 0)) + svtav1_param_list = [ "--input-depth", "10", "--width", str(width), - "--height", str(height) + "--height", str(height), + "--frames", str(frame_count) ] for k, v in SVT_AV1_PARAMS.items(): if isinstance(v, bool):