Membrane Generator Plugin

Hex.pmAPI DocsCircleCI

This repository contains audio and video generator.

It is part of Membrane Multimedia Framework.

Installation

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

def deps do
  [
    {:membrane_generator_plugin, "~> 0.10.1"}
  ]
end

Usage Example

Silence generator

defmodule AudioGenerating.Pipeline do
  use Membrane.Pipeline

  @impl true
  def handle_init(_ctx, _opts) do
    structure = 
      child(
      :generator, %Membrane.SilenceGenerator{
        stream_format: %Membrane.RawAudio{
          channels: 1,
          sample_rate: 16_000,
          sample_format: :s16le
        },
        duration: Membrane.Time.milliseconds(100)
      })
      |> child(:sink, %Membrane.File.Sink{location: "/tmp/output.raw"})

    {[spec: structure], %{}}
  end
end

Blank Video Generator

defmodule VideoGenerating.Pipeline do
  use Membrane.Pipeline

  @impl true
  def handle_init(_ctx, _opts) do
    structure = 
      child(
        :generator,
        %Membrane.BlankVideoGenerator{
          stream_format: %Membrane.RawVideo{
            pixel_format: :I420,
            height: 720,
            width: 1280,
            framerate: {30, 1},
            aligned: true
          },
          duration: Membrane.Time.milliseconds(100)
        }
      )
      |> child(:sink, %Membrane.File.Sink{location: "/tmp/output.raw"})

    {[spec: structure], %{}}
  end
end

Copyright and License

Copyright 2021, Software Mansion

Software Mansion

Licensed under the Apache License, Version 2.0