[Bugfix] Fix base64 JPEG video frames returning empty metadata (#37301)
Signed-off-by: Yufeng He <40085740+universeplayer@users.noreply.github.com> Signed-off-by: Yufeng He <40085740+he-yufeng@users.noreply.github.com> Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn> Co-authored-by: Yufeng He <40085740+universeplayer@users.noreply.github.com> Co-authored-by: Isotr0py <mozf@mail2.sysu.edu.cn>
This commit is contained in:
co-authored by
Yufeng He
Isotr0py
parent
98b09ddc27
commit
918b7890a1
@@ -80,9 +80,21 @@ class VideoMediaIO(MediaIO[tuple[npt.NDArray, dict[str, Any]]]):
|
||||
"image/jpeg",
|
||||
)
|
||||
|
||||
return np.stack(
|
||||
frames = np.stack(
|
||||
[np.asarray(load_frame(frame_data)) for frame_data in data.split(",")]
|
||||
), {}
|
||||
)
|
||||
total = int(frames.shape[0])
|
||||
fps = float(self.kwargs.get("fps", 1))
|
||||
duration = total / fps if fps > 0 else 0.0
|
||||
metadata = {
|
||||
"total_num_frames": total,
|
||||
"fps": fps,
|
||||
"duration": duration,
|
||||
"video_backend": "jpeg_sequence",
|
||||
"frames_indices": list(range(total)),
|
||||
"do_sample_frames": False,
|
||||
}
|
||||
return frames, metadata
|
||||
|
||||
return self.load_bytes(pybase64.b64decode(data))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user