# `Membrane.AAC.FDK.Encoder`
[🔗](https://github.com/membraneframework/membrane_aac_fdk_plugin/blob/v0.18.15/lib/membrane_aac_fdk_plugin/encoder.ex#L1)

Element encoding raw audio into AAC format

## Element options

Passed via struct `t:Membrane.AAC.FDK.Encoder.t/0`

- `aot`  

  ```
  allowed_aots()
  ```
  
  Default value: `:mpeg4_lc`  
  Audio object type. See: https://github.com/mstorsjo/fdk-aac/blob/master/libAACenc/include/aacenc_lib.h#L1280
  2: MPEG-4 AAC Low Complexity.
  5: MPEG-4 AAC Low Complexity with Spectral Band Replication (HE-AAC).
  29: MPEG-4 AAC Low Complexity with Spectral Band Replication and Parametric Stereo (HE-AAC v2). This configuration can be used only with stereo input audio data.
  129: MPEG-2 AAC Low Complexity.
  132: MPEG-2 AAC Low Complexity with Spectral Band Replication (HE-AAC).

- `bitrate_mode`  

  ```
  allowed_bitrate_modes()
  ```
  
  Default value: `0`  
  Bitrate Mode. See: http://wiki.hydrogenaud.io/index.php?title=Fraunhofer_FDK_AAC#Bitrate_Modes
  0 - Constant Bitrate (default).
  1-5 - Variable Bitrate

- `bitrate`  

  ```
  pos_integer() | nil
  ```
  
  Default value: `nil`  
  Bitrate in bits/s for CBR.
  If set to nil (default value), the bitrate will be estimated based on the number of channels and sample rate.
  See: https://trac.ffmpeg.org/wiki/Encode/AAC#fdk_cbr
  Note that for VBR this parameter is ignored.

## Pads

### `:input`

Accepted formats:
```
%RawAudio{sample_format: :s16le, sample_rate: rate, channels: channels}
when rate in @allowed_sample_rates and channels in 1..8
```

Direction: | `:input`
Availability: | `:always`
Flow control: | `:auto`

### `:output`

Accepted formats:
```
%AAC{encapsulation: :ADTS}
```

Direction: | `:output`
Availability: | `:always`
Flow control: | `:auto`

# `allowed_aots`

```elixir
@type allowed_aots() :: :mpeg4_lc | :mpeg4_he | :mpeg4_he_v2 | :mpeg2_lc | :mpeg2_he
```

# `allowed_bitrate_modes`

```elixir
@type allowed_bitrate_modes() :: 0 | 1 | 2 | 3 | 4 | 5
```

# `allowed_sample_rates`

```elixir
@type allowed_sample_rates() ::
  96000
  | 88200
  | 64000
  | 48000
  | 44100
  | 32000
  | 24000
  | 22050
  | 16000
  | 12000
  | 11025
  | 8000
```

# `t`

```elixir
@type t() :: %Membrane.AAC.FDK.Encoder{
  aot: allowed_aots(),
  bitrate: pos_integer() | nil,
  bitrate_mode: allowed_bitrate_modes()
}
```

Struct containing options for `Membrane.AAC.FDK.Encoder`

# `options`

```elixir
@spec options() :: keyword()
```

Returns description of options available for this module

---

*Consult [api-reference.md](api-reference.md) for complete listing*
