[bugfix] Qwen3-VL fix video incorrect timestamp calculations while do_sample_frames=True (#27104)

Co-authored-by: 松灵 <wpf272043@alibaba-inc.com>
This commit is contained in:
2025-10-18 00:26:33 +08:00
committed by GitHub
parent b038d9c40c
commit 4c91a28e30

View File

@ -735,9 +735,9 @@ class Qwen3VLProcessingInfo(Qwen2VLProcessingInfo):
if do_sample_frames:
# here video_fps is the fps of the sampled video, and
# metadata["fps"] refers to the fps of the original video.
video_fps = sampled_fps if sampled_fps else video_processor.fps
sampled_fps = sampled_fps if sampled_fps else video_processor.fps
total_num_frames = metadata["total_num_frames"]
num_frames = int(total_num_frames / metadata["fps"] * video_fps)
num_frames = int(total_num_frames / metadata["fps"] * sampled_fps)
num_frames = min(
min(
max(num_frames, video_processor.min_frames),