Repository navigation
fix(build): the mpegts muxer writes the Dolby Vision descriptors - #11
Conversation
FFmpeg reads the DOVI video stream descriptor (0xb0) of a transport stream into AV_PKT_DATA_DOVI_CONF, but its mpegts muxer never writes it. A Dolby Vision stream copied into MPEG-TS, which is what AetherEngine live recordings are, kept every RPU and lost its record, and played back as HDR10 (Profile 8.1), HLG (8.4) or HDR10 with the wrong colours (5). patch_ffmpeg_mpegts_dovi_descriptor applies patches/mpegts-dovi-descriptor.patch: a video stream whose record declares a base layer gets the DOVI registration descriptor and the 0xb0 descriptor built from the record. MPEGTSDolbyVisionDescriptorTests round-trips records through the muxer and the demuxer.
|
Thanks a lot, this is a really clean one. I checked the descriptor against what On top I rebuilt every slice with the patch (8912e78). All 50 tests pass, the new suite included. I also took it upstream as https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26097, with you credited in the commit message and the PR text. Master's muxer has moved a bit since n8.1.3, so the patch is rebased there and comes with two FATE tests on the existing The next FFmpegBuild release will carry this. Once it's out, feel free to open your |
…onfiguration record Refs superuser404notfound/FFmpegBuild#11
…ix the NAL comment Follow-up to PR #1096 from Quint's review: the record attach no longer drops its result (a failure would have leaked the record and failed later on a nil profile), the codecpar goes through avcodec_parameters_free so its side data is released, and the NAL header comment describes the one byte annexBPayload writes. Refs superuser404notfound/FFmpegBuild#11 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SeT6NgMt1vv32kPBhUmsUz
Summary
A Dolby Vision live channel recorded with AetherEngine's
startRecording(to:)plays back without Dolby Vision. Checked on AetherEngine main (95ee3ce, after 7.68.0) and on 7.53.1: Profile 8.1 plays back as HDR10, Profile 8.4 as HLG, Profile 5 as HDR10 with the wrong colours.Cause: the recording is a stream copy into MPEG-TS, and FFmpeg's mpegts muxer never writes the Dolby Vision descriptors. The demuxer reads the DOVI video stream descriptor (
0xb0) intoAV_PKT_DATA_DOVI_CONF, andavcodec_parameters_copycarries that record to the output stream, butmpegtsenc.chas no code for it (n8.1.3, n9.0.2 and master alike). The file keeps every RPU and loses the record, and the engine routes Dolby Vision from that record.What changed
patches/mpegts-dovi-descriptor.patch, applied bypatch_ffmpeg_mpegts_dovi_descriptor: for a video stream whose record declares a base layer, the PMT gets theDOVIregistration descriptor and the0xb0descriptor built from the record (version, profile, level, the present flags, base-layer compatibility id, metadata compression; the two reserved bits set). This is the layout the demuxer already parses.MPEGTSDolbyVisionDescriptorTests: muxes HEVC with a record through the shipped mpegts muxer and opens the file the way a player does. Records 8.1, 8.4, 8.2, 5, single-PID 7 and one with metadata compression come back unchanged, with theDOVIregistration in the PMT. No record, and an enhancement layer without its base layer, get no descriptor.This PR carries only the source changes; the xcframeworks need a rebuild on your side. Not proposed to FFmpeg upstream yet.
Test plan
./build.shreduced to themacos-arm64slice (my Xcode 27 has no Metal toolchain, so that local build had--disable-metaland noyadif_videotoolbox). Only the rebuiltAetherLibavformatwas put in place of the 3.15.0 one, so before and after differ in libavformat alone.swift teston 3.15.0: the new suite fails (no record read back, noDOVIregistration). With the patched libavformat: all 50 tests in 17 suites pass.startRecording(to:), then plays the file:hdr10, servedhvc1dolbyVision, servedhvc1+dvh1.08.06/db1phlg, servedhvc1dolbyVision, servedhvc1+dvh1.08.06/db4hhdr10(IPT read as YCbCr), servedhvc1dolbyVision, serveddvh1.05.06In every case the recording now takes the same route as the live channel. Every access unit of every recording carries its RPU, before and after.
fix/recording-keeps-dolby-vision): aLiveRecordingWriterTestscase that records Profile 8.1, 8.4 and 5 and reads the record back throughAetherEngine.dvConfig(stream:). It fails on 3.15.0 and passes with this build. I can open it together with the pin bump once a release carries this, or you can take it with the bump.Checklist
build.shand in the README list