View Source Membrane.H264.FFmpeg.Parser (Membrane H264 FFmpeg plugin v0.26.1)

Membrane element providing parser for H264 encoded video stream. Uses the parser provided by FFmpeg.

By default, this parser splits the stream into h264 access units, each of which is a sequence of NAL units corresponding to one video frame, and equips them with the following metadata entries under :h264 key:

  • key_frame?: boolean - determines whether the frame is a h264 I frame.

Setting custom packetization options affects metadata, see alignment and attach_nalus? options for details.

This Parser is also capable of handling out-of-band parameters in the form of Decoder Configuration Record. To inject it, simply send Membrane.H264.RemoteStream.t/0 stream_format containing the Decoder Configuration Record to this element. There are however some limitations:

  • Membrane.H264.RemoteStream.t/0 stream_format needs to be send only before the first buffer. Sending them during the stream will cause an error
  • SPS and PPS will be extracted from Decoder Configuration Record and added to the payload of the very first buffer without any checks of in-band parameters. This might result in duplicated SPS and PPS. It shouldn't be a problem, unless you send an incorrect Decoder Configuration Record that doesn't match the stream.

element-options

Element options

Passed via struct Membrane.H264.FFmpeg.Parser.t/0

  • framerate

    H264.framerate_t() | nil

    Default value: nil
    Framerate of video stream, see Membrane.H264.framerate_t/0

  • sps

    binary()

    Default value: ""
    Sequence Parameter Set NAL unit - if absent in the stream, should be provided via this option.

  • pps

    binary()

    Default value: ""
    Picture Parameter Set NAL unit - if absent in the stream, should be provided via this option.

  • alignment

    :au | :nal

    Default value: :au
    Stream units carried by each output buffer. See Membrane.H264.alignment_t/0.

    If alignment is :nal, the following metadata entries are added:

    • type - h264 nalu type
    • new_access_unit: access_unit_metadata - added whenever the new access unit starts. access_unit_metadata is the metadata that would be merged into the buffer metadata normally (if alignment was :au).
    • end_access_unit: true - added for each NALu that ends an access unit.
  • attach_nalus?

    boolean()

    Default value: false
    Determines whether to attach NAL units list to the metadata when alignment option is set to :au. For details see Membrane.H264.nalu_in_metadata_t/0.

  • skip_until_keyframe?

    boolean()

    Default value: false
    Determines whether to drop the stream until the first key frame is received.

  • skip_until_parameters?

    boolean()

    Default value: true
    Determines whether to drop the stream until the first set of SPS and PPS is received.

  • max_frame_reorder

    non_neg_integer()

    Default value: 15
    Defines the maximum expected number of consequent b-frames in the stream.

pads

Pads

input

:input

Accepted formats:

%format{} when format in [Membrane.RemoteStream, H264, H264.RemoteStream]
Direction::input
Availability::always
Mode::pull
Demand mode::auto
Demand unit::buffers

output

:output

Accepted formats:

%H264{}
Direction::output
Availability::always
Mode::pull
Demand mode::auto

Link to this section Summary

Types

t()

Struct containing options for Membrane.H264.FFmpeg.Parser

Functions

Returns description of options available for this module

Link to this section Types

@type t() :: %Membrane.H264.FFmpeg.Parser{
  alignment: :au | :nal,
  attach_nalus?: boolean(),
  framerate: Membrane.H264.framerate_t() | nil,
  max_frame_reorder: non_neg_integer(),
  pps: binary(),
  skip_until_keyframe?: boolean(),
  skip_until_parameters?: boolean(),
  sps: binary()
}

Struct containing options for Membrane.H264.FFmpeg.Parser

Link to this section Functions

@spec options() :: keyword()

Returns description of options available for this module