Skip to content

RFC: native Dolby Vision Profile 7 support on the loopback-HLS path (offering the implementation) #132

Closed

Description

@rrgomes

Dolby Vision Profile 7 (dual-layer: HEVC base layer + enhancement layer + RPU metadata, the profile carried by Blu-ray remuxes) currently has no good route through the engine. tvOS hardware only engages its Dolby Vision pipeline for single-layer profiles with proper signaling, so a P7 source either plays as HDR10 (losing the DV grade on DV displays) or needs external handling entirely.

We have been running a host-side solution in production for several weeks and would like to move it into the engine, where every adopter with remux libraries would benefit. What it does, at remux time on the loopback-HLS producer path:

  • Converts P7 dual-layer to P8.1 single-layer using libdovi: patch the DOVI configuration record (profile 7 to 8.1, bl_compat_id = 1), carry the RPUs through to the base-layer stream, drop the enhancement layer.
  • Advertises the result correctly in the master playlist: SUPPLEMENTAL-CODECS="dvh1.08.06/db1p" alongside the HEVC codec string, VIDEO-RANGE=PQ. With that signaling, AVPlayer engages the hardware DV pipeline on DV displays; non-DV displays fall back to the HDR10 base exactly as before.

Measured cost is 0.2 to 0.4 ms per frame on an Apple TV 4K 3rd gen (frame budget 41.7 ms at 23.976), i.e. comfortably real-time, validated end to end on a 4K HEVC P7 feature of about two hours on two Dolby Vision OLED panels, with SDR devices tonemapping the HDR10 base as they do today.

The engine seems like the right home for this: the loopback-HLS producer already rebuilds init segments and playlists, detection is cheap (DOVI configuration record, profile == 7, at open), and LibDovi is your own package, so the dependency stays in your orbit. A possible shape: automatic conversion when profile 7 is detected on the loopback path, with a LoadOptions opt-out if you want one.

We are happy to implement this and send a PR from a fork, as with the earlier autoplay and cue-store changes. Before starting we would appreciate your guidance on placement: whether you would want the libdovi stage inside the segment producer or as a separate pipeline node, and whether the dependency should sit behind a build flag for adopters who do not want it.

Activity

  1. superuser404notfound commented on Jul 17, 2026

    @superuser404notfound
    Owner

    Thanks for the detailed writeup, and for offering to build it. Good news on this one: it already landed. Native Profile 7 to 8.1 conversion on the loopback-HLS producer path has shipped since 3.11.0 (commit acee1ad, mid-June) and is what current releases run in production. What is in the engine today maps almost exactly onto what you describe:

    • P7 to P8.1 via libdovi: DoviRpuConverter.convertPacketToProfile81 runs per packet in the producer pump, calling dovi_convert_rpu_with_mode(rpu, 2). The RPU is rewritten and carried on the base layer; the enhancement-layer NAL (type 63) is dropped.
    • DOVI configuration record patch: rewriteDoviConfigToProfile81 in MP4SegmentMuxer rewrites the record in the init segment to dv_profile = 8, dv_bl_signal_compatibility_id = 1, el_present_flag = 0.
    • Master playlist signaling: SUPPLEMENTAL-CODECS="dvh1.08.<level>/db1p" alongside the HEVC codec string, plus VIDEO-RANGE=PQ. The DV level is derived from the source rather than fixed, otherwise identical to the dvh1.08.06/db1p you quote. AVPlayer engages the hardware DV pipeline on DV displays; non-DV displays strip the dvcC and fall back to the HDR10 PQ base exactly as you describe.
    • Detection: at open, resolveCodecRoute reads the DOVI configuration record and classifies profile == 7, then routes accordingly. No host involvement.

    So the placement question resolves itself: the libdovi work sits inside the segment producer (per-packet RPU rewrite) plus the muxer (container record rewrite), which is the shape you were leaning toward. The dependency is not behind a build flag: LibDovi ships as a prebuilt xcframework resolved over Git, so there is no Rust in the build and no adopter-facing toggle needed. The one RFC item not present is the LoadOptions opt-out. I left it out deliberately, since on a DV panel the conversion is the desired path and there was no concrete need for a switch. If your production setup relies on disabling it, say so and I will add the flag.

    Since all of this is already live, I am closing this as completed. Two asks, given you have been running your own version in the field for weeks: please test a P7 remux against 5.6.2 and confirm it matches your results, and if your implementation handles any edge cases the engine version does not (unusual RPU layouts, MEL vs FEL specifics, level derivation, anything), open a follow-up. That is exactly the kind of field feedback worth folding in.

    Thanks again for the continued contributions.

  2. rrgomes commented on Jul 18, 2026

    @rrgomes
    ContributorAuthor

    Confirmed on 5.6.2. We routed a 4K HEVC Dolby Vision Profile 7 remux (MEL, CM v4.x, 118 min, FLAC audio, PGS subtitles) through the engine's native path on two DV panels (2026 LG G6, 2019 LG C9) that previously used our client-side conversion, plus one SDR display for the strip path.

    Results match our implementation across the board:

    • Both DV panels enter Dolby Vision mode; the master carries CODECS="hvc1.2.4.L153,fLaC" with SUPPLEMENTAL-CODECS="dvh1.08.06/db1p", VIDEO-RANGE=PQ — matching what our path authored for the same source, including the level derivation.
    • Start latency is comparable to our converter path.
    • Rapid seek bursts land cleanly (clock/presentation divergence settles under 0.4 s, no stalls, no late landings against the bounded-seek deadline).
    • PGS subtitles render via the side-demuxer overlay path; A/V sync holds; FLAC passthrough works with audioSourceStreamIndex resolved at load (Open the source demuxer once and reuse that preopenedDemuxer across the pre-playback stages #72).
    • The SDR display correctly falls back to the HDR10 base layer via the media-only playlist.

    One observation, by design as far as we can tell: with Match Content on, a load issued while the panel is mid-HDMI-renegotiation (a few seconds after a previous HDR teardown) probes the panel as non-HDR and serves the media-only playlist, so that session plays without DV. Back-to-back A/B cycling surfaces it; normal usage doesn't.

    We're retiring our client-side conversion path on the strength of this. Edge-case notes coming in a separate issue as requested.

  3. superuser404notfound commented on Jul 18, 2026

    @superuser404notfound
    Owner

    Thanks for the device confirmation on 5.6.2. Two DV panels plus an SDR fallback check is a thorough A/B, and good to hear you are retiring the client-side path. The edge-case notes you filed in #135 are folded into 5.8.1 (FEL-source logging plus a cleaner HDR10 degrade on conversion failure).

    On the Match-Content observation: by design, as you diagnosed. A load issued mid-HDMI-renegotiation probes the freshly torn-down panel as non-HDR and correctly serves the media-only playlist for what the panel reports at that instant. Adding a settle/retry window on every load to catch an A/B-cycling-only case would cost start latency on the normal path for no real-usage benefit, so I am leaving it. If it ever surfaces outside back-to-back cycling, reopen and we will revisit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions