Skip to main content

Video API

Check your docs version

This version of the Anyscale docs is deprecated. Go to the latest version for up to date information.

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: A VideoDatasource.
  • 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"
)