0

I want to process wav files so I can use them in the browser with MSE and EME.

I am able to convert to .mp4 and play with MSE, but when I encrypt the file the player doesn't work. No error is triggered, the encrypted event in EME never fires. So keys are never asked to be confirmed.

What can I me doing wrong? How should I convert/encrypt the file?

My pipeline of command right now:

ffmpeg -i long_input_44100.wav -ar 48000 -ac 2 output/long_input_44100_000.wav 
ffmpeg -i output/long_input_44100_000.wav -strict experimental output/long_input_44100_000.mp4 
MP4Box -dash 10000 -frag 10000 -rap output/long_input_44100_000.mp4 
ffmpeg -y 
    -i output/long_input_44100_000.mp4 
    -encryption_scheme cenc-aes-ctr 
    -encryption_key 76a6c65c5ea762046bd749a2e632ccbb 
    -encryption_kid a7e61c373e219033c21091fa607bf3b8 
    -frag_duration 10000 
    output/long_input_44100_000_encrypted.mp4
Rikard
  • 7,485
  • 11
  • 55
  • 92
  • The first two commands can be combined: `ffmpeg -i long_input_44100.wav -ar 48000 -ac 2 output/long_input_44100_000.mp4`. Also, no need for `-strict experimental`. – llogan Aug 05 '20 at 19:05

1 Answers1

0

You have to add a Digital Rights Management (DRM) system to your package to share the secret key with your player. The DRM systems tell your player how to retrieve the key. GPAC has software that adds DRM systems and does encryption. See https://github.com/gpac/gpac/wiki/Common-Encryption. There a bunch of different DRM systems out the there. You could start with Microsoft's Playready: https://testweb.playready.microsoft.com/ and this article gives a nice overview https://go.buydrm.com/thedrmblog/securing-ott-content-drm. ClearKey DRM is another option that enables you to build your own key exchange infrastructure. But ClearKey DRM is less secure since the key exchange is not secured.

Markus Schumann
  • 7,636
  • 1
  • 21
  • 27
  • Thanks for checking this out. There is something wrong since the files don't trigger the browsers `encrypted` event (which is were the browser first asks for the keys). So thanks for the links but the problem is before the browser consumes the keys. – Rikard Aug 05 '20 at 20:49
  • Thanks for the update but that actually doesn't adress the problem. I am using _ClearKey_ and that is implemented in browsers nowadays. Any ideas about the problem I asked and how to use ffmpeg to generate valid encrypted files? – Rikard Aug 06 '20 at 14:55
  • Do you mind sharing you encrypted file so I can check the PSSH box? Are you using https? Do you set the keys in your player through JavaScript? What browser are you using? – Markus Schumann Aug 06 '20 at 16:03