Video API
Check your docs version
Anyscale is rolling out a new design. If you have preview access to the enhanced experience, use the latest version of the docs and see the migration guide for transitioning.
info
If you want to access this feature, contact the Anyscale team.
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"
)