View Source Membrane.RawVideo (Membrane: Raw video format v0.2.0)

This module provides a struct (Membrane.RawVideo.t/0) describing raw video frames.

Link to this section Summary

Types

Determines, whether buffers are aligned i.e. each buffer contains one frame.

Number of frames per second. To avoid using floating point numbers, it is described by 2 integers number of frames per timeframe in seconds.

Height of single frame in pixels.

Format used to encode the color of every pixel in each video frame.

t()

Width of single frame in pixels.

Functions

Simple wrapper over frame_size/3. Returns the size of raw video frame in bytes for the given caps.

Returns the size of raw video frame in bytes (without padding).

Link to this section Types

Specs

aligned_t() :: boolean()

Determines, whether buffers are aligned i.e. each buffer contains one frame.

Specs

framerate_t() :: {frames :: non_neg_integer(), seconds :: pos_integer()}

Number of frames per second. To avoid using floating point numbers, it is described by 2 integers number of frames per timeframe in seconds.

For example, NTSC's framerate of ~29.97 fps is represented by {30_000, 1001}

Specs

height_t() :: pos_integer()

Height of single frame in pixels.

Specs

pixel_format_t() ::
  :I420 | :I422 | :I444 | :RGB | :BGRA | :RGBA | :NV12 | :NV21 | :YV12 | :AYUV

Format used to encode the color of every pixel in each video frame.

Specs

t() :: %Membrane.RawVideo{
  aligned: aligned_t(),
  framerate: framerate_t(),
  height: height_t(),
  pixel_format: pixel_format_t(),
  width: width_t()
}

Specs

width_t() :: pos_integer()

Width of single frame in pixels.

Link to this section Functions

Specs

frame_size(t()) :: {:ok, pos_integer()} | {:error, reason}
when reason: :invalid_dimensions | :invalid_pixel_format

Simple wrapper over frame_size/3. Returns the size of raw video frame in bytes for the given caps.

Link to this function

frame_size(format, width, height)

View Source

Specs

frame_size(pixel_format_t(), width_t(), height_t()) ::
  {:ok, pos_integer()} | {:error, reason}
when reason: :invalid_dimensions | :invalid_pixel_format

Returns the size of raw video frame in bytes (without padding).

It may result in error when dimensions don't fulfill requirements for the given format (e.g. I420 requires both dimensions to be divisible by 2).