Open unext-wendong opened 4 years ago
Tried the following minor change and it seems to be working now.
diff --git a/Source/C++/Core/Ap4CommonEncryption.cpp b/Source/C++/Core/Ap4CommonEncryption.cpp
index 73d8449..0f8389c 100644
--- a/Source/C++/Core/Ap4CommonEncryption.cpp
+++ b/Source/C++/Core/Ap4CommonEncryption.cpp
@@ -1629,13 +1629,17 @@ AP4_CencEncryptingProcessor::CreateTrackHandler(AP4_TrakAtom* trak)
if (format == AP4_ATOM_TYPE_AVC1 ||
format == AP4_ATOM_TYPE_AVC2 ||
format == AP4_ATOM_TYPE_AVC3 ||
- format == AP4_ATOM_TYPE_AVC4) {
+ format == AP4_ATOM_TYPE_AVC4 ||
+ format == AP4_ATOM_TYPE_DVAV ||
+ format == AP4_ATOM_TYPE_DVA1) {
AP4_AvccAtom* avcc = AP4_DYNAMIC_CAST(AP4_AvccAtom, entries[0]->GetChild(AP4_ATOM_TYPE_AVCC));
if (avcc) {
nalu_length_size = avcc->GetNaluLengthSize();
}
} else if (format == AP4_ATOM_TYPE_HEV1 ||
- format == AP4_ATOM_TYPE_HVC1) {
+ format == AP4_ATOM_TYPE_HVC1 ||
+ format == AP4_ATOM_TYPE_DVHE ||
+ format == AP4_ATOM_TYPE_DVH1) {
AP4_HvccAtom* hvcc = AP4_DYNAMIC_CAST(AP4_HvccAtom, entries[0]->GetChild(AP4_ATOM_TYPE_HVCC));
if (hvcc) {
nalu_length_size = hvcc->GetNaluLengthSize();
Feels like it was a coding miss. If that's the case, can we get this merged and included in the next release?
Thanks for pointing that out. This was missing. I will push an update to the code to fully support encrypted Dolby Vision tracks.
Wanted to confirm if
Bento4
is able to repackage a mp4 file with Dolby Vision track to the DASH format with CENC encryption.Didn't find it from the document, but by searching in the source code, it seems Dolby Vision is already supported.
Tried using
mp4fragment
andmp4-dash.py
to repackage a Dolby Vision mp4 file into DASH format, and it seemed to be working fine (the codec of the Dolby Vision track used is in form ofdvhe.xx.xx
).However after enabling the CENC encryption, the created DASH stream became un-playable. By checking the generated video segment, it appears that
Full Sample Encryption
was used instead ofSubsample Encryption
for the video track. And this is aligned with the current implementation: https://github.com/axiomatic-systems/Bento4/blob/v1.5.1-628/Source/C++/Core/Ap4CommonEncryption.cpp#L1629I guess the full support of Dolby Vision is not ready yet, at least the CENC encryption is not enabled for it.
Please kindly clarify if any understanding here is wrong. If not, is there a plan to add the CENC support for Dolby Vision.