mirror of
https://github.com/shaka-project/shaka-packager.git
synced 2026-04-05 04:41:01 +00:00
Some checks failed
Update Issues / update-issues (push) Has been cancelled
Release / Settings (push) Has been cancelled
Release / release (push) Has been cancelled
Release / Compute latest release flag (push) Has been cancelled
Release / Update docs (push) Has been cancelled
Release / Update docker image (push) Has been cancelled
Release / Build (push) Has been cancelled
Release / Artifacts (push) Has been cancelled
Release / Update NPM (push) Has been cancelled
**Description** This PR introduces support for subsample encryption for Dolby AC-4 audio streams including muxing and packaging in Shaka Pakager. **Motivation** Subsample encryption is a mode of Common Encryption (CENC) that allows selective encryption of media samples, leaving specific portions (such as headers) in the clear. In most cases, subsample encryption is applied to video streams (e.g., H.265/HEVC or AV1). It can also be used for audio streams, even though many pipelines default to full-sample encryption for audio. For Dolby AC-4, this is particularly useful because the AC-4 frame header (ac4_toc) contains configuration data that must remain accessible to parsers and playback systems even when the rest of the frame is encrypted. By implementing subsample encryption for AC-4: - Parsers can validate and process encrypted streams without full decryption. - Playback systems can perform certain bitstream operations (e.g., stream identification, sync validation) efficiently. - This aligns with best practices for encrypted media delivery and improves performance with streaming platforms. **Implementation Details** - The implementation ensures that the ac4_toc() portion of each AC-4 frame remains unencrypted. - The remaining payload is encrypted using the selected CENC protection scheme (e.g., cbcs or cenc). **Specification Reference** This feature is not mentioned in any published specification. However, it is discussed in detail in the specification, which has not yet been publicly released but is expected to be published in the near future. Once available, it will provide formal guidance on subsample encryption for AC-4, including the handling of the ac4_toc() structure and encryption boundaries. **Notes** - This implementation is compatible with the upcoming public release of the AC-4 ISOBMFF specification. - The feature has been tested on encryption/decryption, DASH, HLS, and DRM. The generated content is conforms to expected encryption behavior. - Additional documentation will be provided once the specification is officially published. --------- Co-authored-by: Xingzhao Yun <xyun@dolby.com>