View Source Membrane Generator Plugin

Hex.pm API Docs CircleCI

This repository contains audio and video generator.

It is part of Membrane Multimedia Framework.

installation

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.7.0"}
  ]
end

usage-example

Usage Example

silence-generator

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

Blank Video Generator

defmodule VideoGenerating.Pipeline do
  use Membrane.Pipeline

  @impl true
  def handle_init(_) do
    children = [
      generator: %Membrane.BlankVideoGenerator{
        caps: %Membrane.RawVideo{
          pixel_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