View Source Xav.Frame (xav v0.10.0)

Audio/video frame.

Summary

Types

Possible audio samples formats.

t()

Possible video frame formats.

Functions

Creates a new audio/video frame.

Converts a frame to an Nx tensor.

Types

@type audio_format() :: :u8 | :s16 | :s32 | :s64 | :f32 | :f64

Possible audio samples formats.

@type format() :: audio_format() | video_format()
@type height() :: non_neg_integer() | nil
@type t() :: %Xav.Frame{
  data: binary(),
  format: format(),
  height: height(),
  pts: integer(),
  samples: integer() | nil,
  type: :audio | :video,
  width: width()
}
@type video_format() :: atom()

Possible video frame formats.

The list of accepted formats are all ffmpeg pixel formats. For a complete list run:

ffmpeg -pix_fmts

An example of a pixel format is :rgb24.

@type width() :: non_neg_integer() | nil

Functions

Link to this function

new(data, format, samples, pts)

View Source
@spec new(binary(), format(), integer(), integer()) :: t()
Link to this function

new(data, format, width, height, pts)

View Source
@spec new(binary(), format(), non_neg_integer(), non_neg_integer(), integer()) :: t()

Creates a new audio/video frame.

@spec to_nx(t()) :: Nx.Tensor.t()

Converts a frame to an Nx tensor.

In case of a video frame, dimension names of the newly created tensor are [:height, :width, :channels].