spdl.io.convert_frames

convert_frames(frames: AudioFrames | VideoFrames | ImageFrames | list[AudioFrames] | list[VideoFrames] | list[ImageFrames], storage: CPUStorage | None = None, **kwargs) CPUBuffer[source]

Convert the decoded frames to buffer.

Parameters:
Returns:

A Buffer object.

The shape of the buffer obejct is

  • AudioFrames -> [C, H] or [N, C].

  • VideoFrames -> [N, C, H, W] or [N, H, W, C].

  • ImageFrames -> [C, H, W].

  • list[AudioFrames] -> [B, C, H] or [B, N, C].

  • list[VideoFrames] -> [B, N, C, H, W] or [B, N, H, W, C].

  • list[ImageFrames] -> [B, C, H, W].

where

  • B: batch

  • C: channel (color channel or audio channel)

  • N: frames

  • W: width

  • H: height