Ray Data video API
ray.data.read_datasource
ray.data.read_datasource(
datasource: VideoDatasource,
*,
paths: str
) -> Dataset
info
This API depends on decord
. To install it, run
pip install decord
.
Read videos into a Ray Dataset. Ray Data stores each frame in a separate row.
This Datasource
supports any video format supported by Decord. Supported formats include
MP4, MOV, and AVI. For the list of supported formats, see the
FFMPEG documentation.
Parameters
datasource
: AVideoDatasource
.paths
: A file path or list of file paths to read video files from.
Returns
A Ray Dataset that contains the video frames.
Examples
import ray
from ray.anyscale.data import VideoDatasource
ds = ray.data.read_datasource(
VideoDatasource(),
paths="basketball.mp4"
)