Rate this Page

FrameBatch#

class torchcodec.FrameBatch(data: Tensor, pts_seconds: Tensor, duration_seconds: Tensor)[source]#

Multiple video frames with associated metadata.

The data tensor is typically 4D for sequences of frames (NHWC or NCHW), or 5D for sequences of clips, as returned by the samplers. When data is 4D (resp. 5D) the pts_seconds and duration_seconds tensors are 1D (resp. 2D).

Note

The pts_seconds and duration_seconds Tensors are always returned on CPU, even if data is on GPU.

Examples using FrameBatch:

Decoding a video with VideoDecoder

Decoding a video with VideoDecoder

Parallel video decoding: multi-processing and multi-threading

Parallel video decoding: multi-processing and multi-threading

How to sample video clips

How to sample video clips
data: Tensor#

The frames data (torch.Tensor of uint8).

duration_seconds: Tensor#

The duration of the frame, in seconds (torch.Tensor of floats).

pts_seconds: Tensor#

The pts of the frame, in seconds (torch.Tensor of floats).