Yukang commited on
Commit
17fa0d6
·
verified ·
1 Parent(s): ab6447b

Update media.py

Browse files
Files changed (1) hide show
  1. media.py +1 -3
media.py CHANGED
@@ -103,9 +103,7 @@ def _load_video_with_fps(video_path: str, *, num_frames: int, fps: float) -> Lis
103
  raise ValueError(f"Video '{video_path}' seems to be empty or corrupted.")
104
 
105
  # Compute total frames to sample based on desired fps
106
- sampled_frame_count = int(duration_sec * fps)
107
- sampled_frame_count = ((sampled_frame_count + 127) // 128) * 128
108
- sampled_frame_count = min(sampled_frame_count, num_frames)
109
 
110
  # Compute which frame indices to sample
111
  indices = np.linspace(0, frame_count - 1, sampled_frame_count).astype(int)
 
103
  raise ValueError(f"Video '{video_path}' seems to be empty or corrupted.")
104
 
105
  # Compute total frames to sample based on desired fps
106
+ sampled_frame_count = min(((int(duration_sec * fps) + 127) // 128) * 128, ((num_frames + 127) // 128) * 128)
 
 
107
 
108
  # Compute which frame indices to sample
109
  indices = np.linspace(0, frame_count - 1, sampled_frame_count).astype(int)