Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Write colr atom to muxed mp4 #1261

Merged
merged 1 commit into from Aug 30, 2023

Conversation

CaitlinOCallaghan
Copy link
Contributor

@CaitlinOCallaghan CaitlinOCallaghan commented Aug 29, 2023

This PR is an extension of the full AV1 codec string feature: PR 1205 and relates to Issue 1007 and Issue 1202.

As per the AV1 spec, the codec string may contain optional color values. These color values are critical for detecting HDR video streams - see Issue 1007. Color information is extracted from the input mp4's colr atom and used to generate the full AV1 codec string. This PR preserves the color information by writing the colr atom to the muxed mp4.

References:

Testing

Manual: AV1 video WITH colr atom

Note: Presence of the colr atom in bbbhdr_av1.mp4 was verified with a hex editor.
image

  1. Generate Packager MPD with: ./out/Release/packager in=~/Downloads/bbbhdr_av1.mp4,stream=video,output=av1_with_colr.mp4 --mpd_output av1_with_colr.mpd
  2. Check manifest generated by Shaka Packager for Representation codecs string:
<?xml version="1.0" encoding="UTF-8"?>
<!--Generated with https://github.com/shaka-project/shaka-packager version 31129ee-release-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" minBufferTime="PT2S" type="static" mediaPresentationDuration="PT1.100000023841858S">
  <Period id="0">
    <AdaptationSet id="0" contentType="video" width="640" height="360" frameRate="15360/512" subsegmentAlignment="true" par="16:9">
      <Representation id="0" bandwidth="778146" codecs="av01.1.01M.10.0.000.09.16.09.0" mimeType="video/mp4" sar="1:1">
        <BaseURL>av1_with_colr.mp4</BaseURL>
        <SegmentBase indexRange="808-851" timescale="15360">
          <Initialization range="0-807"/>
        </SegmentBase>
      </Representation>
    </AdaptationSet>
  </Period>
</MPD>
  1. Check av1_with_colr.mp4 bitstream for the colr atom and cross reference the values of the atom's properties with the codec representation string found in the manifest:
    image

Format

git clang-format --style Chromium --binary /usr/bin/clang-format 80e024013df87a4bfeb265c8ea83cfa2a0c5db0f

BEGIN_COMMIT_OVERRIDE
feat: Write colr atom to muxed mp4 (#1261)
Closes #1202
END_COMMIT_OVERRIDE

@cosmin
Copy link
Collaborator

cosmin commented Aug 30, 2023

This approach seems much cleaner to me compared to the previous attempt at re-creating the colr box from the codec string.

@joeyparrish joeyparrish changed the title feat: Write colr atom to muxed mp4 | Iteration 2 feat: Write colr atom to muxed mp4 Aug 30, 2023
@joeyparrish joeyparrish merged commit f264bef into shaka-project:main Aug 30, 2023
13 of 22 checks passed
@github-actions github-actions bot added the status: archived Archived and locked; will not be updated label Oct 29, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AV1 encoding missing color metadata
3 participants