You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Loopback route: FLAC 7.1(wide) is served without a channel layout, so its front-of-centre pair plays as the side surrounds #1120
A FLAC track whose channel layout is FFmpeg's 7.1(wide) (FL FR FC LFE BL BR FLC FRC) plays on the loopback route with every sample intact, but the served fMP4 carries no channel layout. AVFoundation then falls back to the default 8-channel order and reads the front-of-centre pair as the side surrounds:
FFmpeg channel
Source FLAC as AVFoundation reads it
Served fMP4 as AVFoundation reads it
FL, FR, FC, LFE
L, R, C, LFE
L, R, C, LFE
BL, BR
Rls, Rrs
Rls, Rrs
FLC, FRC
Lc, Rc
Ls, Rs
So on a 7.1 system, the content mixed for the front-of-centre speakers plays from the side surrounds. The same happens when DTS-HD Master Audio in that layout goes through the FLAC bridge (audioBridgeMode: .lossless), so it isn't specific to stream copy. A standard 7.1 layout (with sides) and 5.1 come out correctly labelled, because the default order happens to match them.
afinfo on the served stream (init segment plus segments, concatenated) reports:
Data format: 8 ch, 48000 Hz, flac (0x00000003) from 24-bit source, 512 frames/packet
no channel layout.
afinfo on the source FLAC reports Channel layout: 7.1 (L R C LFE Rls Rrs Lc Rc).
Steps
Make a 7.1(wide) FLAC with a different tone on each channel, and mux it beside a short black picture:
Serve it with HLSVideoEngine(url:dvModeAvailable: false, audioBridgeMode: .lossless) and start().
Download the media playlist's EXT-X-MAP and every segment, concatenate them, and read the audio track's CMAudioFormatDescriptionGetChannelLayout (or run afinfo on the file).
Expected: the served layout names the front-of-centre pair, as the source does: L R C LFE Rls Rrs Lc Rc. A chnl box, or a dfLa-side layout AVFoundation reads, would do. Served: no channel layout, read as L R C LFE Rls Rrs Ls Rs.
The samples themselves are bit-exact against FFmpeg's decode, channel for channel. Only the labels are wrong.
Where seen
AetherEngine 7.71.0 with the TrueHDObjectAudio and DTSXObjectAudio traits, macOS 26.7, Xcode 27.1. Found with FATE's dts/master_audio_7.1_24bit.dts (DTS-HD MA, 7.1(wide)): both its bridged FLAC and a FLAC re-encode of it played through stream copy show the table above. iOS and tvOS weren't checked, but the served init segment is the same.
Thanks for the clean repro, the tone-per-channel fixture made this quick to pin down.
What I measured on macOS 27 with CMAudioFormatDescriptionGetChannelLayout: CoreMedia reads no channel layout from a FLAC sample entry at all. I tried a chnl box after dfLa, a QuickTime chan box, and a dfLa that carries a WAVEFORMATEXTENSIBLE_CHANNEL_MASK=0xff Vorbis comment. All three still read as L R C LFE Rls Rrs Ls Rs. Apple's own afconvert -f m4af -d flac drops the layout the same way (it even warns about it). So there is no FLAC-side box to fix. CoreMedia assumes the FLAC default per channel count, and anything else lands on the wrong speakers.
The bridged DTS case had a second problem on top. The FLAC bridge opened its encoder in the default 7.1 layout, so swr folded FLC/FRC into the fronts before the labels even mattered.
Fixed on main in d72b39b and dcbaa3b. A layout FLAC cannot label now goes out as 24-bit PCM (ipcm) in the source's own layout. movenc writes that as a chnl box, and CoreMedia does read that one.
A FLAC source in such a layout leaves stream copy in either bridge mode.
A bridged source (DTS-HD MA, PCM) gets PCM under .lossless. .surroundCompat keeps E-AC-3 5.1.
5.1 with back surrounds, mono and stereo stay on FLAC.
With your wide.mkv, the served init plus segment now reads L R C LFE Rls Rrs Lc Rc through AVFoundation, the same as the source FLAC. Issue1120FLACChannelLayoutTests pins the per-channel values and the AVFoundation read-back. The cost is bandwidth on the loopback, 9.2 Mbit/s for 48 kHz 7.1.
It isn't released yet. I'll leave this open until you've had a chance to check it with the FATE DTS-HD MA file.
Activity
superuser404notfound commentedon Nov 23, 2026
Thanks for the clean repro, the tone-per-channel fixture made this quick to pin down.
What I measured on macOS 27 with
CMAudioFormatDescriptionGetChannelLayout: CoreMedia reads no channel layout from a FLAC sample entry at all. I tried achnlbox afterdfLa, a QuickTimechanbox, and adfLathat carries aWAVEFORMATEXTENSIBLE_CHANNEL_MASK=0xffVorbis comment. All three still read asL R C LFE Rls Rrs Ls Rs. Apple's ownafconvert -f m4af -d flacdrops the layout the same way (it even warns about it). So there is no FLAC-side box to fix. CoreMedia assumes the FLAC default per channel count, and anything else lands on the wrong speakers.The bridged DTS case had a second problem on top. The FLAC bridge opened its encoder in the default 7.1 layout, so swr folded FLC/FRC into the fronts before the labels even mattered.
Fixed on main in d72b39b and dcbaa3b. A layout FLAC cannot label now goes out as 24-bit PCM (
ipcm) in the source's own layout. movenc writes that as achnlbox, and CoreMedia does read that one..lossless..surroundCompatkeeps E-AC-3 5.1.With your
wide.mkv, the served init plus segment now readsL R C LFE Rls Rrs Lc Rcthrough AVFoundation, the same as the source FLAC.Issue1120FLACChannelLayoutTestspins the per-channel values and the AVFoundation read-back. The cost is bandwidth on the loopback, 9.2 Mbit/s for 48 kHz 7.1.It isn't released yet. I'll leave this open until you've had a chance to check it with the FATE DTS-HD MA file.
superuser404notfound commentedon Nov 24, 2026
Released in 7.74.0 (dcbaa3b).