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
Support for Dolby Vision Profile 7 Full Enhancement Layer #702
The engine should support Dolby Vision Profile 7 Full Enhancement Layer (FEL) playback by decoding both the base and enhancement layers with VideoToolbox, aligning corresponding frames, and reconstructing the picture in Metal using the RPU’s reshaping and residual parameters.
The reconstructed frames should be presented through AVSampleBufferDisplayLayer with per-frame Profile 8.1 Dolby Vision metadata, allowing the system to handle display management. MEL sources and devices without the required hardware should continue using the existing single-layer Profile 8.1 conversion.
I already have working code implementing this approach, including playback integration, tests, diagnostics, and design documentation. I’d like to discuss whether this would be a suitable addition to AetherEngine before preparing a PR.
Motivating media or use case
Dolby Vision Profile 7 FEL UHD Blu-ray remuxes played on Apple TV 4K, particularly through media servers such as Jellyfin.
The current Profile 7 → Profile 8.1 conversion preserves Dolby Vision metadata but discards the enhancement layer. For FEL titles, that loses the residual contribution used to reconstruct the intended picture. Supporting dual-layer composition would preserve that contribution during playback without requiring users to transcode their media beforehand.
A concrete example is a tested Minions UHD Blu-ray clip, where enabling the enhancement residual produces a measurable change in reconstructed luma.
I think adding a toggle to LoadOptions would be excellent; I’m really looking forward to support for the Dolby Vision Profile 7 full enhancement layer.
AetherEngine currently rewrites the RPU with libdovi mode 2, drops the EL, and packages the unchanged BL as Profile 8.1. That remains a useful fallback and comparison path, but it cannot include FEL pixel data.
The first problem becomes the fact that we need to change the BL to be a single layer stream for 8.1, along with the fact that we will still be limited to 10-bit 4:2:0 Main 10.
You'd need to demux synchronized BL, EL, and RPU data, dovi_tools demux is a good reference, but we'd need a better realtime version that's GPU accelerated. This becomes the next problem, Apple doesn't have a dual layer decoder. We might need to use software decoding which at this bitrate is rough. We need to prove the layers can be decoded independently. Use dovi_tool demux on a short Profile 7 FEL sample to produce BL and EL bitstreams. Open each as its own HEVC stream and try the existing HardwareVideoDecoder on both. This is the first go/no-go test
If we get past these issues after reencoding the shader-processed demuxed streams we can output that. Just switch to mode 5 and you're off.
along with the fact that we will still be limited to 10-bit 4:2:0 Main 10.
This is indeed bit of a challenge, since combination of BL + EL is 12 bit. I am doing dithered requantization from 12-bit to 10-bit P010.
Open each as its own HEVC stream and try the existing HardwareVideoDecoder on both. This is the first go/no-go test
That's pretty much what I did and it is possible on Apple TV 4K 2nd gen. it is able to process in real time and hold couple of frames in memory.
If we get past these issues after reencoding the shader-processed demuxed streams we can output that
there is no need for re-encoding, combined output can be shown by AVSampleBufferDisplayLayer. I am not sure whether Apple TV would be able to handle encoding of 4K HEVC while running 2 decodes at the same time.
Whole pipeline is: VideoToolbox decode → Metal FEL composition → P010 CVPixelBuffer → CMSampleBuffer → AVSampleBufferDisplayLayer
Thanks a lot for putting this together, and for already having a working pipeline, tests and a design doc. That is a serious amount of work, and the dual VideoToolbox decode running in real time on an Apple TV 4K (2nd gen) is a genuinely interesting result.
I'm going to park this for now though, and the reason is the output side rather than the decode side.
AVSampleBufferDisplayLayer does not get Dolby Vision to the panel on tvOS. That is the exact reason AetherEngine moved off its original sample-buffer renderer and onto AVPlayer (loopback HLS) early on: through the display layer the TV never entered Dolby Vision mode. What I could find online matches that:
Apple's own note, Incorporating HDR video with Dolby Vision into your apps, does list AVSampleBufferDisplayLayer for Dolby Vision 8.4, but only for sample buffers that carry the per-frame metadata VideoToolbox attaches itself (kVTDecompressionPropertyKey_PropagatePerFrameHDRDisplayMetadata). It is written for iOS 14.1 / iPhone 12 HLG capture and on-device tone mapping, and says nothing about Dolby Vision output over HDMI on tvOS.
There is no public API to attach a self-built RPU to a pixel buffer. In the proposed pipeline the composed frames come out of Metal, not out of a VTDecompressionSession, so there is no supported way to hand them Profile 8.1 metadata.
Kodi's recent tvOS HDR work on the same layer (xbmc/xbmc#29442) states that Dolby Vision and HDR10+ dynamic metadata are not rendered there, and Profile 8 streams play as their HDR10/HLG base.
So the realistic outcome on a DV panel would be HDR10 with the FEL residual applied. Today the same titles play as real Dolby Vision through the P7 to 8.1 conversion. Trading the dynamic mapping for the residual contribution would be a step back for most setups, and it would also add a third render host next to the native and software paths, with its own clock, seek and A/V sync surface.
The one way to keep Dolby Vision with FEL that I can see would be re-encoding the composed frames back into HEVC 8.1 and feeding them through AVPlayer, which means a 4K encode on top of two 4K decodes on the box. I don't think that is viable.
That said, I'd be happy to be proven wrong. If you can show the panel actually reporting Dolby Vision (TV info overlay or an HDMI analyser) with your composed frames going through AVSampleBufferDisplayLayer, that changes the picture completely and I'd gladly revisit it, ideally as an opt-in LoadOptions toggle with the current 8.1 conversion as the fallback, as suggested above.
You asked whether frames handed to AVSampleBufferDisplayLayer with our own DolbyVisionRPUData attached really drive the TV as Dolby Vision, or whether the TV just sits in DV mode and shows the picture as HDR10 with static metadata ("fake DV"). I tested it directly. The TV uses the per-frame metadata from our frames. The FEL route responds to an RPU change the same way, and by the same amount, as AVPlayer on a native Profile 8.1 file.
through the display layer the TV never entered Dolby Vision mode.
With dvh1 display criteria set through AVDisplayManager, it does. The LG shows the Dolby Vision badge and switches to its Dolby Vision picture-mode list.
More to the point, the measurement below shows the panel following our per-frame metadata, which the badge alone can't prove.
It is written for iOS 14.1 / iPhone 12 HLG capture and on-device tone mapping, and says nothing about Dolby Vision output over HDMI on tvOS.
Run V1 below is exactly the case Apple's note describes (VideoToolbox's own attachments into AVSampleBufferDisplayLayer), but on tvOS over HDMI to a Dolby Vision TV, and it works.
Run V2 copies VideoToolbox's attachment bytes onto buffers from our own IOSurface pool. It behaves identically, so the compositor doesn't care where the buffer came from.
There is no public API to attach a self-built RPU to a pixel buffer. In the proposed pipeline the composed frames come out of Metal, not out of a VTDecompressionSession, so there is no supported way to hand them Profile 8.1 metadata.
Correct, and I don't want to oversell this. DolbyVisionRPUData and DolbyCompatibilityID are plain string keys set with CVBufferSetAttachment. No private symbol is linked, but the keys aren't in any header and no OS release promises to keep consuming them.
The payload format isn't guessed. It is byte-for-byte the format VideoToolbox attaches itself: the unspec62 NAL without its 2-byte header, with emulation-prevention bytes kept. We produce it with libdovi's mode-2 conversion, the same one the native path uses today.
Two things limit the risk:
The route sits behind an opt-in LoadOptions flag (preferDualLayerDolbyVision, default false), with the current P7 → 8.1 conversion as the default and fallback.
If a future tvOS stopped reading the keys, the result would be what run S below shows: a steady HDR10-like picture, not a broken one. The pulse test re-checks this in about 10 minutes per OS release.
Kodi's recent tvOS HDR work on the same layer (xbmc/xbmc#29442) states that Dolby Vision and HDR10+ dynamic metadata are not rendered there, and Profile 8 streams play as their HDR10/HLG base.
That matches run S: the same layer without the Dolby attachments gives no dynamic metadata.
Their diff sets only the HDR10 attachments (colour primaries, transfer function, matrix, mastering display colour volume, content light level); there is no DolbyVisionRPUData. That is the difference.
So the realistic outcome on a DV panel would be HDR10 with the FEL residual applied.
Measured, it isn't: run T keeps the dynamic mapping, responding like AVPlayer patch for patch.
The residual itself is verified on the Mac against DoViBaker (within ±1 code value). This TV test used a zero-residual EL on purpose, so that only the RPU changes. A run where the EL changes and the metadata doesn't is the next test.
it would also add a third render host next to the native and software paths, with its own clock, seek and A/V sync surface.
There is no new host. The FEL route runs inside the existing software path, SoftwarePlaybackHost (the AV1/VP9 one), with its AVSampleBufferRenderSynchronizer clock, seek and A/V sync.
That host does gain the Dolby Vision display-criteria handshake it skipped before.
What's added besides is a decoder, DualLayerVideoDecoder: two VideoToolbox sessions, the Metal composer, and the RPU attachment. It sits behind the flag above.
The one way to keep Dolby Vision with FEL that I can see would be re-encoding the composed frames back into HEVC 8.1 and feeding them through AVPlayer, which means a 4K encode on top of two 4K decodes on the box. I don't think that is viable.
Agreed, and it isn't needed.
Method
Hold the pixels constant and change only the metadata. Each test clip is a static PQ chart: grey patches from 0.1 to 10,000 nits, colour patches and a ramp. Only the RPU changes.
It alternates between phase A and phase B every 3 s, ten times per clip.
L2 variant: neutral trims vs extreme trims (slope, offset, power, saturation) at the 100/600/1000/4000-nit targets.
L1 variant:max_pq 2081 vs 4095.
If the TV uses the metadata, the panel's light output steps at each phase boundary. If it ignores it (HDR10 / static metadata), nothing moves.
Clips (all synthetic):
Profile 8.1 dvh1 MP4s, made with x265, dovi_tool inject-rpu and MP4Box.
Profile 7 FEL MP4s for the AetherEngine route:
dovi_tool's FEL test RPU, with the composer mapping held constant and the per-frame L1/L2 copied in;
a flat, zero-residual EL;
muxed with dovi_tool mux.
A Gray-coded frame counter and four corner markers are burned in. These let the analysis find the screen in the phone video and know which phase is on screen in every camera frame.
Setup:
Apple TV 4K (2nd gen), tvOS 27; Format 4K SDR with Match Dynamic Range and Frame Rate on.
LG C1 in Dolby Vision Cinema, with AI Picture, Energy Saving, motion processing and Logo Luminance all off.
Filming: iPhone, tripod, 1080p30 SDR. One take covers all nine runs back to back, with a slate (arm name plus a UTC clock) before each run. A debug harness logs wall-clock times, so the video is cut per run from the log rather than by guessing.
Analysis:
For each patch, each B phase is compared against the mean of the A phases either side of it. That cancels slow drift such as panel dimming or camera warm-up.
PULSE means at least 3 patches with |t| > 5.
Runs
Run
Path
Clip
Expected if the RPU is used
P
AVPlayer, Apple's own path
8.1, L2
pulse (positive control)
V1
VideoToolbox → AVSampleBufferDisplayLayer, VT's own attachments
8.1, L2
pulse
V2
VT output copied into our own IOSurface buffers, VT's RPU attachment copied across
8.1, L2
pulse
T
AetherEngine FEL route (BL+EL composed, RPU converted to 8.1 and attached, dvh1 display criteria)
P7 FEL, L2
the question
N
AetherEngine FEL route
P7 FEL, RPU never changes
steady (null)
S
as V2, but with DolbyVisionRPUData / DolbyCompatibilityID removed
8.1, L2
steady if the TV reads the attachment
P1
AVPlayer
8.1, L1
pulse
T1
AetherEngine FEL route
P7 FEL, L1
same as P1
P
AVPlayer, repeat
8.1, L2
same as the first P
Result
Change in camera brightness, B vs A:
Run
Verdict
10 nit
100 nit
400 nit
1000 nit
4000 nit
10000 nit
P
PULSE
−55%
−63%
−56%
−50%
−44%
−42%
V1
PULSE
−53%
−60%
−52%
−45%
−40%
−37%
V2
PULSE
−52%
−58%
−51%
−44%
−39%
−37%
T
PULSE
−55%
−60%
−54%
−51%
−46%
−45%
N
steady
0
0
0
0
0
0
S
steady
0
0
0
0
0
0
P1
PULSE
+25%
−3%
−10%
−2%
+6%
+13%
T1
PULSE
+21%
−5%
−9%
0
+8%
+11%
P (repeat)
PULSE
−50%
−59%
−53%
−46%
−41%
−39%
The FEL route (T) responds like AVPlayer (P). It does so on every patch: 25 patches above |t| > 5, from t ≈ −23 at 10,000 nit to −63 at 100 nit, and up to −95 on the ramp.
The null run (N) is flat. The camera and the TV's own processing produce no pulse by themselves.
S is flat. It is the same pixels through the same display layer as V2, minus the two Dolby attachments. So the pulse comes from the attached RPU and nothing else.
The L1 runs show a different shape, and it matches. Shadows and highlights go up while midtones go down, and T1 reproduces that pattern from P1. HDR10 with static metadata can't produce either signature.
V1 and V2 match. It makes no difference whether the buffer came from VideoToolbox or from our own pool.
A first take, filmed earlier the same day, gave the same verdicts for P, T, N, P1 and T1. V1, V2 and S failed to play in that take.
What "fake DV" looks like
The absolute patch levels (camera luma, 0–1; 0.995 is the camera clipping) show the picture without metadata is a different picture, and ours isn't it:
Run
Metadata
10 nit
100 nit
1000 nit
10000 nit
V1, phase A
VideoToolbox's own
0.495
0.721
0.927
0.994
V2, phase A
VideoToolbox's, on our buffers
0.494
0.721
0.927
0.994
T, phase A
ours (FEL route)
0.499
0.723
0.930
0.994
S
none
0.320
0.662
0.995
0.995
V1, V2 and T render the same pixels the same way, to the third decimal.
Without the metadata (S), the TV renders them differently: much darker shadows, and 1000 nit clipped instead of held below the top. That is the static-metadata tone curve, i.e. what "fake DV" would look like.
Camera exposure differed between runs, so absolute levels across runs are approximate. S doesn't depend on that, though: it had the lower camera exposure, yet its 1000-nit patch came out brighter.
Caveats
The percentages are camera values, not panel nits. The iPhone's auto exposure didn't stay locked: the wall beside the TV brightens when the screen dims. That makes every pulse look smaller than it is. It affects all runs alike, and N and S stay flat (wall swing 0.1%), so it can't create a pulse. Compare runs with each other, not as absolute dimming.
This shows the RPU drives the Dolby Vision output. It doesn't separate TV-led from player-led processing: the Apple TV may do part of the mapping itself. Either way, it is our per-frame metadata driving the picture, not static HDR10.
Hardware coverage: one TV (LG C1) and one Apple TV model.
Which build was tested: runs T, N and T1 used my development build of the FEL route. It is the same pipeline as the upstream branch (decoder, composer and RPU attachment), but it isn't that exact commit.
The clips are synthetic, so the clip generator, harness and analysis scripts can be shared if you want to reproduce this.
Figure: each row is one run, in the order of the table. Shaded bands are the B phases; the y-axis is the camera luma of the three strongest patches, autoscaled per row, so N and S look noisy only because their range is tiny. Straight segments are frames where the frame counter couldn't be read.
That is exactly the evidence I asked for, and a lot more rigorous than a badge on the TV. Thank you for taking the time to build it.
The S run is what settles it for me: same pixels, same layer, only the two attachments removed, and the dynamic response disappears. That also explains what AetherEngine saw back when it rendered through the display layer (and what Kodi describes in #29442): neither attached DolbyVisionRPUData, so both got the static HDR10 curve. My statement that the layer cannot get Dolby Vision to the panel was wrong, and I'm unparking this.
Please go ahead with the PR. Shape as you proposed: LoadOptions.preferDualLayerDolbyVision, default false, inside SoftwarePlaybackHost, with the P7 to 8.1 conversion as the default and the fallback. What I'd like to see in or alongside it:
The EL test you mentioned, on the Apple TV: a varying residual with constant RPU, so the composed residual is shown to reach the panel and not only the metadata. Plus one real FEL title (your Minions clip is fine) played through a few minutes with seeks, reporting dropped frames and peak memory footprint. The software host has a history of 4K memory pressure, so footprint matters.
FEL only, and a capability gate. MEL and anything the box can't decode twice in real time fall back to 8.1, with one diagnostic line stating why the route was or wasn't taken.
Parity with the native path where the route takes over a title the native path plays today. Seeks have to flush and realign both decoders on the same picture, and scrub thumbnails, subtitles and PiP should behave as on the AV1/VP9 path. One gap I'm aware of and will look into myself, so not a requirement for the PR: the software host does not pass E-AC-3 JOC through, so an Atmos E-AC-3 track would lose Atmos on this route. TrueHD bridges through FLAC on both paths, so for most UHD remuxes nothing changes.
The undocumented keys in one place, with a comment naming them as such, so there is exactly one spot to change if a tvOS release stops honouring them.
The pulse test in the repo (clip generator, harness, analysis, under Tools/ or similar), so it can be rerun per tvOS release without you.
Docs: new public API is named in docs/, and tests run under both swift test runners.
Small PRs are welcome if that is easier to review, for example the decoder and composer first, then the host wiring.
I meant dovi_tool mode 5, not DV profile 5, I should have been more clear
This is exciting to see, I fully thought the HEVC stream would need to be encoded again as P8.1. I would also love to see some continued work being put in for LLDV, my projector doesn't support it but I have all the measurements. Would love to not buy an HDFury and just do it on device.
A follow-up on the Atmos point from my last comment, so it can go into the flag's documentation rather than block the PR.
On tvOS, Dolby Atmos in E-AC-3 (JOC) only reaches the receiver through AVPlayer. AVSampleBufferAudioRenderer plays the E-AC-3 core without the object metadata, and tvOS does not pass a bitstream through at all; Atmos leaves the box as Dolby MAT over LPCM, which only AVPlayer produces. The MrMC developers describe the same result from their own native player work (forum thread).
So on the dual-layer route an E-AC-3 Atmos track plays as its 5.1 (or 7.1) core. TrueHD Atmos is unaffected in practice, because it already goes through the FLAC bridge on the native path as well. Please note this trade-off in the preferDualLayerDolbyVision documentation; nothing to engineer around.
For the dual-layer route, mode 2 is the right one for the attached RPU, though. The Metal composer already applies the RPU's luma/chroma reshaping and adds the residual, so the frames that reach the display layer are the finished picture. If the attached RPU kept the mapping (mode 5), the display side would reshape a second time on top of an already reshaped picture. Mode 2 sets both curves to no-op and keeps the L1/L2 and the rest of the display metadata, which is what the composed frames need. Mode 5 only made sense in the re-encode idea, and that is off the table now.
LLDV on device is a separate topic. On a display that advertises LLDV the Apple TV already does player-led Dolby Vision itself. What you're describing for a non-DV projector is different: tone mapping the Dolby Vision metadata onto your measured projector on the box, without an HDFury pretending to be an LLDV sink. That needs the same frame path this PR introduces, but it is its own feature with its own design questions (whose tone curve, how the measurements get in, what happens with HDR10 sources). If you'd like it considered, please open a separate feature request with your projector's specs and measurements, so it doesn't get lost in this thread.
The PRs are up as drafts, split the way you suggested: decoder and composer first, then the host wiring.
Stack, merge in order:#765 → #766 → #767 → #768 → #769 → #770 → #771 → #772 → #773 → #774. Each PR is one commit. The fork can't push branches here, so every PR targets main and carries the commits below it: review only the top commit, and each diff shrinks as its parents merge. PRs #766–#769 change no behaviour; #770 is the first with any effect, and only behind the flag.
Two standalone fixes came out of the Apple TV soaks. They help the software path in general, not only this route: #775 (seeks on Matroska TrueHD titles never hit the packet cache) and #776 (on tvOS the packet cache moves from a disk file into purgeable memory, because writes to the box's flash stalled reads for 100–600 ms).
How it works
Gate (feat(dovi): route Profile 7 FEL to the dual-layer decoder behind preferDualLayerDolbyVision #770).LoadOptions.preferDualLayerDolbyVision, default false. The route is taken only for Profile 7 FEL (read from the RPU) with dolbyVisionHandling == .automatic, a seekable VOD source, a hardware HEVC decoder for the stream, and a base layer plus enhancement layer that fit a real-time budget (311 Mpx/s: UHD and a 1080p EL at 30 fps). An unknown geometry fails closed. Anything else, MEL included, keeps today's P7 → 8.1 conversion, and so does any failure. One line says why: DV P7 dual-layer route: taken / not taken: <reason>.
Metadata (feat(dovi): Metal FEL composer and Dolby Vision display metadata (not routed) #767). As you described: libdovi mode 2 sets the curves to no-op and keeps L1/L2 and the rest, so the display side does not reshape a second time. The result is attached as DolbyVisionRPUData / DolbyCompatibilityID. Both keys live in one place (DoviDisplayMetadata.swift, "Undocumented attachment keys"), and a test pins them.
Present (fix(renderer): hand FEL frames over in arrival order with a minimum-upcoming hint #773, fix(dovi): preroll the FEL route before the clock starts, and start it ahead of now #774). Composed frames come out of the decoder in decode order. They are handed to AVSampleBufferVideoRenderer as they arrive, with presentationTimeExpectation = .minimumUpcoming, so the renderer sorts them by presentation time itself. Holding them in our reorder buffer cost about one frame in five on an A12. On start and seek the clock waits until composed frames reach 0.167 s past it (2 s at most), then starts 250 ms ahead of now. That covers the display path's lag behind a rate change, roughly the HDMI output latency.
Audio. The route runs on the software host. As you noted, E-AC-3 JOC plays as its 5.1/7.1 core; the flag's docs, docs/api.md and docs/dolby-vision-fel.md say so, and a test pins it.
Your list
TV evidence.
The RPU pulse result is above.
Drops: on a 90 s segment of a full 4K FEL title (TrueHD 7.1, over HTTP), 150 s soaks with 5 seeks gave 0 dropped frames in 8 of 8 runs, with peak footprint 620–650 MB.
On the Mac, full soaks with 15 seeks peak at 382–454 MB, with no growth across seeks.
The EL residual arm (constant RPU, varying EL) and the BL/EL counter arms need the screen filmed. I'll post them here together with a few minutes of the full title with seeks on this exact stack. That is why the PRs are drafts for now.
Parity. The route runs on the same software host as AV1/VP9, so it behaves as that path does. docs/dolby-vision-fel.md has a side-by-side table against the native route.
PiP goes through SoftwarePiPSource. While PiP is active, subtitle cues are drawn into the composed frames by SubtitleFrameCompositor, which keeps the Dolby Vision attachments (SubtitleFrameCompositorTests, feat(dovi): dual-layer Profile 7 FEL decoder (not routed) #769). Whether the PiP window shows the picture as Dolby Vision is not measured.
scrubThumbnail(atSeconds:) answers from the packet cache. The still is the base layer, not the composed picture.
As on AV1/VP9, there is no I-frame playlist, so a stock player draws no thumbnails of its own.
Docs and both runners:docs/api.md, docs/cli.md, docs/dolby-vision-fel.md. swift test passes: 4786 tests on the whole set. The one-thread LIBDISPATCH_COOPERATIVE_POOL_STRICT=1 runner passes too, apart from one ItemSwapStillTests run that the stack doesn't touch; it passed on rerun. The tvOS Simulator test build and the pulse host build both pass, and every branch builds and passes its own tests on its own.
The CI workflows need your approval to run on PRs from a fork.
I was looking at another engine (Zappy - unfortunately proprietary) on Discord, and the developer of that has FEL working on tvOS as well. Their implementation seems to allow for specifying a FEL Precision (10 bit 4:2:0 or 12 bit 4:2:2) for chroma composition, and they said they were surprised Apple pipe accepted 12 bit, which makes me think they are piping VideoToolbox with the 12 bit data instead of requantizing themselves? Or maybe that is the requantization step they are referencing. Unclear to me, but thought I would leave it here in case helpful. Haven't dug into this implementation (and can't really dig into theirs), so maybe it is effectively the same.
Thanks for the detailed work on Profile 7 FEL support!
I noticed that TrueHD Atmos was previously discussed in relation to the FLAC bridge, but AetherEngine now has APAC/Dolby MAT support.
Does the new APAC/Dolby MAT pipeline also work when the full FEL reconstruction path (SoftwarePlaybackHost) is active?
In other words, can an Apple TV 4K simultaneously output full Dolby Vision P7 FEL video and TrueHD Atmos with its original object/height information preserved?
Or does enabling FEL currently require falling back to multichannel PCM without Atmos objects?
I’d appreciate clarification on whether this combination is already supported, technically possible but not yet implemented, or limited by the current playback architecture.
In the released engine (7.47.0 and earlier): no. The FEL route runs on SoftwarePlaybackHost, and there the audio was always the host's own FFmpeg decode to PCM. TrueHD Atmos played as multichannel PCM without objects or heights, and E-AC-3 JOC as its 5.1/7.1 core.
On main, not released yet: yes, the combination exists. The software host now honours LoadOptions.objectAudioRendering on VOD sessions, so with the dual-layer route active:
TrueHD Atmos (and DTS:X) has its objects and heights rendered into a speaker bed (.l512 up to .l916, for example 7.1.4) and is delivered as APAC to the sample-buffer audio renderer. tvOS sends that to an Atmos receiver as Dolby MAT, the same as on the native route.
E-AC-3 JOC goes to the renderer compressed, so its objects survive instead of the channel-bed core.
A few things to be clear about:
It is a render, not a passthrough. The objects are rendered into the chosen bed and encoded as APAC (lossy, 320 kbps per bed channel), in place of the lossless 7.1 the PCM path delivers. The height information is kept; the original object stream itself does not reach the receiver, because tvOS has no bitstream passthrough.
TrueHD and DTS:X object rendering is an optional component, off by default (TrueHDObjectAudio / DTSXObjectAudio package traits). A host has to enable the trait and set objectAudioRendering, otherwise it keeps the PCM decode.
On the software host this is verified on macOS only. The tvOS behaviour together with the FEL route has not been measured yet, so I would not call it supported on Apple TV until it has.
docs/dolby-vision-fel.md (§3.1) and docs/api.md (objectAudioRendering) on main describe the current state.
Released in 7.48.0 (263dc11): the software host (the FEL route) now keeps TrueHD Atmos and DTS:X as APAC under objectAudioRendering, and E-AC-3 JOC stays compressed, as described above.
Hi, I just want to chime in to ask not to remove the full reconstruction path, yes, it can't be used in a shipped app, but we can compile it ourselves and use on our own devices, which is incredibly valuable, please don't drop it
Thanks for saying so. There is no plan to remove it.
The 7.61.0 note only changed which route the docs recommend for apps that ship to other people: the curve fold (DolbyVisionFelCurves) for those, because it leaves the stream's mapping to Apple's licensed decoder. The full reconstruction path stays where it is, behind the DualLayerDolbyVision package trait, for exactly the case you describe: building it yourself for your own devices.
It is also still being worked on, not parked. Recent examples are the compose queue and stall handling from #970 and the second output route through AVPlayer from #967.
Activity
ijuniorfu commentedon Oct 6, 2026
I think adding a toggle to LoadOptions would be excellent; I’m really looking forward to support for the Dolby Vision Profile 7 full enhancement layer.
dotModded commentedon Oct 6, 2026
Few considerations to make here,
AetherEngine currently rewrites the RPU with libdovi mode 2, drops the EL, and packages the unchanged BL as Profile 8.1. That remains a useful fallback and comparison path, but it cannot include FEL pixel data.
The first problem becomes the fact that we need to change the BL to be a single layer stream for 8.1, along with the fact that we will still be limited to 10-bit 4:2:0 Main 10.
You'd need to demux synchronized BL, EL, and RPU data, dovi_tools demux is a good reference, but we'd need a better realtime version that's GPU accelerated. This becomes the next problem, Apple doesn't have a dual layer decoder. We might need to use software decoding which at this bitrate is rough. We need to prove the layers can be decoded independently. Use dovi_tool demux on a short Profile 7 FEL sample to produce BL and EL bitstreams. Open each as its own HEVC stream and try the existing HardwareVideoDecoder on both. This is the first go/no-go test
If we get past these issues after reencoding the shader-processed demuxed streams we can output that. Just switch to mode 5 and you're off.
Libplacebo is a good reference as well
pkajaba commentedon Oct 6, 2026
This is indeed bit of a challenge, since combination of BL + EL is 12 bit. I am doing dithered requantization from 12-bit to 10-bit P010.
That's pretty much what I did and it is possible on Apple TV 4K 2nd gen. it is able to process in real time and hold couple of frames in memory.
there is no need for re-encoding, combined output can be shown by
AVSampleBufferDisplayLayer. I am not sure whether Apple TV would be able to handle encoding of 4K HEVC while running 2 decodes at the same time.Whole pipeline is:
VideoToolbox decode → Metal FEL composition → P010 CVPixelBuffer → CMSampleBuffer → AVSampleBufferDisplayLayerwe can't switch to profile 5, as RPU is not compatible between profile 7 to profile 5. we would need to perform extra processing to make this happen. This path is technically more preferably, since it can result in better picture, but more complex to implement. Interesting read about this topic can be found here: https://www.kscapeowners.com/XF/threads/about-strato-v-dolby-vision-and-fel.6609/
superuser404notfound commentedon Oct 6, 2026
Thanks a lot for putting this together, and for already having a working pipeline, tests and a design doc. That is a serious amount of work, and the dual VideoToolbox decode running in real time on an Apple TV 4K (2nd gen) is a genuinely interesting result.
I'm going to park this for now though, and the reason is the output side rather than the decode side.
AVSampleBufferDisplayLayer does not get Dolby Vision to the panel on tvOS. That is the exact reason AetherEngine moved off its original sample-buffer renderer and onto AVPlayer (loopback HLS) early on: through the display layer the TV never entered Dolby Vision mode. What I could find online matches that:
kVTDecompressionPropertyKey_PropagatePerFrameHDRDisplayMetadata). It is written for iOS 14.1 / iPhone 12 HLG capture and on-device tone mapping, and says nothing about Dolby Vision output over HDMI on tvOS.So the realistic outcome on a DV panel would be HDR10 with the FEL residual applied. Today the same titles play as real Dolby Vision through the P7 to 8.1 conversion. Trading the dynamic mapping for the residual contribution would be a step back for most setups, and it would also add a third render host next to the native and software paths, with its own clock, seek and A/V sync surface.
The one way to keep Dolby Vision with FEL that I can see would be re-encoding the composed frames back into HEVC 8.1 and feeding them through AVPlayer, which means a 4K encode on top of two 4K decodes on the box. I don't think that is viable.
That said, I'd be happy to be proven wrong. If you can show the panel actually reporting Dolby Vision (TV info overlay or an HDMI analyser) with your composed frames going through AVSampleBufferDisplayLayer, that changes the picture completely and I'd gladly revisit it, ideally as an opt-in
LoadOptionstoggle with the current 8.1 conversion as the fallback, as suggested above.pkajaba commentedon Oct 6, 2026
Thanks a lot for a reply, I appreciate it.
You asked whether frames handed to
AVSampleBufferDisplayLayerwith our ownDolbyVisionRPUDataattached really drive the TV as Dolby Vision, or whether the TV just sits in DV mode and shows the picture as HDR10 with static metadata ("fake DV"). I tested it directly. The TV uses the per-frame metadata from our frames. The FEL route responds to an RPU change the same way, and by the same amount, as AVPlayer on a native Profile 8.1 file.dvh1display criteria set throughAVDisplayManager, it does. The LG shows the Dolby Vision badge and switches to its Dolby Vision picture-mode list.AVSampleBufferDisplayLayer), but on tvOS over HDMI to a Dolby Vision TV, and it works.DolbyVisionRPUDataandDolbyCompatibilityIDare plain string keys set withCVBufferSetAttachment. No private symbol is linked, but the keys aren't in any header and no OS release promises to keep consuming them.unspec62NAL without its 2-byte header, with emulation-prevention bytes kept. We produce it with libdovi's mode-2 conversion, the same one the native path uses today.LoadOptionsflag (preferDualLayerDolbyVision, defaultfalse), with the current P7 → 8.1 conversion as the default and fallback.DolbyVisionRPUData. That is the difference.SoftwarePlaybackHost(the AV1/VP9 one), with itsAVSampleBufferRenderSynchronizerclock, seek and A/V sync.DualLayerVideoDecoder: two VideoToolbox sessions, the Metal composer, and the RPU attachment. It sits behind the flag above.Agreed, and it isn't needed.
Method
max_pq2081 vs 4095.dovi_tool inject-rpuand MP4Box.dovi_tool mux.Runs
AVSampleBufferDisplayLayer, VT's own attachmentsdvh1display criteria)DolbyVisionRPUData/DolbyCompatibilityIDremovedResult
Change in camera brightness, B vs A:
What "fake DV" looks like
The absolute patch levels (camera luma, 0–1; 0.995 is the camera clipping) show the picture without metadata is a different picture, and ours isn't it:
Caveats
The clips are synthetic, so the clip generator, harness and analysis scripts can be shared if you want to reproduce this.
Figure: each row is one run, in the order of the table. Shaded bands are the B phases; the y-axis is the camera luma of the three strongest patches, autoscaled per row, so N and S look noisy only because their range is tiny. Straight segments are frames where the frame counter couldn't be read.
superuser404notfound commentedon Oct 6, 2026
That is exactly the evidence I asked for, and a lot more rigorous than a badge on the TV. Thank you for taking the time to build it.
The S run is what settles it for me: same pixels, same layer, only the two attachments removed, and the dynamic response disappears. That also explains what AetherEngine saw back when it rendered through the display layer (and what Kodi describes in #29442): neither attached
DolbyVisionRPUData, so both got the static HDR10 curve. My statement that the layer cannot get Dolby Vision to the panel was wrong, and I'm unparking this.Please go ahead with the PR. Shape as you proposed:
LoadOptions.preferDualLayerDolbyVision, defaultfalse, insideSoftwarePlaybackHost, with the P7 to 8.1 conversion as the default and the fallback. What I'd like to see in or alongside it:Tools/or similar), so it can be rerun per tvOS release without you.docs/, and tests run under bothswift testrunners.Small PRs are welcome if that is easier to review, for example the decoder and composer first, then the host wiring.
dotModded commentedon Oct 6, 2026
I meant dovi_tool mode 5, not DV profile 5, I should have been more clear
This is exciting to see, I fully thought the HEVC stream would need to be encoded again as P8.1. I would also love to see some continued work being put in for LLDV, my projector doesn't support it but I have all the measurements. Would love to not buy an HDFury and just do it on device.
superuser404notfound commentedon Oct 6, 2026
A follow-up on the Atmos point from my last comment, so it can go into the flag's documentation rather than block the PR.
On tvOS, Dolby Atmos in E-AC-3 (JOC) only reaches the receiver through AVPlayer.
AVSampleBufferAudioRendererplays the E-AC-3 core without the object metadata, and tvOS does not pass a bitstream through at all; Atmos leaves the box as Dolby MAT over LPCM, which only AVPlayer produces. The MrMC developers describe the same result from their own native player work (forum thread).So on the dual-layer route an E-AC-3 Atmos track plays as its 5.1 (or 7.1) core. TrueHD Atmos is unaffected in practice, because it already goes through the FLAC bridge on the native path as well. Please note this trade-off in the
preferDualLayerDolbyVisiondocumentation; nothing to engineer around.superuser404notfound commentedon Oct 6, 2026
Thanks for clarifying, that makes sense now.
For the dual-layer route, mode 2 is the right one for the attached RPU, though. The Metal composer already applies the RPU's luma/chroma reshaping and adds the residual, so the frames that reach the display layer are the finished picture. If the attached RPU kept the mapping (mode 5), the display side would reshape a second time on top of an already reshaped picture. Mode 2 sets both curves to no-op and keeps the L1/L2 and the rest of the display metadata, which is what the composed frames need. Mode 5 only made sense in the re-encode idea, and that is off the table now.
LLDV on device is a separate topic. On a display that advertises LLDV the Apple TV already does player-led Dolby Vision itself. What you're describing for a non-DV projector is different: tone mapping the Dolby Vision metadata onto your measured projector on the box, without an HDFury pretending to be an LLDV sink. That needs the same frame path this PR introduces, but it is its own feature with its own design questions (whose tone curve, how the measurements get in, what happens with HDR10 sources). If you'd like it considered, please open a separate feature request with your projector's specs and measurements, so it doesn't get lost in this thread.
fix(dv): make Profile 7 FEL composition opt-in and match DoViBaker an…
pkajaba commentedon Oct 13, 2026
Hey there, apologies for a way.
The PRs are up as drafts, split the way you suggested: decoder and composer first, then the host wiring.
Stack, merge in order: #765 → #766 → #767 → #768 → #769 → #770 → #771 → #772 → #773 → #774. Each PR is one commit. The fork can't push branches here, so every PR targets
mainand carries the commits below it: review only the top commit, and each diff shrinks as its parents merge. PRs #766–#769 change no behaviour; #770 is the first with any effect, and only behind the flag.Two standalone fixes came out of the Apple TV soaks. They help the software path in general, not only this route: #775 (seeks on Matroska TrueHD titles never hit the packet cache) and #776 (on tvOS the packet cache moves from a disk file into purgeable memory, because writes to the box's flash stalled reads for 100–600 ms).
How it works
LoadOptions.preferDualLayerDolbyVision, defaultfalse. The route is taken only for Profile 7 FEL (read from the RPU) withdolbyVisionHandling == .automatic, a seekable VOD source, a hardware HEVC decoder for the stream, and a base layer plus enhancement layer that fit a real-time budget (311 Mpx/s: UHD and a 1080p EL at 30 fps). An unknown geometry fails closed. Anything else, MEL included, keeps today's P7 → 8.1 conversion, and so does any failure. One line says why:DV P7 dual-layer route: taken/not taken: <reason>.DolbyVisionRPUData/DolbyCompatibilityID. Both keys live in one place (DoviDisplayMetadata.swift, "Undocumented attachment keys"), and a test pins them.AVSampleBufferVideoRendereras they arrive, withpresentationTimeExpectation = .minimumUpcoming, so the renderer sorts them by presentation time itself. Holding them in our reorder buffer cost about one frame in five on an A12. On start and seek the clock waits until composed frames reach 0.167 s past it (2 s at most), then starts 250 ms ahead of now. That covers the display path's lag behind a rate change, roughly the HDMI output latency.docs/api.mdanddocs/dolby-vision-fel.mdsay so, and a test pins it.Your list
DualLayerRouteDecision).docs/dolby-vision-fel.mdhas a side-by-side table against the native route.DualLayerSeekRealignmentTests, feat(dovi): dual-layer Profile 7 FEL decoder (not routed) #769).SoftwarePiPSource. While PiP is active, subtitle cues are drawn into the composed frames bySubtitleFrameCompositor, which keeps the Dolby Vision attachments (SubtitleFrameCompositorTests, feat(dovi): dual-layer Profile 7 FEL decoder (not routed) #769). Whether the PiP window shows the picture as Dolby Vision is not measured.scrubThumbnail(atSeconds:)answers from the packet cache. The still is the base layer, not the composed picture.Probes/DolbyVisionPulse. It has the clip generator, the tvOS host, the filming harness and the analysis.docs/api.md,docs/cli.md,docs/dolby-vision-fel.md.swift testpasses: 4786 tests on the whole set. The one-threadLIBDISPATCH_COOPERATIVE_POOL_STRICT=1runner passes too, apart from oneItemSwapStillTestsrun that the stack doesn't touch; it passed on rerun. The tvOS Simulator test build and the pulse host build both pass, and every branch builds and passes its own tests on its own.The CI workflows need your approval to run on PRs from a fork.
holow29 commentedon Oct 13, 2026
I was looking at another engine (Zappy - unfortunately proprietary) on Discord, and the developer of that has FEL working on tvOS as well. Their implementation seems to allow for specifying a FEL Precision (10 bit 4:2:0 or 12 bit 4:2:2) for chroma composition, and they said they were surprised Apple pipe accepted 12 bit, which makes me think they are piping VideoToolbox with the 12 bit data instead of requantizing themselves? Or maybe that is the requantization step they are referencing. Unclear to me, but thought I would leave it here in case helpful. Haven't dug into this implementation (and can't really dig into theirs), so maybe it is effectively the same.
pkajaba commentedon Oct 13, 2026
Yes, apple allows to set these values. There is even 12 bit 4:2:0 option but it is not public.
Merge PR #769: dual-layer Profile 7 FEL decoder (not routed)
Merge PR #770: route Profile 7 FEL to the dual-layer decoder behind p…
DudiThePsycho commentedon Oct 25, 2026
Thanks for the detailed work on Profile 7 FEL support!
I noticed that TrueHD Atmos was previously discussed in relation to the FLAC bridge, but AetherEngine now has APAC/Dolby MAT support.
Does the new APAC/Dolby MAT pipeline also work when the full FEL reconstruction path (SoftwarePlaybackHost) is active?
In other words, can an Apple TV 4K simultaneously output full Dolby Vision P7 FEL video and TrueHD Atmos with its original object/height information preserved?
Or does enabling FEL currently require falling back to multichannel PCM without Atmos objects?
I’d appreciate clarification on whether this combination is already supported, technically possible but not yet implemented, or limited by the current playback architecture.
Thanks!
superuser404notfound commentedon Oct 26, 2026
Good question, and the answer changed recently.
In the released engine (7.47.0 and earlier): no. The FEL route runs on
SoftwarePlaybackHost, and there the audio was always the host's own FFmpeg decode to PCM. TrueHD Atmos played as multichannel PCM without objects or heights, and E-AC-3 JOC as its 5.1/7.1 core.On
main, not released yet: yes, the combination exists. The software host now honoursLoadOptions.objectAudioRenderingon VOD sessions, so with the dual-layer route active:.l512up to.l916, for example 7.1.4) and is delivered as APAC to the sample-buffer audio renderer. tvOS sends that to an Atmos receiver as Dolby MAT, the same as on the native route.A few things to be clear about:
TrueHDObjectAudio/DTSXObjectAudiopackage traits). A host has to enable the trait and setobjectAudioRendering, otherwise it keeps the PCM decode.docs/dolby-vision-fel.md(§3.1) anddocs/api.md(objectAudioRendering) onmaindescribe the current state.superuser404notfound commentedon Oct 26, 2026
Released in 7.48.0 (263dc11): the software host (the FEL route) now keeps TrueHD Atmos and DTS:X as APAC under
objectAudioRendering, and E-AC-3 JOC stays compressed, as described above.andreiborisov commentedon Nov 11, 2026
Hi, I just want to chime in to ask not to remove the full reconstruction path, yes, it can't be used in a shipped app, but we can compile it ourselves and use on our own devices, which is incredibly valuable, please don't drop it
superuser404notfound commentedon Nov 11, 2026
Thanks for saying so. There is no plan to remove it.
The 7.61.0 note only changed which route the docs recommend for apps that ship to other people: the curve fold (
DolbyVisionFelCurves) for those, because it leaves the stream's mapping to Apple's licensed decoder. The full reconstruction path stays where it is, behind theDualLayerDolbyVisionpackage trait, for exactly the case you describe: building it yourself for your own devices.It is also still being worked on, not parked. Recent examples are the compose queue and stall handling from #970 and the second output route through AVPlayer from #967.