https://github.com/membraneframework/membrane_aac_fdk_plugin
Membrane AAC decoder and encoder based on FDK library
https://github.com/membraneframework/membrane_aac_fdk_plugin
Last synced: 6 months ago
JSON representation
Membrane AAC decoder and encoder based on FDK library
- Host: GitHub
- URL: https://github.com/membraneframework/membrane_aac_fdk_plugin
- Owner: membraneframework
- License: apache-2.0
- Created: 2019-03-04T07:26:27.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-04-03T08:37:51.000Z (about 2 years ago)
- Last Synced: 2024-04-03T10:09:16.589Z (about 2 years ago)
- Language: Elixir
- Homepage:
- Size: 1.18 MB
- Stars: 2
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Membrane AAC FDK plugin
[](https://hex.pm/packages/membrane_aac_fdk_plugin)
[](https://hexdocs.pm/membrane_aac_fdk_plugin/)
[](https://circleci.com/gh/membraneframework/membrane_aac_fdk_plugin)
AAC decoder and encoder based on FDK library.
It is part of [Membrane Multimedia Framework](https://membraneframework.org).
The docs can be found at [HexDocs](https://hexdocs.pm/membrane_aac_fdk_plugin).
## Installation
The package can be installed by adding `membrane_aac_fdk_plugin` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:membrane_aac_fdk_plugin, "~> 0.18.11"}
]
end
```
This package depends on the [FDK-AAC](https://github.com/mstorsjo/fdk-aac) library. The precompiled build will be pulled and linked automatically. However, should there be any problems, consider installing it manually.
### Manual instalation of dependencies
#### Ubuntu
(Make sure you have Multiverse repository enabled. See: )
```bash
sudo apt-get install libfdk-aac-dev
```
#### Arch/Manjaro
```bash
pacman -S libfdk-aac
```
#### MacOS
```bash
brew install fdk-aac
```
## Usage
### Encoder
The following pipeline takes wav file as input and encodes it as AAC.
```elixir
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
spec =
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: spec], %{}}
end
end
{:ok, _pipeline_supervisor, _pipeline} = Membrane.Pipeline.start_link(AAC.Pipeline, [])
```
### Decoder
The following pipeline takes AAC file as input and plays it on speakers.
```elixir
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
spec =
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: spec], %{}}
end
end
{:ok, _pipeline_supervisor, _pipeline} = Membrane.Pipeline.start_link(AAC.Pipeline, [])
```
## 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)