View Source Membrane AAC FDK plugin

Hex.pm API Docs CircleCI

AAC decoder and encoder based on FDK library.

It is part of Membrane Multimedia Framework.

The docs can be found at HexDocs.

installation

Installation

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.15.1"}
  ]
end

This package depends on FDK-AAC library.

ubuntu

Ubuntu

(Make sure you have Multiverse repository enabled. See: https://help.ubuntu.com/community/Repositories/Ubuntu)

sudo apt-get install libfdk-aac-dev

arch-manjaro

Arch/Manjaro

pacman -S libfdk-aac

macos

MacOS

brew install fdk-aac

usage

Usage

encoder

Encoder

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([])

decoder

Decoder

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

Software Mansion

Licensed under the Apache License, Version 2.0