# Membrane FFmpeg SWResample plugin
[](https://hex.pm/packages/membrane_ffmpeg_swresample_plugin)
[](https://hexdocs.pm/membrane_ffmpeg_swresample_plugin/)
[](https://circleci.com/gh/membraneframework/membrane_ffmpeg_swresample_plugin)
Plugin performing audio conversion, resampling and channel mixing, using SWResample module of [FFmpeg](https://www.ffmpeg.org/) library.
It is a part of [Membrane Multimedia Framework](https://membraneframework.org).
## Installation
Add the following line to your `deps` in `mix.exs`. Run `mix deps.get`.
```elixir
	{:membrane_ffmpeg_swresample_plugin, "~> 0.14.0"}
```
You also need to have [FFmpeg](https://www.ffmpeg.org/) library installed.
## Sample usage
```elixir
defmodule Resampling.Pipeline do
  use Membrane.Pipeline
  alias Membrane.Element.File
  alias Membrane.FFmpeg.SWResample.Converter
  alias Membrane.RawAudio
  @doc false
  @impl true
  def handle_init(_) do
    children = [
      file_src: %File.Source{location: "/tmp/input.raw"},
      converter: %Converter{
        input_caps: %RawAudio{channels: 2, sample_format: :s24le, sample_rate: 48_000},
        output_caps: %RawAudio{channels: 2, sample_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
```
## Copyright and License
Copyright 2018, [Software Mansion](https://swmansion.com/?utm_source=git&utm_medium=readme&utm_campaign=membrane)
[](https://swmansion.com/?utm_source=git&utm_medium=readme&utm_campaign=membrane)
Licensed under the [Apache License, Version 2.0](LICENSE)