Repository navigation
mp4-mux: Add HLG-compatible HDR signaling to MP4 recordings (experimental, incomplete) - #742
chriscoveries wants to merge 3 commits into
Conversation
Add an optional encoder codec-metadata callback and an opt-in mux flag that writes a native Dolby Vision dvvC record beside hvcC. Cover the box framing and verbatim payload with a cmocka test. DRAFT: No encoder, including mac-videotoolbox, implements the callback yet, so enabling write_dolby_vision cannot currently emit a dvvC box.
Rename the experimental muxer option to write_hlg_compatible_hdr_config and the flag to MP4_WRITE_HLG_COMPATIBLE_HDR_CONFIG, and describe the box by what it is compatible with. No behaviour change.
mp4-mux.c needs rtmp-av1.c/rtmp-hevc.c (obs_parse_*) and an obs_module_text stub; the Tier 2 link failed without them.
|
Maintainer rebase onto master, replacing head
Locally, |
536432b to
72c48c4
Compare
|
Review from the maintainer side. I read the body, the comments and the diff (head What I checked. Gaps.
Why this one needs a maintainer decision (c). Two questions are not mine to answer here, so I am leaving it as a draft and taking them to the repo owner:
I'll post the answer here once there is one. No change is needed from you until then. |
|
Coordinator check-in, @chriscoveries: there's been no activity here since the maintainer's review about 9 days ago. Are you still working on this? If you've moved on, say "handed off to the coordinator" and I'll keep the mechanical work (rebases, list conflicts, formatting) moving. Anything in the review that needs a design change stays with you. |
|
Status from the coordinator, @chriscoveries — this draft is now
Two other things, since the head here is
I am not taking the code fix over while it is a design-in-progress; the rebase is the only part that is mine to do. |
|
handed off to the coordinator. Sorry for going quiet; life has gotten in the way of keeping up with these. I'm not going to finish the HLG signalling design, so please report it to the maintainer as you offered. The rebase is yours if it's still wanted. |
|
Rebase status (coordinator pass, 2026-12-04), for whoever picks this up after the hand-off: a test merge onto current master conflicts in two places.
This PR also changes the public headers |
Problem
On a Mac, VideoToolbox can encode HEVC profile 8.4: a 10-bit HLG HDR picture (BT.2020) with dynamic HDR metadata in the bitstream. That's the same format an iPhone records. VideoToolbox also hands back a native 24-byte configuration record for it. The MP4 muxer only writes
hvcC, so that record never reaches the file. Players that understand the profile then treat the recording as plain HEVC/HLG and ignore the dynamic metadata.Fix (this PR)
obs_encoder_info.get_codec_metadatacallback and anobs_encoder_get_codec_metadata()accessor. The encoder's native record is passed through as an opaque blob. It's kept separate from the Annex-B data inget_extra_data, and it's never synthesized.mp4-muxwrites the record verbatim as advvCbox besidehvcC. This sits behind the experimentalwrite_hlg_compatible_hdr_configmuxer option. Without the option, or without a record, nothing changes.obs_encoder_info, after upstream'srequest_keyframe, so it's ABI-safe:obs_register_encoder_scopies only the caller's struct size.dvvCtype, and a byte-for-byte payload. It's registered throughtests.d.The base picture stays standard HLG. A player that only knows HLG still shows it as HLG HDR. The box only lets players that understand the profile also use the dynamic metadata.
Evidence
Here is real
ffprobeoutput for the box emitted by this C function, grafted into thehvc1sample entry of a minimal HEVC MP4, next to the same file without it. TheDOVIwording is ffprobe's own label for this record.The box extracted back out of the grafted file is byte-identical to the one the function emitted. Without the graft,
ffprobereports no configuration record.Not done (why this is a draft)
get_codec_metadatayet.plugins/mac-videotoolbox/encoder.cdoesn't fill it in, so a real OBS recording won't carry the box yet. The next step is reading the record from the encoder's format description.Compatibility & risk
EXPORTinobs.h, like the neighbouringobs_encoder_get_extra_data, so the Rust export lists don't change.Thank you to the obs-rust maintainers and contributors for building this project in the open. In the American spirit of free expression and individual independence, and with the principle of judging contributions on their merit alone, this PR is a small piece of what independent people can build when they come together.