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

如何通过FFmpeg API设置解密密钥打开采样加密AAC文件?

问题:使用FFmpeg API打开采样加密AAC文件时的解密密钥设置问题

我正尝试使用FFmpeg API打开一个采样加密的AAC封装音频文件。

我可以正常打开未加密的AAC文件,代码如下:

AVFormatContext* iContext = nullptr;
avformat_open_input(&iContext, mediaFileName.c_str(), nullptr, nullptr);

也能通过设置decryption_key选项打开采样加密的fmp4片段,代码如下:

AVDictionary *options = nullptr;
av_dict_set(&options, "decryption_key", ssKey.str().c_str(), 0);
AVFormatContext* iContext = nullptr;
int ret = avformat_open_input(&iContext, mediaFileName.c_str(), nullptr, &options);

但打开采样加密AAC文件时,找不到设置解密密钥的方法。用上述代码时,decryption_key选项未被解复用器消耗,说明AAC解复用器不识别该选项。

带有采样加密AAC音轨的HLS资源可以在ffplay中正常播放,说明FFmpeg本身支持这种格式,求解决思路。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 02:56:02