Skip to content

Fix inserted SEI NAL order in AVC outputs#13645

Open
dsaedtler wants to merge 3 commits into
obsproject:masterfrom
amazon-contributing:rodney/fix-sei-nal-order
Open

Fix inserted SEI NAL order in AVC outputs#13645
dsaedtler wants to merge 3 commits into
obsproject:masterfrom
amazon-contributing:rodney/fix-sei-nal-order

Conversation

@dsaedtler

@dsaedtler dsaedtler commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes the position where SEI NALs are inserted into AVC bitstreams.

Motivation and Context

H.264 specification section 7.4.1.2.3 "Order of NAL units and coded pictures and association to access units" clarifies that SEI NALs shall come before any VCL NALs:

  • When any SEI NAL units are present, they shall precede the primary coded picture

Apparently the current method (just appending the SEIs) can cause issues with Android playback in some cases.

This is analogous to #12658 which addressed a similar issue for HEVC. AVC does not have a "suffix" SEI type, so we actually need to insert them at the correct position.

How Has This Been Tested?

Recorded some videos locally (Hybrid MP4 supports the bpm=1 option to manually enable BPM insertion for testing) and verified with a bitstream analyzer (StreamEye) that SEIs are now inserted at the correct position in the output bitstream.

My coworker who was working on diagnosing the issue on her Android phone has also confirmed that with this PR applied the issue is fixed.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have read the contributing document.
  • My code has been run through clang-format.
  • My code follows the project's style guidelines
  • My code is not on the master branch.
  • My code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@notr1ch notr1ch added kind/bug Categorizes issue or PR as related to a bug. Seeking Testers Build artifacts on CI labels Jul 13, 2026
@dsaedtler dsaedtler force-pushed the rodney/fix-sei-nal-order branch from b9a2c81 to bdfb4b1 Compare July 13, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug. Seeking Testers Build artifacts on CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants