[FFmpeg-user] encryption not available for fmp4/m4s segments ?!?

Micael Silva micaelsilva at gmail.com
Tue Jul 12 19:07:42 EEST 2022

On Tue, Jul 12, 2022 at 9:07 AM Robin van der Linden via ffmpeg-user <
ffmpeg-user at ffmpeg.org> wrote:

> Hello again,
> well I'm not sure what I should do with your reply, but good to know
> that you know it better, but that doesn't help me at all.
> If you know a solution, please let me simply know.
> 1. " No idea how "encryption" should work without "DRM" " -> Clearkey
> for example.
> 2. If you have really read my message, it's according to HEVC and that
> it's only compatible if you use fmp4 as hls_segment_type instead of
> mpegts. I use h264 and HEVC as I provide ABR streams up to 4K HDR, so
> there is no way around fmp4 for me. The problem is that fmp4 is not
> "packable" with encryption, and you will get the following error: >
> Encrypted fmp4 not yet supported Could not write header for output file
> #0 (incorrect codec parameters ?): Not yet implemented in FFmpeg,
> patches welcome <
> If you don't believe me, please try yourself using the following
> parameters found at http://www.ffmpeg.org/ffmpeg-all.html -> 21.17.1
> Options (-hls_enc -hls_enc_key -hls_enc_key_url -hls_enc_iv). Please
> make sure you set hls_segment_type to fmp4
> And yes I'm on the latest greatest self build ffmpeg version available
> (5.0.1).
> Thanks in advance.

AES-128 doesnt work for HLS with fMP4, maybe you can try using
-encryption_scheme cenc-aes-ctr -encryption_key and -encryption_kid before
muxing into HLS

More information about the ffmpeg-user mailing list