Use these settings with MFormats MFWriter or the default MPlatform MWriter backend.
Record 5.1 or 7.1 AAC with LFE
Feed the writer a single six-channel (5.1) or eight-channel (7.1) track in the corresponding surround channel order. Keep the default audio codec settings so the writer assigns one channel to LFE (low-frequency effects).
Use hexagonal or octagonal audio without LFE
For a source with six or eight full-range channels in the matching speaker arrangement, use one of these AAC settings.
- Six channels without LFE:
audio::layout='HEXAGONAL' - Eight channels without LFE:
audio::layout='OCTAGONAL'
Both layouts include a rear-center speaker and describe all channels as full-range. The writer applies a layout only when the track has exactly that number of channels: six for HEXAGONAL, eight for OCTAGONAL. Otherwise it keeps the default surround layout. Keep the default layout when your source contains LFE.
Choose an audio bitrate
audio::b sets the target bitrate for the entire encoded track in bits per second. For AAC at 48 kHz, start with 384K for 6 channels or 512K for 8 channels, for example, and adjust for your delivery requirements. For uncompressed PCM, calculate the bitrate as sample rate × bits per sample × channel count. Eight channels of 24-bit PCM at 48 kHz use about 9.2 Mbit/s before container overhead.
Maximum channels per track
| Audio codec | Maximum channels per track |
|---|---|
AAC (aac) |
8 |
AC-3 / E-AC-3 (ac3 / eac3) |
6 (5.1) |
MP2 / MP3 (mp2 / libmp3lame) |
2 |
FLAC (flac) |
8 |
Opus (libopus) |
8 with surround mapping (audio::mapping_family='1') |
PCM (for example, pcm_s24le) |
Depends on the container. |
If you need to keep more channels than one track can carry, choose a container that supports multiple audio tracks. For example, split_channels='2' writes an eight-channel source as four two-channel tracks. Keep a surround mix together when the destination expects a single 5.1 or 7.1 track.
If the encoder does not accept the channel count, the writer retries with fewer channels: 6, then 2, then 1, and writes a warning to the SDK log. So check the result: inspect the recorded tracks with ffprobe and play a channel identification clip on the target system.
ffprobe -v error -select_streams a -show_entries stream=index,channels,channel_layout output.mp4See also
Still have questions?
Tell us what didn’t work or what you’d like clarified.