Repository navigation
Conversation
Clients such as FFmpeg only write container extradata (avcC/hvcC) when the driver accepts VA_ENC_PACKED_HEADER_SEQUENCE; with VA_ENC_PACKED_HEADER_NONE they refuse to produce a global header, so muxing freshly encoded HEVC into Matroska fails at write_header. Advertise the sequence bit and accept the packed header buffers without splicing their payload into the coded stream: the stateful encoder already emits equivalent sequence headers in-band. Fixes radxa-pkg#6. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
vitlav
marked this pull request as ready for review
September 23, 2026 09:15
Contributor
This causes the latest version of FFmpeg, when using The out-of-band PS written by FFmpeg is inconsistent with the actual in-band PS, and the in-band PS is removed when See also https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15529 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #6: muxing freshly encoded HEVC into Matroska fails because the backend reports
VA_ENC_PACKED_HEADER_NONE, and FFmpeg then explicitly refuses to write a global header ("No global header will be written: … not muxable to some containers",vaapi_encode.c). Matroska requires hvcC extradata atwrite_headertime, sohevc_vaapi→.mkvaborts. H.264 → MP4 only works by accident: the MP4 muxer extracts the in-band SPS/PPS from the first packet, which Matroska does not do for HEVC.Changes
VA_ENC_PACKED_HEADER_SEQUENCEforVAConfigAttribEncPackedHeaders, so clients generate their own sequence headers and build container extradata from them;VAEncPackedHeaderParameterBufferType/VAEncPackedHeaderDataBufferTypein buffer creation and encode rendering, discarding the payload — the stateful encoder already emits equivalent sequence headers in-band, and nothing can be spliced into its coded stream.Note
The container extradata is client-generated (FFmpeg's own VPS/SPS/PPS), so it may not be byte-identical to the firmware's in-band headers; decoders pick up the in-band parameter sets.
Validation
Validated on Qualcomm SC7180 (TCL B220G,
qcom-venus, together with #5): directhevc_vaapi→ Matroska muxing now succeeds without theextract_extradataremux workaround.