From 810d90324432b99dbe58f25b5782ba4301615ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=B7=E5=AE=87=E4=BD=B3?= Date: Tue, 4 Mar 2025 17:56:16 +0800 Subject: [PATCH] =?UTF-8?q?FIX=20=E5=A2=9E=E5=8A=A0=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=88=AA=E5=8F=96=E9=95=BF=E5=BA=A6=E4=BF=9D=E8=AF=81=E8=AF=9D?= =?UTF-8?q?=E8=AF=B4=E5=AE=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nodes/compute_video_point.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nodes/compute_video_point.py b/nodes/compute_video_point.py index 5bd9d3a..d4aa267 100644 --- a/nodes/compute_video_point.py +++ b/nodes/compute_video_point.py @@ -10,7 +10,8 @@ def validate_time_format(time_str): def get_duration_wave(audio): waveform, sample_rate = audio["waveform"], audio["sample_rate"] - return waveform.shape[2] / sample_rate + # 防止话说不完 + return ceil(waveform.shape[2] / sample_rate) + 1 class VideoStartPointDurationCompute: @@ -40,5 +41,5 @@ class VideoStartPointDurationCompute: start_sec = (start_dt - datetime(1900, 1, 1)).total_seconds() start_point = int(start_sec * fps) print("audio duration %.2f s"%get_duration_wave(audio)) - duration = ceil(get_duration_wave(audio) * fps) + duration = get_duration_wave(audio) * fps return (start_point, duration,)