diff --git a/vllm/multimodal/video.py b/vllm/multimodal/video.py index 4a82dd24e75..c9751ecc66a 100644 --- a/vllm/multimodal/video.py +++ b/vllm/multimodal/video.py @@ -885,7 +885,6 @@ class GLM46VVideoBackend(VideoBackend): extract_t = min(extract_t, cls._MAX_FRAME_COUNT_DYNAMIC) duration_per_frame = 1 / original_fps if original_fps > 0 else 0 - timestamps = [i * duration_per_frame for i in range(total_frames_num)] max_second = int(duration) if duration else 0 if total_frames_num < extract_t: @@ -897,7 +896,7 @@ class GLM46VVideoBackend(VideoBackend): current_second = 0.0 inv_fps = 1 / (temporal_patch_size * target_fps) for frame_index in range(total_frames_num): - if timestamps[frame_index] >= current_second: + if frame_index * duration_per_frame >= current_second: current_second += inv_fps frame_indices.append(frame_index) if current_second >= max_second: @@ -991,7 +990,6 @@ class GLMGAVideoBackend(VideoBackend): extract_t = min(extract_t, max_frames) duration_per_frame = 1 / original_fps - timestamps = [i * duration_per_frame for i in range(total_frames_num)] if total_frames_num < extract_t: frame_indices = [ @@ -1002,7 +1000,7 @@ class GLMGAVideoBackend(VideoBackend): current_second = 0.0 inv_fps = 1 / target_fps for frame_index in range(total_frames_num): - if timestamps[frame_index] >= current_second: + if frame_index * duration_per_frame >= current_second: current_second += inv_fps frame_indices.append(frame_index) if current_second >= duration - inv_fps: