View Source Membrane.RawVideo (Membrane: Raw video format v0.4.1)
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.
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
@type aligned() :: boolean()
Determines, whether buffers are aligned i.e. each buffer contains one frame.
@type framerate() :: {frames :: non_neg_integer(), seconds :: pos_integer()} | nil
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}
.
If the information about the framerate is not present in the stream, nil
value
should be used and the buffers described by this stream format must have non-nil timestamps.
@type height() :: pos_integer()
Height of single frame in pixels.
@type pixel_format() ::
:I420
| :I422
| :I444
| :RGB
| :BGRA
| :RGBA
| :NV12
| :NV21
| :YV12
| :AYUV
| :YUY2
Format used to encode the color of every pixel in each video frame.
@type t() :: %Membrane.RawVideo{ aligned: aligned(), framerate: framerate(), height: height(), pixel_format: pixel_format(), width: width() }
@type width() :: pos_integer()
Width of single frame in pixels.
Link to this section Functions
@spec 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.
@spec frame_size(pixel_format(), width(), height()) :: {: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).