AAC decoder and encoder based on FDK library.
It is part of Membrane Multimedia Framework.
The docs can be found at HexDocs.
The package can be installed by adding membrane_aac_fdk_plugin
to your list of dependencies in mix.exs
:
def deps do
[
{:membrane_aac_fdk_plugin, "~> 0.18.7"}
]
end
This package depends on the FDK-AAC library. The precompiled build will be pulled and linked automatically. However, should there be any problems, consider installing it manually.
(Make sure you have Multiverse repository enabled. See: https://help.ubuntu.com/community/Repositories/Ubuntu)
sudo apt-get install libfdk-aac-dev
pacman -S libfdk-aac
brew install fdk-aac
The following pipeline takes wav file as input and encodes it as AAC.
Mix.install([:membrane_file_plugin, :membrane_wav_plugin, :membrane_aac_fdk_plugin])
defmodule AAC.Pipeline do
use Membrane.Pipeline
@impl true
def handle_init(_ctx, _opts) do
structure =
child(:source, %Membrane.File.Source{location: "input.wav"})
|> child(:parser, Membrane.WAV.Parser)
|> child(:aac_encoder, Membrane.AAC.FDK.Encoder)
|> child(:sink, %Membrane.File.Sink{location: "output.aac"})
{[spec: structure, playback: :playing], %{}}
end
end
{:ok, _pipeline_supervisor, _pipeline} = AAC.Pipeline.start_link([])
The following pipeline takes AAC file as input and plays it on speakers.
Mix.install([
:membrane_file_plugin,
:membrane_ffmpeg_swresample_plugin,
:membrane_aac_fdk_plugin,
:membrane_portaudio_plugin
])
defmodule AAC.Pipeline do
use Membrane.Pipeline
@impl true
def handle_init(_ctx, _opts) do
structure =
child(:source, %Membrane.File.Source{location: "input.aac"})
|> child(:aac_decoder, Membrane.AAC.FDK.Decoder)
|> child(:converter, %Membrane.FFmpeg.SWResample.Converter{
output_stream_format: %Membrane.RawAudio{
sample_format: :s16le,
sample_rate: 48000,
channels: 2
}
})
|> child(:sink, Membrane.PortAudio.Sink)
{[spec: structure, playback: :playing], %{}}
end
end
{:ok, _pipeline_supervisor, _pipeline} = AAC.Pipeline.start_link([])
Copyright 2018, Software Mansion
Licensed under the Apache License, Version 2.0