Skip to content

webmmux: Add support for writing encrypted tracks

David Craven requested to merge dvc94ch/gstreamer:webmmux-enc into main

First time writing anything in C, I hope it's not too bad.

To test this the shaka packager can be used to create encrypted files with the following command (with and without a clear lead):

packager in=video.webm,stream=video,output=video.drm.webm,drm_label=key --enable_raw_key_encryption --keys label=key:key_id=00000000111111112222222233333333:key=aaaaaaaabbbbbbbbccccccccdddddddd --protection_systems Widevine --mpd_output video.mpd --clear_lead 0

When encrypting vp9 or av1 it will use subsample encryption. So with a vp9+opus file you can test unencrypted/encrypted/subsample-encrypted.

To actually run it on the encrypted file you can use gst-launch to round trip it:

gst-launch-1.0 filesrc location=$1 ! matroskademux ! webmmux ! matroskademux ! webmdec key=$2 ! opusdec ! audioconvert ! audioresample ! autoaudiosink

and the equivalent for testing subsample encrypted video would be:

gst-launch-1.0 filesrc location=$1 ! matroskademux ! webmmux ! matroskademux ! webmdec key=$2 ! vp9dec ! videoconvert ! videoscale ! autovideosink

The webmdec plugin is written in rust and not published anywhere yet.

Closes #2789

Edited by David Craven

Merge request reports