Membrane H264 Plugin

Hex.pmAPI DocsCircleCI

Membrane H264 parser. It is the Membrane element responsible for parsing the incoming h264 stream. The parsing is done as a sequence of the following steps:

The output of the element is the incoming binary payload, enriched with the metadata describing the division of the payload into access units.

It is part of Membrane Multimedia Framework.

Installation

The package can be installed by adding membrane_h264_plugin to your list of dependencies in mix.exs:

def deps do
  [
      {:membrane_h264_plugin, "~> 0.4.1"}
  ]
end

Usage

The following pipeline takes H264 file, parses it, and then decodes it to the raw video.

defmodule Decoding.Pipeline do
  use Membrane.Pipeline

  alias Membrane.{File, H264}

  @impl true
  def handle_init(_ctx, _opts) do
    structure = [
      child(:source, %File.Source{location: "test/fixtures/input-10-720p-main.h264"})
      |> child(:parser, H264.Parser)
      |> child(:decoder, H264.FFmpeg.Decoder)
      |> child(:sink, %File.Sink{location: "output.raw"})
    ]

    {[spec: structure, playback: :playing]}, nil}
  end

  @impl true
  def handle_element_end_of_stream(:sink, _ctx_, _state) do
    {[playback: :stopped], nil}
  end
end

Copyright and License

Copyright 2022, Software Mansion

Software Mansion

Licensed under the Apache License, Version 2.0