I am currently seeing an error while trying to generate a manifest for pre-encrypted content (using mp4encrypt). This problem doesn't appear in 1.4.3 and was found while testing an upgrade to 1.5.0
$ mp4encrypt --method MPEG-CENC --key 1:[key]:[iv]--property 1:KID:[keyid] input/test-720p.mp4 encrypted/encrypted-test-720p.mp4
$ mp4encrypt --method MPEG-CENC --key 1:[key]:[iv]--property 1:KID:[keyid] input/test-480p.mp4 encrypted/encrypted-test-480p.mp4
$ mp4dash --output out --widevine --widevine-header=#[winevine pssh] --playready --playready-header=#[playready pssh] --verbose encrypted/encrypted-test-720p.mp4 encrypted/encrypted-test-480p.mp4
Profiles: urn:mpeg:dash:profile:isoff-live:2011
Parsing media file 1: encrypted/encrypted-test-720p.mp4
Parsing media file 2: encrypted/encrypted-test-480p.mp4
Audio: {}
Video: {('video', u'avc1'): [File 1#1, File 2#1]}
Subtitles: {}
video track: File 1#1 - language=en, max bitrate=2908824, avg bitrate=2452476, req bandwidth=1987157, codec=avc1.64001F
video track: File 2#1 - language=en, max bitrate=1571682, avg bitrate=1237498, req bandwidth=981488, codec=avc1.64001E
Processing and Copying media file encrypted/encrypted-test-720p.mp4
Processing and Copying media file encrypted/encrypted-test-480p.mp4
ERROR: Values instance has no attribute 'track_key_infos'
After taking a quick look at the mp4-dash.py source, it looks like track_key_infos is only generated when mp4dash is actually doing the encryption (via the --encryption-key argument). I think the fallback logic to use KID from the track(s) is in there it's just bombing on key_info = options.track_key_infos.get(tracks[0].id) before it can fallback to the track.kid.
I am happy to submit an pull request with a fix. I just wanted to get the communities take on best practice. I see two options:
Add a try/except to catch an AttributeError and in the catch set the default_kid to the kid on the track.
Add a hasattr on track_key_infos before trying to call get() on it.
Thanks for the bug report. This feature hasn't received the proper amount of testing, and as a result this bug went undetected. We will fix this promptly and push an update.
I am currently seeing an error while trying to generate a manifest for pre-encrypted content (using mp4encrypt). This problem doesn't appear in 1.4.3 and was found while testing an upgrade to 1.5.0
After taking a quick look at the
mp4-dash.py
source, it looks liketrack_key_infos
is only generated whenmp4dash
is actually doing the encryption (via the--encryption-key
argument). I think the fallback logic to use KID from the track(s) is in there it's just bombing onkey_info = options.track_key_infos.get(tracks[0].id)
before it can fallback to thetrack.kid
.I am happy to submit an pull request with a fix. I just wanted to get the communities take on best practice. I see two options:
AttributeError
and in the catch set thedefault_kid
to thekid
on the track.hasattr
ontrack_key_infos
before trying to callget()
on it.Thanks!