Monday, 11 January 2021

MediaCrypto encrypt video files using HLS/DASH AES h.264 Android

I am trying to encode+encrypt video files at the same time in a way that can be streamed (HLS/DASH) from a NAS/cloud. The videos encryption+encoding is done on android device and the result file will be uploaded to cloud. The playback is done on other devices running Windows. No DRM needed, AES would be fine.

I have tried this code but doesn't not encrypt the video file

MediaCrypto crypto = null;
UUID CLEARKEY_SCHEME_UUID = new UUID(0x1077efecc0b24d02L, 0xace33c1e52e2fb4bL);
MediaDrm drm = new MediaDrm(CLEARKEY_SCHEME_UUID);
byte[] sessionId = drm.openSession();
crypto = new MediaCrypto(CLEARKEY_SCHEME_UUID, new byte[0]);
crypto.setMediaDrmSession(sessionId);

mEncoder.configure(format, null, crypto, MediaCodec.CONFIGURE_FLAG_ENCODE);

I have tried also this library https://github.com/zolad/VideoSlimmer but it does not have the encryption part

How do I convert + encrypt(AES encryption) video files using MediaCodec in Android in the way that can be streamed and played by ExoPlayer?



from MediaCrypto encrypt video files using HLS/DASH AES h.264 Android

No comments:

Post a Comment