shaka-packager
shaka-packager copied to clipboard
Do not include PSSH boxes into media files by default, if they will be included into manifests as well
By default, when creating protected DASH content, Shaka Packager adds PSSH boxes both into media and manifest files. This can be reproduced using the following command:
packager \
'in=In/aac-lc-128k.m4a,stream=audio,output=Out/aac-lc-128k.mp4' \
'in=In/h264-360p-750k.mp4,stream=video,output=Out/h264-360p-750k.mp4' \
--protection_scheme cbcs --clear_lead 0 \
--enable_raw_key_encryption --protection_systems Widevine \
--keys 'label=:key_id=11111111111111111111111111111111:key=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' \
--segment_duration 2 --fragment_duration 2 \
--mpd_output Out/dash.mpd
Both DASH-IF IOP (4.3; the latest currently) and CMAF (1st edition; the latest currently) recommend to include PSSH boxes only into manifests.
For example, DASH-IF IOP, in the section 7.7.1, says:
'pssh' boxes SHOULD NOT be present in Initialization Segments
There is also an explanation why it's a bad idea to include PSSH boxes into media files. Other sub-sections of the section 7 may also provide additional information.
Another example - CMAF, in section 7.4.3, says:
CMAF streaming applications should signal license acquisition information in the manifest and should not duplicate the information in this box in CMAF headers.
The section 8 provides more info about this recommendation.
Of course, there is an option to explicitly tell to the packager to not include PSSH boxes into media files:
--mp4_include_pssh_in_stream=false
It works as expected, but the problem is that by default the packager tries to be compatible with DASH-IF IOP, which does not recommend such behavior. The packager does it, because of the following option:
--generate_dash_if_iop_compliant_mpd
Which by default is set to true
.
So, if generate_dash_if_iop_compliant_mpd
is set to true
, the mp4_include_pssh_in_stream
must be implicitly set to false
. In other words, DASH-IF IOP and CMAF compliant content must not contain PSSH boxes in media files, if these PSSH boxes will be added to manifests.
I'm using Shaka Packager c257113-release on Ubuntu 18.04.3 inside a Docker container (google/shaka-packager, b5ec0eef40bc).
@vladimir-kazakov Thanks for the reminder. We do plan to enable the flag 'mp4_include_pssh_in_stream' by default at some time. I'll add it to the next milestone so we don't forget about it.
Move it to v2.5 milestone, but will do it in v2.4.1 minor release.