View Source Membrane.HTTPAdaptiveStream.SinkBin (Membrane HTTP Adaptive Stream plugin v0.18.4)

Bin responsible for receiving audio and video streams, performing payloading and CMAF muxing to eventually store them using provided storage configuration.

Input streams

Parsed H264 or AAC video or audio streams are expected to be connected via the :input pad. The type of stream has to be specified via the pad's :encoding option.

Output

Specify one of Membrane.HTTPAdaptiveStream.Storages as :storage to configure the sink.

Bin options

Passed via struct Membrane.HTTPAdaptiveStream.SinkBin.t/0

  • manifest_name

    String.t()

    Default value: "index"
    Name of the main manifest file

  • manifest_module

    module

    Required
    Implementation of the Membrane.HTTPAdaptiveStream.Manifest behaviour.

  • storage

    Storage.config_t()

    Required
    Storage configuration. May be one of Membrane.HTTPAdaptiveStream.Storages.*. See Membrane.HTTPAdaptiveStream.Storage behaviour.

  • target_window_duration

    Time.t() | :infinity

    Default value: 40 |> Membrane.Time.seconds()
    Manifest duration is kept above that time, while the oldest segments are removed whenever possible.

  • persist?

    boolean

    Default value: false
    If true, stale segments are removed from the manifest only. Once playback finishes, they are put back into the manifest.

  • mode

    :live | :vod

    Default value: :vod
    Tells if the session is live or a VOD type of broadcast. It can influence type of metadata inserted into the playlist's manifest.

  • hls_mode

    :muxed_av | :separate_av

    Default value: :separate_av
    Option defining how the incoming tracks will be handled and how CMAF will be muxed.

    • In :muxed_av audio will be added to each video rendition, creating CMAF segments that contain both audio and video.
    • In :separate_av audio and video tracks will be separate and synchronization will need to be sorted out by the player.
  • header_naming_fun

    (Manifest.Track.t(), counter :: non_neg_integer() -> String.t())

    Default value: &Membrane.HTTPAdaptiveStream.Manifest.Track.default_header_naming_fun/2
    A function that generates consequent media header names for a given track

  • segment_naming_fun

    (Manifest.Track.t() -> String.t())

    Default value: &Membrane.HTTPAdaptiveStream.Manifest.Track.default_segment_naming_fun/1
    A function that generates consequent segment names for a given track

  • mp4_parameters_in_band?

    boolean()

    Default value: false
    Determines whether the parameter type nalus will be removed from the stream. Inband parameters seem to be legal with MP4, but some players don't respond kindly to them, so use at your own risk. This parameter should be set to true when discontinuity can occur. For example when resolution can change.

  • cleanup_after

    nil | Time.t()

    Default value: nil
    Time after which a fire-and-forget storage cleanup function should run.

    The function will remove all manifests and segments stored during the stream.

Pads

:input

Accepted formats:

Membrane.AAC
Membrane.H264
Direction::input
Availability::on_request

Pad options:

  • encoding

    :AAC | :H264

    Required
    Encoding type determining which parser will be used for the given stream.

  • track_name

    String.t() | nil

    Default value: nil
    Name that will be used to name the media playlist for the given track, as well as its header and segments files. It must not contain any URI reserved characters

  • segment_duration

    Membrane.Time.t()

    Required
    The minimal segment duration of the regular segments.

  • partial_segment_duration

    Membrane.Time.t() | nil

    Default value: nil
    The segment duration of the partial segments. If not set then the bin won't produce any partial segments.

  • max_framerate

    float() | nil

    Default value: nil
    The maximal framerate of video variant. This information is used in master playlist.

    When set to nil then this information won't be added to master playlist. For audio it should be set to nil.

Summary

Types

Options for pad :input

t()

Struct containing options for Membrane.HTTPAdaptiveStream.SinkBin

Functions

Returns description of options available for this module

Types

@type input_pad_opts() :: [
  encoding: :AAC | :H264,
  track_name: String.t() | nil,
  segment_duration: Membrane.Time.t(),
  partial_segment_duration: Membrane.Time.t() | nil,
  max_framerate: float() | nil
]

Options for pad :input

@type t() :: %Membrane.HTTPAdaptiveStream.SinkBin{
  cleanup_after: nil | Membrane.Time.t(),
  header_naming_fun:
    (Membrane.HTTPAdaptiveStream.Manifest.Track.t(),
     counter :: non_neg_integer() ->
       String.t()),
  hls_mode: :muxed_av | :separate_av,
  manifest_module: module(),
  manifest_name: String.t(),
  mode: :live | :vod,
  mp4_parameters_in_band?: boolean(),
  persist?: boolean(),
  segment_naming_fun:
    (Membrane.HTTPAdaptiveStream.Manifest.Track.t() -> String.t()),
  storage: Membrane.HTTPAdaptiveStream.Storage.config_t(),
  target_window_duration: Membrane.Time.t() | :infinity
}

Struct containing options for Membrane.HTTPAdaptiveStream.SinkBin

Functions

@spec options() :: keyword()

Returns description of options available for this module