View Source Membrane Realtimer plugin

Hex.pm API Docs CircleCI

Membrane plugin for limiting playback speed to realtime, according to buffers' timestamps.

It is part of Membrane Multimedia Framework.

installation

Installation

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

def deps do
  [
    {:membrane_realtimer_plugin, "~> 0.5.0"}
  ]
end

usage

Usage

The following pipeline downloads a sample h264 video via HTTP and sends it in realtime via RTP. It requires RTP plugin, RTP H264 plugin and UDP plugin to work.

defmodule Example.Pipeline do
  use Membrane.Pipeline

  @impl true
  def handle_init(_opts) do
    ssrc = 1234

    spec = %ParentSpec{
      children: [
        source: %Membrane.Hackney.Source{
          location: "https://membraneframework.github.io/static/samples/ffmpeg-testsrc.h264",
          hackney_opts: [follow_redirect: true]
        },
        parser: %Membrane.H264.FFmpeg.Parser{framerate: {30, 1}, alignment: :nal},
        rtp: Membrane.RTP.SessionBin,
        realtimer: Membrane.Realtimer,
        sink: %Membrane.UDP.Sink{
          destination_port_no: 5000,
          destination_address: {127, 0, 0, 1}
        }
      ],
      links: [
        link(:source)
        |> to(:parser)
        |> via_in(Pad.ref(:input, ssrc), options: [payloader: Membrane.RTP.H264.Payloader])
        |> to(:rtp)
        |> via_out(Pad.ref(:rtp_output, ssrc), options: [encoding: :H264])
        |> to(:realtimer)
        |> to(:sink)
      ]
    }

    {{:ok, spec: spec, playback: :playing}, %{}}
  end
end

Copyright 2020, Software Mansion

Software Mansion

Licensed under the Apache License, Version 2.0