google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.7k stars 6.02k forks source link

How to play an MP4 encrypted with FFMPEG ? #11306

Closed CiaShangLin closed 11 months ago

CiaShangLin commented 12 months ago

How to play an MP4 encrypted with FFMPEG ? By using the following FFMPEG command, I encrypted an MP4 file, and it can be decrypted and played using ffplay. Is there a way to pass this key to Exoplayer?

ffmpeg -i decryption.mp4 -vcodec copy -acodec copy -encryption_scheme cenc-aes-ctr -encryption_key c7e16c4403654b85847037383f0c2db3 -encryption_kid a7e61c373e219033c21091fa607bf3b8 encryption.mp4

ffplay -i encryption.mp4 -decryption_key c7e16c4403654b85847037383f0c2db3

tianyif commented 11 months ago

Hi @CiaShangLin, I think you can use an AesCipherDataSource that wraps an upstream data source (eg. DefaultDataSource).

CiaShangLin commented 11 months ago

Is there any demo I can refer to?