Membrane FFmpeg SWResample plugin

Hex.pmAPI DocsCircleCI

Plugin performing audio conversion, resampling and channel mixing, using SWResample module of FFmpeg library.

It is a part of Membrane Multimedia Framework.

Installation

Add the following line to your deps in mix.exs. Run mix deps.get.

{:membrane_ffmpeg_swresample_plugin, "~> 0.4.0"}

You also need to have FFmpeg library installed. For usage on windows, see Using on Windows section below.

Sample usage

defmodule Resampling.Pipeline do
use Membrane.Pipeline
alias Membrane.Element.File
alias Membrane.FFmpeg.SWResample.Converter
alias Membrane.Caps.Audio.Raw
@doc false
@impl true
def handle_init(_) do
children = [
file_src: %File.Source{location: "/tmp/input.raw"},
converter: %Converter{
input_caps: %Raw{channels: 2, format: :s24le, sample_rate: 48_000},
output_caps: %Raw{channels: 2, format: :f32le, sample_rate: 44_100}
},
file_sink: %File.Sink{location: "/tmp/output.raw"},
]
links = [
link(:file_src)
|> to(:converter)
|> to(:file_sink)
]
{{:ok, spec: %ParentSpec{children: children, links: links}}, %{}}
end
end

Using on Windows

It is possible to compile and use this plugin on Windows platform. That requires:

Copyright 2018, Software Mansion

Software Mansion

Licensed under the Apache License, Version 2.0