Membrane.VideoInterop.RawVideo (membrane_video_interop v0.1.0)

Copy Markdown View Source

Converts tightly framed RGB and straight-alpha RGBA video between VideoInterop and Membrane.RawVideo.

Membrane.RawVideo cannot represent visible cropping, pixel aspect ratio, interlacing, alpha interpretation, or colorimetry. Conversion therefore requires a full visible frame, square pixels, progressive scan, and straight alpha for RGBA. Colorimetry is not carried by Membrane.RawVideo.

Summary

Functions

Converts one aligned, tightly packed RGB or RGBA Membrane buffer into an owned VideoInterop frame.

Copies one owned binary frame into a tightly packed Membrane buffer.

Functions

format_to_raw(format)

@spec format_to_raw(VideoInterop.Format.t()) ::
  {:ok, Membrane.RawVideo.t()} | {:error, term()}

frame_from_buffer(buffer, raw)

@spec frame_from_buffer(Membrane.Buffer.t(), Membrane.RawVideo.t()) ::
  {:ok, VideoInterop.Frame.t()} | {:error, term()}

Converts one aligned, tightly packed RGB or RGBA Membrane buffer into an owned VideoInterop frame.

RGBA payloads are interpreted as straight alpha. Buffer timestamps and metadata remain transport concerns and are not copied into the frame.

frame_to_buffer(frame)

@spec frame_to_buffer(VideoInterop.Frame.t()) ::
  {:ok, Membrane.Buffer.t(), Membrane.RawVideo.t()} | {:error, term()}

Copies one owned binary frame into a tightly packed Membrane buffer.

The input must describe a full, progressive RGB or straight-alpha RGBA frame. DMA-BUF storage and cropped frames are not copied by this helper.