You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

mediafilesegmenter是否支持Sample Encryption采样加密?

Does mediafilesegmenter support Sample-AES encryption?

Great question! Let's break this down clearly:

mediafilesegmenter does NOT natively support Sample-AES encryption — here's why that's happening and how you can achieve your desired workflow:

What's going on with your current command

When you run:

$ mediafilesegmenter -k -r myMovie.mp4

The -k flag triggers AES-128 whole-segment encryption, where entire HLS media segments are encrypted as a single block. This is fundamentally different from Sample-AES, which encrypts individual media samples (like video frames or audio samples) rather than entire segments.

How to get Sample-AES encrypted HLS streams

Since mediafilesegmenter can't handle sample-level encryption on its own, you'll need a two-step workflow using additional tools. A common, reliable approach uses the open-source Bento4 toolset:

  1. First, encrypt your MP4 with Sample-AES using mp4encrypt
    This tool lets you apply MPEG-CENC (Common Encryption) with Sample-AES mode. A sample command looks like:

    mp4encrypt \
      --method MPEG-CENC \
      --key 1:abcdef1234567890abcdef1234567890:abcdef1234567890abcdef1234567890 \
      --property 1:KID:12345678-1234-1234-1234-123456789012 \
      --sample-aes \
      myMovie.mp4 \
      encrypted_sample_aes.mp4
    

    Adjust the key and KID values to match your specific encryption requirements.

  2. Then segment the encrypted MP4 with mediafilesegmenter
    Now you can use mediafilesegmenter to split the Sample-AES encrypted file into HLS segments:

    mediafilesegmenter -r encrypted_sample_aes.mp4
    

    This will generate HLS segments that retain the Sample-AES encryption metadata and sample-level protection.

Quick note

Sample-AES is often paired with DRM systems like Apple FairPlay Streaming, so you'll also need to ensure your HLS manifest includes the appropriate DRM metadata (such as the content key URL) to enable playback on supported devices.

内容的提问来源于stack exchange,提问作者Kwan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 08:02:40