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
feat(playback): serve Dolby Vision Profile 7 as Profile 8.1 over the HLS copy remux - #3447
Merge together with #3327. The clients that need this change are packaged smart-TV apps such as Moonfin for webOS, and those can't open Silo's v2 sockets until #3327 lands. The two PRs don't depend on each other in code.
Most UHD Blu-ray rips carry single-track Dolby Vision Profile 7. Many TVs and streaming boxes decode Profile 8.1 but not Profile 7. When such a client can't play the file directly, Silo serves it as an HLS copy remux, and today the only Profile 7 recipe there is server_dv7_to_hdr10, which strips Dolby Vision. An LG C4 running Moonfin for webOS plays these titles as HDR10 even though it shows Profile 8.1 Dolby Vision.
This change adds server_dv7_to_dv81. It converts the Profile 7 metadata to Profile 8.1 inside the copy remux, so those clients get Dolby Vision. The planner tries it after native playback and the client-side client_dv7_to_dv81, and before the HDR10 strip. Nothing is decoded or re-encoded. A Profile 7 enhancement layer is dropped, as the strip already does, so a FEL disc loses the enhancement detail but keeps its Dolby Vision metadata.
Approach
internal/playback/dovirpu ports dovi_tool's mode 2 conversion (MIT, licence in testdata/). It sets the residual off, removes the NLQ data, resets a FEL's mapping to identity and writes the 8.1 DM coefficients. Fields after the CM v2.9 extension-block count are byte-aligned and copied verbatim.
FFmpeg keeps its single process. For this recipe its filter chain only removes the enhancement layer (filter_units=remove_types=63), and -strict unofficial makes it write the DOVI record.
TranscodeSession.OpenSegment rewrites each fMP4 file before it serves it. Native, Jellyfin-compatible and transcode-node serving all go through it.
init.mp4: the Profile 7 dvcC becomes a Profile 8.1 dvvC with compatibility id 1.
Media segments: each RPU is converted in place. A filler-data NAL placed before it takes up the bytes the conversion saves, so no sample, trun or box changes size.
An RPU that won't convert becomes filler, so that frame plays its HDR10 base layer.
A segment that won't convert at all isn't served under the 8.1 claim. The open fails and the client replans onto the strip.
Each segment is converted once per FFmpeg generation.
Only single-track sources qualify: the scanned DOVI record must list RPUs, enhancement layer and base layer in the copied track. The output keeps the hvc1 sample entry, because LG webOS shows dvh1 MP4 as HDR10. The recipe is offered over fMP4 HLS only, with no MPEG-TS or progressive form.
A Profile 7 source never gets a plain copy remux. When the strip is unavailable, a failed 8.1 attempt falls through to a transcode.
Validation
Go tests for internal/playback/..., internal/api/handlers, internal/transcodenode and internal/streamtoken pass. In internal/jellycompat, the three Dolby Vision strip tests that also fail on main with this machine's FFmpeg build fail; nothing else does. The full make test-go suite and DB-contract tests weren't run, and there's no schema change.
scripts/lint-changed.sh is clean, and the regenerated playback fixtures (one new dolby_vision_7_to_dv81 scenario) are current.
Converter tests:
MEL: matches dovi_tool's golden pair.
FEL: a minute of a real FEL disc (1,464 frames) matches dovi_tool 2.3.4 -m 2 byte for byte. dovi_tool ships no direct FEL → 8.1 pair. The corpus test is opt-in through SILO_DOVI_CORPUS, and the disc data stays out of the repo.
Fuzzing: the converter and the segment parser ran millions of inputs with no panics.
A Dolby Vision 8.1 HLS client gets server_dv7_to_dv81 with a Dolby Vision claim.
The served init.mp4 is hvc1 with a Profile 8.1 record.
Starting at 10 minutes, all 105 served RPUs are 8.1 and byte-identical to dovi_tool's. Starting at 60 minutes, all 103 are 8.1.
Without this branch, the same client gets the HDR10 strip with no DOVI record.
LG C4, Moonfin for webOS 3.0.0: Dolby Vision on a Profile 7 FEL disc rip that played as HDR10 before. Playback and scrubbing are fine.
Not tested: Apple, Android or browser players taking the server-made 8.1 stream. Silo for Apple TV converts Profile 7 on the device, so it never reached this path.
Evidence
Before
After
LG C4 shows HDR10
LG C4 shows Dolby Vision
Surface and build: LG C4, Moonfin for webOS 3.0.0. Before: upstream maind10d9c937. After: the same main with this branch. Both carry #3327's socket commit.
No migration. server_dv7_to_dv81 and its profile7_rpu_converted_to_profile81 claim are additive, and the schemas and web player don't reject unknown transformation names.
A transcode node advertises the recipe only once it runs this build, so an older node is never handed it.
Apple's players haven't seen this stream. Safari or a native Apple client that reports Profile 8 but can't convert Profile 7 itself would now get it: hvc1 with dvvC, and no CODECS or SUPPLEMENTAL-CODECS in Silo's playlist. If AVPlayer needs those to switch into Dolby Vision, those clients would see HDR10, which is what they get today.
The first request for each media segment reads and rewrites the whole file under the session lock. That's up to about 40 MB for a 4K segment. Converting four such segments (138 MB) took 0.08 s in a local run.
The Jellyfin-compatible path doesn't offer the recipe yet.
Checklist
I read and can explain the complete diff.
This pull request addresses one concern.
Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
The Evidence section shows every change a user can see, or says there is none.
AI Disclosure
Harness: Claude Code
Tool(s): Claude Code
Model(s): claude-opus-5-5
Involvement: Fully AI-generated, human verified
Adversarial review: Claude Code's /code-review at high effort over the whole branch diff found 9 candidates.
Fixed: a Profile 7 copy remux left unconverted when the strip is unavailable; an early terminal that ignored the 8.1 route; serving segments that failed to convert; re-reading every segment on every request; trun parsing without a data offset or sample sizes.
Rejected: alignment after a zero extension-block count, because dovi_tool aligns unconditionally; the choice of video track, because the source descriptor uses the same track.
Deferred: converting at segment finalisation instead of first serve; sharing an Exp-Golomb reader with the scanner.
The C4 test was done by hand.
Note
Serve Dolby Vision Profile 7 as Profile 8.1 over HLS copy remux
Adds a new server_dv7_to_dv81 transformation so the playback planner can pick an HLS copy remux that converts Profile 7 sources to Profile 8.1 server-side instead of stripping to HDR10. Eligibility requires an HEVC Profile 7 source with RPU, enhancement-layer, and base-layer presence, Profile 8 client support, and the filter_units bitstream filter in FFmpeg
New dovirpu package converts Profile 7 RPUs to Profile 8.1 in place, preserving MEL mapping curves, replacing non-MEL mapping with identity curves, and writing fixed Profile 8.1 DM coefficients. Segment and init converters in segment.go rewrite fMP4 files without changing byte length, using HEVC filler NALs for unconvertible RPUs or saved space
transcode.go adds the DV7ToDV81BitstreamFilter recipe (copy-video fMP4 only). OpenSegment converts init and media segments before serving; conversion is serialized per session and each segment converts at most once per generation
The planner in plan_v3.go prefers the server 8.1 conversion over HDR10 stripping and no longer preserves Profile 7 unconverted. The route is excluded for MPEG-TS HLS copies and progressive remux
Behavioral Change: Profile 7 HLS remux plans now produce Profile 8.1 output; OpenSegment opens segment files read-write for these sessions and returns errors when conversion fails (ErrNoRPUConverted, ErrUnsupportedInit). An HLS delivery that rejects Dolby Vision gets the conversion-unsupported terminal when stripping is unavailable
Add internal/playback/dovirpu, a port of dovi_tool's mode 2 RPU
conversion: the residual is disabled, the NLQ data removed, a FEL's
mapping reset to identity, and the DM coefficients set to the 8.1 ones.
Everything after the CM v2.9 block count is byte-aligned, so it is
copied verbatim instead of re-serialized.
The MEL output matches dovi_tool's golden fixture, and a corpus test
compares every frame of a real disc against `dovi_tool -m 2` when
SILO_DOVI_CORPUS is set (1,464 FEL frames match).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ConvertInit relabels the video track's Profile 7 DOVI record (dvcC, EL
present, compatibility id 6) as Profile 8.1 (dvvC, no EL, compatibility
id 1). ConvertSegment walks moof/traf/trun to each video sample and
converts its RPU NALs in place: a converted RPU is preceded by a
filler-data NAL that takes up the bytes it saved, so no sample, run or
box changes size. An RPU that cannot be converted becomes filler, so
that frame plays its HDR10 base layer. Both passes are idempotent.
On real copy-HLS segments of a Profile 7 FEL disc every RPU matches
`dovi_tool -m 2`, and an LG C4 shows Dolby Vision for this layout
(filler before the RPU, hvc1/hev1 sample entry with dvvC).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add the server_dv7_to_dv81 transformation. A single-track Profile 7
source (its DOVI record lists RPUs, enhancement layer and base layer in
the copied track) goes to a client that takes Dolby Vision Profile 8.1
as an fMP4 HLS copy remux, ranked after native playback and the
client-side conversion and before the HDR10 strip.
FFmpeg drops only the enhancement layer (filter_units) and writes the
DOVI record (-strict unofficial). OpenSegment then converts each file
as it is served, under the session lock: init.mp4's record is relabelled
as Profile 8.1 and the media segment's RPUs are rewritten in place by
dovirpu. Every serving path (native, Jellyfin-compatible, transcode
node) opens segments there. The sample entry stays hvc1, since LG webOS
drops to HDR10 for dvh1.
The recipe is advertised wherever FFmpeg has filter_units; MPEG-TS and
progressive forms are not offered.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review fixes for the server Dolby Vision 8.1 conversion:
- A Profile 7 source never gets the plain "preserve" remux. With the 8.1
conversion available but the HDR10 strip not (FFmpeg without
dovi_rpu, or an RPU it cannot parse), a failed 8.1 attempt now falls
through to a transcode instead of copying the enhancement layer and
Profile 7 RPUs.
- The early dv_conversion_unsupported terminal counts the server 8.1
route, which does not use dovi_rpu.
- OpenSegment no longer serves a segment it could not convert under the
plan's 8.1 claim: the open fails and the client replans. An init.mp4
that does not parse yet reads as not ready. Each media segment is
converted once per FFmpeg generation instead of on every request.
- The fragment parser continues a trun without a data offset from the
previous run, and refuses a fragment with no sample sizes instead of
converting nothing.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve plan_v3.go: keep main's HLSCopyFitsMPEGTS check for MPEG-TS copy
packaging, and keep the server Dolby Vision 8.1 recipe on fMP4 (!dv81).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
No actionable comments were generated in the recent review.
Walkthrough
The playback planner adds a server-side Dolby Vision Profile 7-to-8.1 HLS remux route. The serving path updates fMP4 initialization metadata and converts RPUs in media segments. Protocol declarations, capability registration, tests, conformance data, and documentation describe the route.
Registers the server transformation and its claims. The planner selects the HLS Profile 8.1 route when source metadata, client support, and registry capability allow it. Tests, conformance data, and documentation cover the route.
HLS session and segment serving internal/playback/transcode.go, internal/api/handlers/playback_v3.go, internal/playback/subtitle_rendition.go
Allows the filter in copied-video fMP4 sessions, converts initialization and media files before serving, and selects the HVC1 sample entry and PQ range.
Silo-Server/silo-server#3025 — Both PRs implement server-side Profile 7-to-8.1 conversion; this PR adds the fMP4 copy-remux path and internal RPU conversion.
Silo-Server/silo-server#3026 — Both PRs define HLS copy-remux packaging boundaries; this PR restricts the conversion to fMP4 and excludes MPEG-TS.
Silo-Server/silo-server#3033 — Both PRs use copied HLS video range metadata; this PR updates range handling for the DV7-to-DV8.1 filter.
A Dolby Vision stream that fails conversion mid-playback may repeatedly select the same failing route instead of falling back to HDR10 or transcoding. Resolve or explicitly accept this fallback gap before merging.
Security architecture risk: Moderate · up to 7ca45
The conversion is restricted to eligible playback routes and selected output files. However, large media segments can create shared-memory pressure, and recovery after an interrupted rewrite is not fully established.
Retained concerns
Medium · security · inferred: The new conversion allocates an entire generated segment before delivery without a byte ceiling in the inspected path. A party able to supply a large qualifying media file and cause playback could therefore place memory pressure on the shared serving process, rather than only the existing FFmpeg workload. Per-session locking does not bound allocation size or aggregate concurrent-session consumption. Deployment-level limits and effective attacker access remain unverified.
Security review details
Security Blast Radius
inferred — The principal introduced exposure is availability of the process performing conversion, including other sessions sharing its memory. The inspected write capability is confined to selected session-output descriptors; the evidence does not establish cross-library modification, credential access, or broader environment authority.
Security Findings and Attack Paths
inferred — The resource-exhaustion scenario requires influence over qualifying media and the ability to trigger its playback: media is copy-remuxed by FFmpeg, then the complete generated segment is allocated for conversion before HTTP delivery. Direct injection of arbitrary MP4 run counts through this route is not established because FFmpeg produces the container; that parser weakness is not treated as a verified remote exploit.
Trust Boundaries and Controls
observed — Conversion uses the same opened descriptor that will be served. Existing single-filename validation, os.Root confinement, regular-file checks, and restart checks remain in place. Only the selected conversion recipe changes the open mode to read-write. Conversion errors close the lease instead of handing it to the HTTP serving path.
Resilience and Maintainability Implications
observed — Conversions are serialized per session and marked complete only after successful writes. Already converted Profile 8 RPUs are skipped on repetition. Writes are not transactional, however: an error can leave earlier ranges or part of a range changed. The failed request is blocked, but restoration or quarantine is absent from the inspected conversion path, so arbitrary interrupted-write recovery is not established.
Hardening Proposals
proposed — Introduce a maximum conversion size and an aggregate memory budget before whole-file allocation. Bound sample-count allocations independently of optional trun fields, even though arbitrary attacker control of generated container metadata has not been demonstrated.
proposed — Define a terminal recovery policy for write failures, such as quarantining and regenerating the affected output, rather than relying on retries over potentially partially rewritten bytes.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title names the main change: a server-side Dolby Vision Profile 7 to Profile 8.1 conversion inside the HLS copy remux. The summary, objectives and file changes all center on the new server_dv7_to_…
Description check
The description states the problem (single-track Dolby Vision Profile 7 sources that clients cannot decode directly), the approach (new server_dv7_to_dv81 recipe, dovirpu package, OpenSegment conversi…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: a server-side Dolby Vision Profile 7 to Profile 8.1 conversion inside the HLS copy remux. The summary, objectives and file changes all center on the new server_dv7_to_dv81 recipe, its planner route, and the fMP4 segment and init rewriting. The title is specific and matches the changeset.
Full details: Description check
Explanation
The description states the problem (single-track Dolby Vision Profile 7 sources that clients cannot decode directly), the approach (new server_dv7_to_dv81 recipe, dovirpu package, OpenSegment conversion, planner ordering), validation steps, and risks. It matches the changeset in detail.
Full details: Docstring Coverage
Explanation
Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 42 functions across 14 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Tip
🎯 Customize your risk assessments
Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.
✅ Automatic approvals, with your rules
Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 9a91d415-1306-4574-bfd8-1626a04974c1
Commits
Reviewing files that changed from the base of the PR and between e394e66 and 7ca457e.
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
coderabbitaiBot
added
api-v2
API v2 / Huma migration program (epic #135); long-running, stacked by phase
evidence-required
Needs before-and-after evidence before the Evidence check passes
go
Pull requests that update go code
impact: usability
Core flow broken or severely blocked
needs-review
Needs maintainer review to resolve uncertain classification, scope, or changed evidence.
size/XXXL
3000+ added + deleted lines (all files); change volume, not priority.
labels
Nov 3, 2026
The reason will be displayed to describe this comment to others. Learn more.
Unsupported Profile 7 RPUs are served unchanged as Profile 8.1
Unsupported Profile 7 RPUs remain unchanged even though the init segment is labeled Profile 8.1 and the enhancement layer is removed. Distinguish already-converted Profile 8 RPUs from unsupported Profile 7 RPUs in the ErrNotProfile7 branch, and replace the latter with filler or fail the segment.
Prompt for LLM
File internal/playback/dovirpu/segment.go, lines 333-336:
Unsupported Profile 7 RPUs are served unchanged as Profile 8.1
`ErrNotProfile7` also covers Profile 7 RPUs with unsupported header flags, so this branch serves those original RPUs unchanged after the init segment has been relabeled Profile 8.1 and the enhancement layer removed. Distinguish an already-converted Profile 8 RPU from an unsupported Profile 7 RPU and replace the latter with filler or fail the segment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in e703391. ErrNotProfile7 is now ErrProfile8, and ConvertRPU returns it only when the RPU header already declares Profile 8 (vdr_rpu_profile 1 without the residual, as in dovi_tool's get_dovi_profile). That's the case for an RPU this package already converted. Any other RPU it can't convert, including a 10-bit-VDR "Profile 4" RPU or one without sequence info, is now an error. convertSample replaces it with filler, so that frame plays its HDR10 base layer instead of carrying Profile 7 metadata under the 8.1 record. TestConvertRPURejectsUnsupportedRPUs covers the Profile 4 case.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing this. Based on your description, the change resolves the concern: already-converted Profile 8 RPUs are preserved, while unsupported RPUs are replaced with filler rather than served under the Profile 8.1 claim.
I haven’t independently verified the commit or test.
The reason will be displayed to describe this comment to others. Learn more.
DV8.1 conversion ignores the client's MPEG-TS packaging request
Overriding hls_copy_mpegts_v1 can cause silent audio on clients that request MPEG-TS to avoid fMP4 audio problems. Exclude the DV8.1 candidate when MPEG-TS is requested so the planner can select a compatible route.
Prompt for LLM
File internal/playback/plan_v3.go, lines 789-791:
DV8.1 conversion ignores the client's MPEG-TS packaging request
The DV8.1 candidate overrides an explicit `hls_copy_mpegts_v1` request and serves fMP4 instead, causing silent audio on clients for which that feature selects MPEG-TS to avoid the fMP4 problem. Exclude the DV8.1 candidate when the client requests MPEG-TS so the planner can select the compatible HDR10 strip or another route.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in e703391. canServerConvertDV7ToDV81V3 now returns false when the HLS delivery lists hls_copy_mpegts_v1, so such a client keeps the HDR10 strip in MPEG-TS, as it gets today. This also restores the MPEG-TS packaging condition to main's exact line. A case in TestPlanPlaybackV3Profile7ConvertsToDV81BeforeStrip checks that a client listing the feature gets no 8.1 plan.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. Excluding the 8.1 candidate when the client lists hls_copy_mpegts_v1 addresses the packaging concern, and the added test covers that selection behavior. I haven’t independently verified the commit or run the test.
The reason will be displayed to describe this comment to others. Learn more.
Full segment conversion holds the session-wide mutex
Reading and rewriting a full UHD segment under the session-wide mutex serializes segment requests and blocks other operations. Coordinate convertDV81Locked per segment and perform file I/O outside the session-wide lock while preserving generation checks.
Prompt for LLM
File internal/playback/transcode.go, lines 3144-3145:
Full segment conversion holds the session-wide mutex
Each first request reads and rewrites an entire UHD media segment while holding the session-wide mutex, serializing simultaneous segment requests and blocking other operations that need the same lock. Coordinate conversion per segment and perform the file I/O outside the session-wide lock while preserving generation checks.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in e703391. OpenSegment now opens the file and records its generation under s.mu, then converts after releasing it, under a separate dv81Mu that also guards the per-generation "already converted" record. The first request for a segment no longer blocks other users of the session lock. Each segment is still converted once per FFmpeg generation, and a repeat request skips it. Conversions within one session are serialized by dv81Mu. A per-segment lock would let two different segments convert in parallel, but players request segments in order, so I left that out. On the test server, four concurrent requests for an unfetched segment got identical, fully converted bytes.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. Moving conversion outside s.mu addresses the session-lock contention raised in the suggestion. Keeping the separate dv81Mu is a reasonable tradeoff for now, though conversions of different segments in the same session remain serialized.
The concurrent-request test is useful evidence that requests for the same segment receive consistent converted bytes. I haven’t independently verified the commit or its generation-handling logic.
hdrDetailsSupportPlanV3 checks the server 8.1 plan as Profile 7, so delivery-level HDR details reject it.
The new HLS candidate sets EffectiveRecipe.DynamicRange = DynamicRangeDolbyVisionV3 and adds TransformationServerDV7DV81V3 (Lines 718-720). plan.Source.DVProfile is still 7. Before the planner returns the candidate, it calls deliverySupportsPlanV3(input.Request, DeliveryClassHLSV3, plan) (Line 840).
When the HLS delivery declares hdr_details, that call runs hdrDetailsSupportPlanV3. That function rewrites the candidate to Profile 8 / compat id 1 only for ClientDV7ToDV81V3. For the server transformation, it checks Profile 7 against the client's DolbyVisionProfiles. A client that advertises only [8] then rejects every server 8.1 plan. Planning falls through to the HDR10 strip or a transcode.
canServerConvertDV7ToDV81V3 approved the route using Profile 8 against the output HDR details. The two checks disagree. The fixtures and the new test leave delivery-level HDRDetails nil, so they do not catch this.
🐛 Proposed fix
candidate := plan.Source
for _, transformation := range plan.Transformations {
- if transformation.Name == ClientDV7ToDV81V3 {+ if transformation.Name == ClientDV7ToDV81V3 || transformation.Name == TransformationServerDV7DV81V3 {
candidate.DVProfile = 8
candidate.DVBLCompatID = 1
break
}
}
- Only an RPU that is already Profile 8 is left in place (ErrProfile8).
A Profile 7 stream's RPU that is neither Profile 7 nor 8 (a 10-bit
VDR, no sequence info) now becomes filler instead of being served
unconverted under the Profile 8.1 record.
- Refuse a FEL's identity mapping when coefficients are floats
(coefficient_data_type 1): written as integer and fraction parts it
would map every pixel to 0. dovi_tool writes the same zero.
- Don't offer the conversion to a client that lists hls_copy_mpegts_v1:
it needs MPEG-TS copies, and the conversion rewrites fMP4 only.
- hdrDetailsSupportPlanV3 checks a server 8.1 plan as Profile 8, so an
HLS delivery that declares its own hdr_details no longer rejects it.
- An init.mp4 that parses but cannot carry 8.1 (no DOVI record, another
profile) fails the request at once instead of reading as not ready
until the wait times out.
- Convert segments under their own lock instead of the session mutex,
so a first request's file I/O no longer blocks the session.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
Restart can cause conversion and serving to use different segment files
A restart can cause convertDV81 to convert a replacement file while HTTP serves the old, unconverted Profile 7 descriptor captured by openSegment. Convert the leased file and synchronize generation changes and init-segment selection, or reject the lease if its generation changed.
Prompt for LLM
File internal/playback/transcode.go, line 3115:
Restart can cause conversion and serving to use different segment files
A restart can replace the segment after `openSegment` captures its descriptor but before `convertDV81` reopens the filename, so conversion operates on the replacement while HTTP serves the old, unconverted Profile 7 descriptor. Convert the leased file itself and synchronize generation changes and init-segment selection with the conversion, or reject the lease if its generation changed.
The reason will be displayed to describe this comment to others. Learn more.
for a Dolby Vision 8.1 session, openSegment now opens the leased segment read-write, and convertDV81 rewrites that same descriptor instead of reopening the file by name. What's converted and what's served are always the same file, even if a restart replaces it in between. For a media segment, the current init.mp4 is still read by name, but only for the track ID and NAL length size, which a restart of the same recipe doesn't change. The "already converted" record is still keyed on the lease's generation. That's safe because a restart blocks new leases (under s.mu) until it has bumped the generation.
The reason will be displayed to describe this comment to others. Learn more.
Rewriting the leased descriptor addresses the original race: replacing the pathname after the lease is opened no longer causes conversion and serving to use different files.
The remaining safety claims depend on two assumptions:
A restart of the same recipe preserves the video track ID and NAL length size in init.mp4.
Conversion tracking and locking handle an old-generation lease finishing after a restart without interfering with the new generation’s record.
If those hold, the original suggestion appears addressed. I haven’t independently verified the updated implementation. A regression test that pauses after opening a lease, restarts the session, and then resumes conversion would be useful for covering that interleaving.
convertDV81 reopened the segment by name after openSegment had taken the
lease's descriptor. A restart that replaced the file in between would
have converted the replacement while the client was served the old,
unconverted Profile 7 file. A DV7ToDV81BitstreamFilter session now opens
the leased file read-write and converts that descriptor. For a media
segment the current init.mp4 still supplies the track id and NAL length
size, which a restart of the same recipe does not change.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A copy restart keeps the earlier segments, but FFmpeg recreates
init.mp4 and leaves it empty until its first segment is done. The
restart also bumps the generation, so a kept segment is converted
again and reads that init. ConvertInit reported a file with no moov as
ErrUnsupportedInit ("no video track"), so convertDV81 served a 500 and
the client replanned away from Dolby Vision 8.1. It now returns a
plain error, which convertDV81 already reads as not ready.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.
Reviewing changes in Silo
Include the related issue, expected behavior, and validation steps in the PR description.
For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
Follow this repository's AGENTS.md and CONTRIBUTING.md.
Request another review with @kody start-review in a PR comment.
React with 👍 or 👎 to give feedback on individual suggestions.
Review settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 4 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
…and serving
- Offer server_dv7_to_dv81 only when the HLS delivery's own HDR details take
Profile 8.1. Otherwise the 8.1 candidate lifted the planner's Dolby Vision
gates for a plan the delivery check always rejects, and an unstrippable
Profile 7 source got hdr_transcode_unsupported instead of
dv_conversion_unsupported.
- Keep the video track read from init.mp4 on the session. A media segment no
longer reopens init.mp4 read-write, so it neither waits on nor writes back
over an init.mp4 FFmpeg is rewriting after a restart. ConvertInitFile writes
back only the bytes it changed.
- Fail a segment closed when none of its RPUs converted, instead of serving
frames with no Dolby Vision metadata under the 8.1 claim.
- Convert an RPU that keeps its length (one reusing the previous mapping) in
place. It used to become filler because no filler NAL fits in zero bytes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🤖 Claude Code (claude-opus-5-5)
I reviewed this as a maintainer and tested it on a sandbox, comparing main with this branch. The conversion itself holds up. On two more UHD Blu-ray FEL rips (one CM v4.0, one CM v2.9), every RPU in the segments the server served matched dovi_tool -m 2 byte for byte (215 and 191 frames). The same held offline for 1,010 more frames. The served init.mp4 carries a Profile 8.1 dvvC with compatibility id 1, and the stream decodes cleanly.
I found four defects, listed inline. Each one has a test that fails on this head. I'm fixing all four in one commit on this branch, so there's no need to change them yourself. A fifth comment is a maintainer decision, which I'm not changing here.
The reason will be displayed to describe this comment to others. Learn more.
Maintainer decision: a mid-stream conversion failure may not move the client off this recipe.
The description says a segment that won't convert makes the client replan onto the strip. The local handler answers that failure with a generic 500, and a transcode node answers it with a 404. Neither tells the client that the recipe failed. For example, the web player treats a failed segment fetch as a network error. It recovers with track_change, which keeps eligibility, so it can pick the same 8.1 recipe again. Only failure recovery excludes the failed recipe. I traced this in the source but didn't run it in a browser.
One option is a distinct error, like the tone-map path's 422 with X-Silo-Tone-Map-Execution-Error, that invalidates the plan, with client handling to match. The other is to accept the gap for now, since a segment fails only on RPUs the converter can't parse, and none did on the three discs tested. I'm not changing this in this PR.
Reviewed head: 7ca457e0f (this branch's e394e6661 plus two review commits). The live checks below ran on 86b43a2a2. 7ca457e0f changes only the failure path, and a unit test covers it.
Fit: 7/10 · Readiness: 8/10 — conditional (assuming CI is green)
What I verified
Live, before and after. I ran two sandboxes: main (48a4b490) and this branch (e394e666, then 86b43a2a). On both, I started playback of single-track Profile 7 FEL UHD rips as an HLS-only client that takes Dolby Vision Profile 8 and no Profile 7.
main plans server_dv7_to_hdr10. The served stream is hvc1 with no DOVI record and no RPUs.
This branch plans server_dv7_to_dv81 with dolby_vision: true. The served init.mp4 is hvc1 with a Profile 8.1 dvvC (compatibility id 1, no EL). FFmpeg ran with filter_units=remove_types=63 and -strict unofficial.
Byte-level correctness. Two discs, at 10 and 50 minutes in. One is CM v4.0 and the other CM v2.9, and neither is the disc the description used. All 215 and 191 served RPUs match dovi_tool 2.3.4 -m 2 byte for byte on the same source frames. No enhancement-layer NALs remain, and each RPU has one filler NAL before it. The stream decodes with -xerror, and the server logged no dropped RPUs or conversion failures.
Offline. The opt-in corpus test passes on 1,010 frames from the same two discs.
Concurrency. Six simultaneous requests for an unfetched segment got identical, converted bytes.
Not exercised live. I didn't exercise an FFmpeg restart within a session, because an unproduced far-ahead segment returns 404 rather than restarting. No Dolby Vision display or Apple, Android or webOS client was in the loop, so the LG C4 result in the description remains the only on-screen evidence.
Addressed in this review
The first four are fixed in 86b43a2a2, and each has a test that failed on e394e6661. The fifth is fixed in 7ca457e0f.
A Profile 8.1-convertible RPU that keeps its length (one reusing the previous mapping) was dropped as filler.
Media-segment requests reopened init.mp4 read-write and could write it back over a file FFmpeg was rewriting after a restart. The session now keeps the track.
A segment where no RPU converted was still served under the 8.1 claim. It now fails closed.
Eligibility ignored the HLS delivery's own HDR details, which changed one terminal reason to a less accurate one.
Kody found this one: a segment that failed to convert was rewritten before it was rejected, so a retry served it with no Dolby Vision metadata. The file is now left unchanged unless the conversion succeeds. TestOpenSegmentDV81's retry case failed on 86b43a2a2.
Left for maintainers
Mid-stream failure recovery (maintainer decision). The description says a segment that fails to convert makes the client replan onto the strip. The server answers with a generic 500 locally and a 404 from a transcode node. The web player treats that as a network error and recovers with track_change, which can reselect the same recipe. There are two options:
Add a distinct error that invalidates the plan, like the tone-map 422 path.
Accept the gap for now, since none of the three discs tested produced a failure.
Apple and Safari players (disclosed in the description). This change can reach a client that advertises Profile 8 on HLS without the client-side conversion. The web player advertises it on Safari's native HLS, and some Android devices advertise it when their converter is unavailable or quarantined. Those clients used to get the HDR10 strip and now get hvc1 with dvvC, with no SUPPLEMENTAL-CODECS in the playlist. Whether AVPlayer switches into Dolby Vision for that is unverified. If it doesn't, the plan claims Dolby Vision while the screen shows HDR10.
jellycompat still maps every Profile 7 copy to the strip. The description says so, and I didn't change it.
Checks
Validated features: none of the passed v1.0 cases reach this code. Validation tasks: none is correct.
User manual: unaffected. The manual doesn't describe how Profile 7 is handled.
Apple and Android: no client change is required, because transformation names and dolby_vision_reason are free-form strings there. The Apple and Safari question above is the open client risk.
Tests that failed on the base: the four tests added in the review commit failed on e394e6661. The PR's own planner and converter tests call code the PR adds, so they don't build on main. The live before/after comparison is the proof for the feature itself.
Fit and readiness
Fit 7/10. Most UHD Blu-ray rips are Profile 7, and many TVs and boxes decode only 8.1. Serving them Dolby Vision instead of HDR10 improves core playback with no new setting and little CPU cost. Nothing is decoded, and each segment is rewritten once. What keeps the score below 9:
About 1,100 lines of bitstream code to maintain.
A new transformation in the playback contract.
Served files are now modified in place at read time.
Readiness 8/10. The approach holds and the claim is proven live and byte for byte. Two things remain open: the recovery decision above, and the unverified Apple and Safari behavior.
ConvertSegmentFile wrote its changes back before the session decided the
segment had failed, both for a parse error partway through and for a segment
in which no RPU converted. The failed RPUs were already filler on disk, so a
retry found nothing to convert and served the segment under the 8.1 claim with
no Dolby Vision metadata. It now decides first, returns ErrNoRPUConverted for
the no-RPU case, and writes nothing unless the conversion succeeds.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
api-v2API v2 / Huma migration program (epic #135); long-running, stacked by phaseenhancementNew feature or requestevidence-requiredNeeds before-and-after evidence before the Evidence check passesgoPull requests that update go codeimpact: playbackCan't play, stalls, or wrong mediaimpact: usabilityCore flow broken or severely blockedneeds-reviewNeeds maintainer review to resolve uncertain classification, scope, or changed evidence.priority: P2Limited scope, workaround exists, or polishsize/XXL1000–2999 added + deleted lines (all files); change volume, not priority.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Related issue: N/A
Validation tasks: none
Merge together with #3327. The clients that need this change are packaged smart-TV apps such as Moonfin for webOS, and those can't open Silo's v2 sockets until #3327 lands. The two PRs don't depend on each other in code.
Most UHD Blu-ray rips carry single-track Dolby Vision Profile 7. Many TVs and streaming boxes decode Profile 8.1 but not Profile 7. When such a client can't play the file directly, Silo serves it as an HLS copy remux, and today the only Profile 7 recipe there is
server_dv7_to_hdr10, which strips Dolby Vision. An LG C4 running Moonfin for webOS plays these titles as HDR10 even though it shows Profile 8.1 Dolby Vision.This change adds
server_dv7_to_dv81. It converts the Profile 7 metadata to Profile 8.1 inside the copy remux, so those clients get Dolby Vision. The planner tries it after native playback and the client-sideclient_dv7_to_dv81, and before the HDR10 strip. Nothing is decoded or re-encoded. A Profile 7 enhancement layer is dropped, as the strip already does, so a FEL disc loses the enhancement detail but keeps its Dolby Vision metadata.Approach
internal/playback/dovirpuports dovi_tool's mode 2 conversion (MIT, licence intestdata/). It sets the residual off, removes the NLQ data, resets a FEL's mapping to identity and writes the 8.1 DM coefficients. Fields after the CM v2.9 extension-block count are byte-aligned and copied verbatim.filter_units=remove_types=63), and-strict unofficialmakes it write the DOVI record.TranscodeSession.OpenSegmentrewrites each fMP4 file before it serves it. Native, Jellyfin-compatible and transcode-node serving all go through it.init.mp4: the Profile 7dvcCbecomes a Profile 8.1dvvCwith compatibility id 1.trunor box changes size.hvc1sample entry, because LG webOS showsdvh1MP4 as HDR10. The recipe is offered over fMP4 HLS only, with no MPEG-TS or progressive form.Validation
internal/playback/...,internal/api/handlers,internal/transcodenodeandinternal/streamtokenpass. Ininternal/jellycompat, the three Dolby Vision strip tests that also fail onmainwith this machine's FFmpeg build fail; nothing else does. The fullmake test-gosuite and DB-contract tests weren't run, and there's no schema change.scripts/lint-changed.shis clean, and the regenerated playback fixtures (one newdolby_vision_7_to_dv81scenario) are current.dovi_tool 2.3.4 -m 2byte for byte. dovi_tool ships no direct FEL → 8.1 pair. The corpus test is opt-in throughSILO_DOVI_CORPUS, and the disc data stays out of the repo.maind10d9c937with this branch and fix(api): let packaged TV apps open v2 sockets and read subtitle sidecars #3327's socket commit:server_dv7_to_dv81with a Dolby Vision claim.init.mp4ishvc1with a Profile 8.1 record.Evidence
Surface and build: LG C4, Moonfin for webOS 3.0.0. Before: upstream
maind10d9c937. After: the samemainwith this branch. Both carry #3327's socket commit.Evidence: https://evidence.siloserver.org/r/silo-server/pr-3447/
Risks
server_dv7_to_dv81and itsprofile7_rpu_converted_to_profile81claim are additive, and the schemas and web player don't reject unknown transformation names.hvc1withdvvC, and noCODECSorSUPPLEMENTAL-CODECSin Silo's playlist. If AVPlayer needs those to switch into Dolby Vision, those clients would see HDR10, which is what they get today.Checklist
AI Disclosure
/code-reviewat high effort over the whole branch diff found 9 candidates.trunparsing without a data offset or sample sizes.Note
Serve Dolby Vision Profile 7 as Profile 8.1 over HLS copy remux
server_dv7_to_dv81transformation so the playback planner can pick an HLS copy remux that converts Profile 7 sources to Profile 8.1 server-side instead of stripping to HDR10. Eligibility requires an HEVC Profile 7 source with RPU, enhancement-layer, and base-layer presence, Profile 8 client support, and thefilter_unitsbitstream filter in FFmpegDV7ToDV81BitstreamFilterrecipe (copy-video fMP4 only).OpenSegmentconverts init and media segments before serving; conversion is serialized per session and each segment converts at most once per generationOpenSegmentopens segment files read-write for these sessions and returns errors when conversion fails (ErrNoRPUConverted,ErrUnsupportedInit). An HLS delivery that rejects Dolby Vision gets the conversion-unsupported terminal when stripping is unavailableMacroscope summarized 7ca457e.