-
Notifications
You must be signed in to change notification settings - Fork 507
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: Generate the entire AV1 codec string when the colr atom is present #1205
feat: Generate the entire AV1 codec string when the colr atom is present #1205
Conversation
codec_string = av1_config.GetCodecString( | ||
entry.colr.color_primaries, entry.colr.transfer_characteristics, | ||
entry.colr.matrix_coefficients, | ||
entry.colr.video_full_range_flag); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think transfer_characteristics should be set to entry.colr.transfer_characteristics after this line.
It is used to create VideoStreamInfo on line 720 with which MediaInfo is created in HlsNotifyMuxerListener::OnMediaStart and MediaPlaylist::GetVideoRange() uses this MediaInfo to add the VIDEO-RANGE tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! :) I made the change and a few other improvements (like using FOURCC
vs string
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it makes sense to add an E2E test (https://github.com/shaka-project/shaka-packager/blob/main/packager/app/test/packager_test.py)?
colr->video_full_range_flag = 0; | ||
} | ||
|
||
void Modify(ColorParameters* colr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope! I'll remove it.
b5d5f74
to
31c590a
Compare
Rebased after strange issue with unrelated commits being pulled in. |
This PR is an extension of the full AV1 codec string feature: [PR 1205](#1205) and relates to [Issue 1007](#1007) and [Issue 1202](#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](#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**: - [AV1 Codec ISO Media File Format Binding](https://aomediacodec.github.io/av1-isobmff/#codecsparam) - [AV1 Bitstream & Decoding Process Specification - Section 6.4.2 Color config semantics (page 117)](https://aomediacodec.github.io/av1-spec/av1-spec.pdf) - [QuickTime File Format Specification](https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-125526)
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 and Issue 1202. This PR extracts the missing color information from the mp4
colr
atom, if present, and generates the full AV1 codec string. Writing the colr information to the muxed mp4 will come in a later PR.References:
Specification - Section 6.4.2 Color config semantics (page 117)
Testing
Manual: AV1 video WITH colr atom
Note: Presence of the colr atom in
hdr_av1_test.mp4
was verified withmp4dump
./out/Release/packager in=~/Downloads/bbbhdr_av1.mp4,stream=video,output=av1_with_colr.mp4 --mpd_output av1_with_colr.mpd
ffmpeg -i ~/Downloads/bbbhdr_av1.mp4 -c:v copy -an -seg_duration 2 -streaming 1 -utc_timing_url "https://time.akamai.com/?iso" -media_seg_name 'num_$Number%05d$.m4s' -init_seg_name 'num_init.m4s' -use_timeline 0 -f dash av1_with_colr.mpd
codecs="av01.1.01M.10.0.000.09.16.09.0"
:)Manual: AV1 video WITHOUT colr atom
Note: The lack of the colr atom in
av1-BBB.mp4
was verified withmp4dump
./out/Release/packager in=~/Downloads/av1-BBB.mp4,stream=video,output=av1_NO_colr.mp4 --mpd_output av1_NO_colr.mpd
ffmpeg -i ~/Downloads/av1-BBB.mp4 -c:v copy -an -seg_duration 2 -streaming 1 -utc_timing_url "https://time.akamai.com/?iso" -media_seg_name 'num_$Number%05d$.m4s' -init_seg_name 'num_init.m4s' -f dash av1_NO_colr.mp4
codecs="av01.0.08M.08"
:)Unittest
./out/Release/codecs_unittest
./out/Release/mp4_unittest
Format
git clang-format --style Chromium --binary /usr/bin/clang-format 80e024013df87a4bfeb265c8ea83cfa2a0c5db0f