Membrane.HLS.TrimAlign (Membrane HLS Plugin v3.0.10)

Copy Markdown View Source

Trims leading buffers so all input pads start at a common synchronization point.

When H264 pads are present, synchronization is anchored on H264 keyframe cut points. The aligner chooses the earliest H264 cut point for which all non-H264 pads have already started (first_ts <= cut_point). If this is not satisfied, it advances to the next H264 cut point and retries.

Without H264 pads, synchronization falls back to the latest first cuttable timestamp among all pads.

For %Membrane.Text{} pads, if the selected cut point lands inside a subtitle cue (buffer.pts < cut_point < buffer.metadata.to), the first forwarded cue is clipped to start exactly at the cut point instead of being dropped.

H264 pads can only be trimmed at keyframe boundaries and require parser metadata (%Membrane.H264{alignment: :au, nalu_in_metadata?: true}).

Element options

Passed via struct Membrane.HLS.TrimAlign.t/0

  • max_leading_trim

    Membrane.Time.t()

    Default value: 3000000000
    Maximum amount of leading content that can be trimmed from a single pad.

  • max_queued_buffers

    pos_integer()

    Default value: 2000
    Maximum number of buffers allowed in a single pad queue before alignment is established.

Pads

:input

Accepted formats:

_any
Direction::input
Availability::on_request
Flow control::auto

Pad options:

  • cut_strategy
    cut_strategy()
    Default value: :any
    Defines where trimming can cut:
    • :any - cut at any buffer boundary
    • :h264_keyframe - cut only on H264 keyframe AUs

:output

Accepted formats:

_any
Direction::output
Availability::on_request
Flow control::auto

Summary

Types

Options for pad :input

t()

Struct containing options for Membrane.HLS.TrimAlign

Functions

Returns description of options available for this module

Types

cut_strategy()

@type cut_strategy() :: :any | :h264_keyframe

input_pad_opts()

@type input_pad_opts() :: [{:cut_strategy, cut_strategy()}]

Options for pad :input

t()

@type t() :: %Membrane.HLS.TrimAlign{
  max_leading_trim: Membrane.Time.t(),
  max_queued_buffers: pos_integer()
}

Struct containing options for Membrane.HLS.TrimAlign

Functions

options()

@spec options() :: keyword()

Returns description of options available for this module