Membrane Generator Plugin View Source

Hex.pm API Docs CircleCI

This repository contains audio 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.2.1"}
  ]
end

Usage Example

Silence generator

defmodule AudioGenerating.Pipeline do
  use Membrane.Pipeline

  @impl true
  def handle_init(_) do
    children = [
      generator: %Membrane.SilenceGenerator{
        caps: %Membrane.Caps.Audio.Raw{
          channels: 1,
          sample_rate: 16_000,
          format: :s16le
        },
        duration: Membrane.Time.milliseconds(100)
      },
      sink: %Membrane.File.Sink{location: "/tmp/output.raw"},
    ]

    links = [
      link(:generator)
      |> to(:sink)
    ]

    {{:ok, spec: %ParentSpec{children: children, links: links}}, %{}}
  end
end

Blank Video Generator

defmodule VideoGenerating.Pipeline do
  use Membrane.Pipeline

  @impl true
  def handle_init(_) do
    children = [
      generator: %Membrane.BlankVideoGenerator{
        caps: %Membrane.Caps.Video.Raw{
          format: :I420,
          height: 720,
          width: 1280,
          framerate: {30, 1},
          aligned: true
        },
        duration: Membrane.Time.milliseconds(100)
      },
      sink: %Membrane.File.Sink{location: "/tmp/output.raw"},
    ]

    links = [
      link(:generator)
      |> to(:sink)
    ]

    {{:ok, spec: %ParentSpec{children: children, links: links}}, %{}}
  end
end

Copyright 2021, Software Mansion

Software Mansion

Licensed under the Apache License, Version 2.0