Repository navigation
Description
What should the engine do?
Offer an opt-in probe detail that settles TrueHD Atmos the way a session does since 7.40.1 (PR #838): when avformat_find_stream_info left a TrueHD track's profile unknown, read the track's first major sync within a budget and report Atmos, no Atmos, or not settled.
Motivating media or use case
A tvOS host app labels audio tracks in its library before playback from AetherEngine.probe(source:detecting:limits:cancellation:). For E-AC-3 the .atmos pass gives a firm answer. For TrueHD there is no equivalent, so the host cannot tell "TrueHD without Atmos" from "TrueHD the probe did not decode".
What the code does (read at 7.62.1 d879ef83, unchanged on main at db92bf68)
- A probe's only TrueHD Atmos signal is
TrackInfo.profile == "Dolby TrueHD + Dolby Atmos"(docs/api.md,TrackInfo). libavcodec sets that profile only once it has decoded a frame of the track, so a track whose first packet lies beyond the analysis window keepsAV_PROFILE_UNKNOWNandprofile == nil. PR fix(audio): read TrueHD Atmos from the major sync when the probe never reached the track (7.40.1) #838 measured that at load on a real film (TrueHD from 22 s, 45.8 MB into the file, past a 16 MiB analysis budget). - In a controlled probe the caller's byte budget bounds that window as well:
probeOpenProfile(limits:)inSources/AetherEngine/AetherEngine+Probe.swiftclampsprobesizetoProbeLimits.maxInputBytes(8 MiB by default). - The fix of PR fix(audio): read TrueHD Atmos from the major sync when the probe never reached the track (7.40.1) #838 runs only in a session, and only when object rendering is requested on a build with the
TrueHDObjectAudiotrait:HLSVideoEngine.resolveUnlabelledTrueHDAtmos(Sources/AetherEngine/Video/HLSVideoEngine+SpatialAudio.swift) and the software host (Sources/AetherEngine/Native/SoftwarePlaybackHost+AudioProducer.swift) both gate onneedsTrueHDMajorSyncVerdictbefore they calltrueHDMajorSyncVerdict(demuxer:streamIndex:). - The
.atmosdetail pass inprobe(source:detecting:...)runs only when the target track isAV_CODEC_ID_EAC3.docs/api.mdstates it: "Atmos detection means E-AC-3 JOC, not TrueHD Atmos."
What was measured, and what was not
- tvOS Simulator: a plain TrueHD 5.1 track encoded by ffmpeg probes as
codec == "truehd"withprofile == nil(read out on 7.55.0; on 7.62.1 such a track is still not reported as Atmos). That is the correct negative, and it is the samenilan undecoded Atmos track gets, becauseVideoStreamFormat.profileNamereturns nil forAV_PROFILE_UNKNOWN. - Not reproduced by the host: a TrueHD Atmos track that a probe misses. No public tool writes a TrueHD Atmos stream, so I have no sample I can share, and nothing was measured on an Apple TV. The mechanism is the one PR fix(audio): read TrueHD Atmos from the major sync when the probe never reached the track (7.40.1) #838 documents, and the rest is read from the code above.
Expected
With the detail requested, a TrueHD track's answer is as reliable from a probe as from a session, and "not settled within the budget" is told apart from "no Atmos".
Suggestion
HLSVideoEngine.trueHDMajorSyncVerdict(demuxer:streamIndex:) is static, needs no session and no decoder (TrueHDMajorSync.isAtmos reads the packet bytes), and already returns a three-state answer. The .atmos pass already seeks to the start and reads the target track's packets under AtmosDetectionOptions, so a TrueHD target could take that route.
What the host does meanwhile
It shows an unmarked TrueHD track as plain TrueHD and never claims "no Atmos" for it.
Area
Audio
Host app / integration context
My own tvOS host app (custom integration)
Would you be willing to open a PR?
No
Prepared with an AI coding agent that works on the host app. Every measurement named above comes from its test runs on the versions stated; what was only read in the code is marked as such.
Activity
feat(probe): settle TrueHD Atmos from the major sync in the .atmos pa…
superuser404notfound commentedon Nov 11, 2026
Thanks for the precise write-up, the suggestion was exactly the right route.
Landed on
mainin b46bff7 (feature commit e399524), unreleased for now:.atmosrequested, a TrueHD target track is now read up to its first major sync inside the probe, underAtmosDetectionOptionsand the same discard and input budget as the E-AC-3 pass. No decoder is opened.TrackInfo.trueHDAtmos: TrueHDAtmosVerdict?:.atmos,.noAtmos(a major sync was read and declares no Atmos) or.unsettled(none within the budget). It is nil when the pass did not run for that track. A cap never turns into.noAtmos..atmosalso setsprofileto "Dolby TrueHD + Dolby Atmos", so code that labels fromprofilegets it too.isAtmosstays the E-AC-3 JOC answer.aetherctl probe --detect-atmosprintstruehd-atmos=....One thing to know for your library scan: under
ProbeLimitsthe byte budget covers this pass as well. A TrueHD track that starts beyondmaxInputBytesstops the whole probe withProbeError.inputLimitinstead of answering.noAtmos. So for the late-track case from PR #838 the budget has to reach the track (the test uses 256 MiB).Verified against a real TrueHD Atmos stream (FFmpeg FATE's
truehd/atmos.thd) muxed into MKV behind 70 s of video: the header probe reportsprofile == nil, the.atmospass reports.atmos. Plain TrueHD from FFmpeg's encoder reports.noAtmos.I'll leave this open until it ships in a release and you have had a chance to try it.
superuser404notfound commentedon Nov 12, 2026
Released in 7.63.0 (
f81a8b5b).Desima-AP commentedon Nov 13, 2026
Tried on 7.63.0 (
f81a8b5b).Setup: a tvOS host app on the tvOS simulator, controlled probes through our custom
IOReader, which counts every read (fed from a local file); oneProbeLimits(24 MiB input) shared by the calls. Fixture: a 4.8 MB MKV with a plain TrueHD 5.1 track and an AC-3 track.trueHDAtmos == nil.detecting: .atmosandAtmosDetectionOptions(targetTrackID:)set to the TrueHD track:.noAtmos. Both calls together: 786,560 B in 4 reads (the header again, then 262,272 B more up to the first major sync). Only the targeted track carries a verdict.About your note on
inputLimit: we run the.atmospass as a separate call, after the picture details, so a late TrueHD track can only cost its own answer. We store.noAtmosas a fact and keep treating.unsettledandnilas "may be Atmos".Not measured:
.atmoson a real TrueHD Atmos stream (we have no such stream in our fixtures), a track that starts late in a large file, a real Apple TV.Done from our side.
superuser404notfound commentedon Nov 13, 2026
Thanks for testing it this thoroughly, the read counts are useful to have on record. Running the
.atmospass as its own call is the right way around theinputLimitcase, and treating.unsettledand nil as "may be Atmos" matches what the verdict means.Closing this. If a real TrueHD Atmos file or a late track in a large file ever answers something unexpected, reopen or file a new issue.