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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user