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

MP4Dash - HLS encrypted CBCS errors with Dolby Vision mp4 source #898

Closed
riba101 opened this issue Oct 16, 2023 · 4 comments
Closed

MP4Dash - HLS encrypted CBCS errors with Dolby Vision mp4 source #898

riba101 opened this issue Oct 16, 2023 · 4 comments

Comments

@riba101
Copy link
Contributor

riba101 commented Oct 16, 2023

Hi there,

I'm running into an issue when I create an fairplay encrypted hls stream (CBCS) with mp4dash when I include a Dolby Vision file that was created on AWS MediaConvert. I also create a Dash stream with Widevine and Playready with the same source files and the stream is encrypted (CENC) and packaged correctly.

The error that occurs is
ERROR: failed to process the file (-10)
ERROR: float division by zero

@riba101
Copy link
Contributor Author

riba101 commented Nov 13, 2023

Update: Testing with files generated by the Dolby Encoding Engine also failed to package with CBCS enabled.

In the meantime I found out that the it fails here.

line 711, in OutputHlsCommon
hls_target_duration = math.ceil(max(track.segment_durations))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: max() arg is an empty sequence

And looking in the debug log I found that the file with Dolby Vision has the following data
Track ID = 1
Segment Count = 0
Type = video
Sample Count = 0
Average segment bitrate = 0
Max segment bitrate = 0
Required bandwidth = 0
Average segment duration = 0

And a normal hvc1 file in the same package job shows the following
Track ID = 1
Segment Count = 51
Type = video
Sample Count = 2405
Average segment bitrate = 6161417
Max segment bitrate = 9638320
Required bandwidth = 7129402
Average segment duration = 1.9200000000000015

@riba101
Copy link
Contributor Author

riba101 commented Nov 15, 2023

Found the issue.

I had to add the following code to Source/C++/Core/Ap4CommonEncryption.cpp at line 293 (the AP4_CencCbcsSubSampleEncrypter::AP4_CencCbcsSubSampleEncrypter block)

if (!hvcc)    hvcc = AP4_DYNAMIC_CAST(AP4_HvccAtom, stsd->FindChild("dvhe/hvcC"));
if (!hvcc)    hvcc = AP4_DYNAMIC_CAST(AP4_HvccAtom, stsd->FindChild("dvh1/hvcC"));

I will create a PR for this

@barbibulle
Copy link
Contributor

Thanks for finding this out!

@riba101
Copy link
Contributor Author

riba101 commented Nov 19, 2023

Merged in PR #902

@riba101 riba101 closed this as completed Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants