feat: replace Decord with video_reader-rs (#5163)

Signed-off-by: Xinyuan Tong <justinning0323@outlook.com>
Co-authored-by: Xinyuan Tong <justinning0323@outlook.com>
This commit is contained in:
kozo
2025-07-16 09:17:34 +08:00
committed by GitHub
parent f06bd210c0
commit ebff5fcb06
6 changed files with 16 additions and 21 deletions

View File

@@ -206,7 +206,7 @@ class BaseMultimodalProcessor(ABC):
estimate the total frame count from all visual input
"""
# Lazy import because decord is not available on some arm platforms.
from decord import VideoReader, cpu
from video_reader import PyVideoReader, cpu
# Before processing inputs
if not image_data or len(image_data) == 0:
@@ -216,7 +216,7 @@ class BaseMultimodalProcessor(ABC):
if isinstance(image, str) and image.startswith("video:"):
path = image[len("video:") :]
# Estimate frames for the video
vr = VideoReader(path, ctx=cpu(0))
vr = PyVideoReader(path, threads=0)
num_frames = len(vr)
else:
# For images, each contributes one frame