This repository contains audio and video generator.
It is part of Membrane Multimedia Framework.
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.0"}
]
end
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,
format: :s16le
},
duration: Membrane.Time.milliseconds(100)
})
|> child(:sink, %Membrane.File.Sink{location: "/tmp/output.raw"})
{[spec: structure], %{}}
end
end
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 2021, Software Mansion
Licensed under the Apache License, Version 2.0