From 520926c27ad0d183127e4548c4564af33a2ad2f3 Mon Sep 17 00:00:00 2001 From: sr90 Date: Tue, 18 Jul 2023 19:50:33 -0700 Subject: [PATCH] fix(MP4): Add compatible brand dby1 for Dolby content. (#1211) This PR adds dby1 compatible brand to dolby content as per https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolby_vision_bitstreams_within_the_iso_base_media_file_format_dec2017.pdf --- .../output.mpd | 4 ++-- .../sparks_dovi_5-video.mp4 | Bin 592627 -> 592631 bytes .../stream_0.m3u8 | 4 ++-- .../output.mpd | 8 ++++---- .../sparks_dovi_8-video.mp4 | Bin 570083 -> 570087 bytes .../stream_0.m3u8 | 4 ++-- packager/media/base/fourccs.h | 1 + packager/media/formats/mp4/mp4_muxer.cc | 4 ++++ 8 files changed, 15 insertions(+), 10 deletions(-) diff --git a/packager/app/test/testdata/dolby-vision-profile-5-with-encryption/output.mpd b/packager/app/test/testdata/dolby-vision-profile-5-with-encryption/output.mpd index ff9e4854aa..b81c94aa08 100644 --- a/packager/app/test/testdata/dolby-vision-profile-5-with-encryption/output.mpd +++ b/packager/app/test/testdata/dolby-vision-profile-5-with-encryption/output.mpd @@ -9,8 +9,8 @@ sparks_dovi_5-video.mp4 - - + + diff --git a/packager/app/test/testdata/dolby-vision-profile-5-with-encryption/sparks_dovi_5-video.mp4 b/packager/app/test/testdata/dolby-vision-profile-5-with-encryption/sparks_dovi_5-video.mp4 index e9cec02667565cf6d72fd6647b3a5727f55895f0..2ffeb27d457480df28394f413e3d27c88ee601f6 100644 GIT binary patch delta 49 zcmex7Rpt9s6&3~t2Azp43d|`-- #EXT-X-TARGETDURATION:3 #EXT-X-PLAYLIST-TYPE:VOD -#EXT-X-MAP:URI="sparks_dovi_5-video.mp4",BYTERANGE="1366@0" +#EXT-X-MAP:URI="sparks_dovi_5-video.mp4",BYTERANGE="1370@0" #EXT-X-KEY:METHOD=SAMPLE-AES-CTR,URI="data:text/plain;base64,MTIzNDU2Nzg5MDEyMzQ1Ng==",KEYFORMAT="identity" #EXTINF:2.002, -#EXT-X-BYTERANGE:185521@1446 +#EXT-X-BYTERANGE:185521@1450 sparks_dovi_5-video.mp4 #EXTINF:2.002, #EXT-X-BYTERANGE:197565 diff --git a/packager/app/test/testdata/dolby-vision-profile-8-with-encryption/output.mpd b/packager/app/test/testdata/dolby-vision-profile-8-with-encryption/output.mpd index 9f3adeabd8..0950e11dcd 100644 --- a/packager/app/test/testdata/dolby-vision-profile-8-with-encryption/output.mpd +++ b/packager/app/test/testdata/dolby-vision-profile-8-with-encryption/output.mpd @@ -9,8 +9,8 @@ sparks_dovi_8-video.mp4 - - + + @@ -21,8 +21,8 @@ sparks_dovi_8-video.mp4 - - + + diff --git a/packager/app/test/testdata/dolby-vision-profile-8-with-encryption/sparks_dovi_8-video.mp4 b/packager/app/test/testdata/dolby-vision-profile-8-with-encryption/sparks_dovi_8-video.mp4 index f1cf2372be0599a5c27ae98adb21c26a39bddb29..aaec54a4a8ea78f4e8277158f6d4681b435a12a1 100644 GIT binary patch delta 46 zcmaF-RO$IsB^Cw-2Azp43d|`g diff --git a/packager/app/test/testdata/dolby-vision-profile-8-with-encryption/stream_0.m3u8 b/packager/app/test/testdata/dolby-vision-profile-8-with-encryption/stream_0.m3u8 index 7adec71977..14e6dc18cd 100644 --- a/packager/app/test/testdata/dolby-vision-profile-8-with-encryption/stream_0.m3u8 +++ b/packager/app/test/testdata/dolby-vision-profile-8-with-encryption/stream_0.m3u8 @@ -3,10 +3,10 @@ ## Generated with https://github.com/shaka-project/shaka-packager version -- #EXT-X-TARGETDURATION:3 #EXT-X-PLAYLIST-TYPE:VOD -#EXT-X-MAP:URI="sparks_dovi_8-video.mp4",BYTERANGE="1366@0" +#EXT-X-MAP:URI="sparks_dovi_8-video.mp4",BYTERANGE="1370@0" #EXT-X-KEY:METHOD=SAMPLE-AES-CTR,URI="data:text/plain;base64,MTIzNDU2Nzg5MDEyMzQ1Ng==",KEYFORMAT="identity" #EXTINF:2.002, -#EXT-X-BYTERANGE:172013@1446 +#EXT-X-BYTERANGE:172013@1450 sparks_dovi_8-video.mp4 #EXTINF:2.002, #EXT-X-BYTERANGE:189474 diff --git a/packager/media/base/fourccs.h b/packager/media/base/fourccs.h index 8be50c1b6b..12884a6db7 100644 --- a/packager/media/base/fourccs.h +++ b/packager/media/base/fourccs.h @@ -44,6 +44,7 @@ enum FourCC : uint32_t { FOURCC_dac3 = 0x64616333, FOURCC_dac4 = 0x64616334, FOURCC_dash = 0x64617368, + FOURCC_dby1 = 0x64627931, FOURCC_ddts = 0x64647473, FOURCC_dec3 = 0x64656333, FOURCC_dfLa = 0x64664c61, diff --git a/packager/media/formats/mp4/mp4_muxer.cc b/packager/media/formats/mp4/mp4_muxer.cc index 3c542bd93f..27f926d8ca 100644 --- a/packager/media/formats/mp4/mp4_muxer.cc +++ b/packager/media/formats/mp4/mp4_muxer.cc @@ -227,6 +227,10 @@ Status MP4Muxer::DelayInitializeMuxer() { ->h26x_stream_format()); if (codec_fourcc != FOURCC_NULL) ftyp->compatible_brands.push_back(codec_fourcc); + + // https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolby_vision_bitstreams_within_the_iso_base_media_file_format_dec2017.pdf + if (streams()[0].get()->codec_string().find("dvh") != std::string::npos) + ftyp->compatible_brands.push_back(FOURCC_dby1); } // CMAF allows only one track/stream per file.