基础知识
通过FFmpeg解封装或者封装Mp4容器时,可以进行解密或者加密,这是MP4容器提供的能力。
libavformat/movenc.c
:提供了mov、3gp、mp4、psp、3g2、ipod、ismv和f4v的Muxer。libavformat/mov.c
:提供了mov、mp4、m4a、3gp、3g2和mj2的Demuxer。
针对加密,libavformat/movenc.c提供了三个参数:
{ "encryption_scheme", "Configures the encryption scheme, allowed values are none, cenc-aes-ctr", offsetof(MOVMuxContext, encryption_scheme_str), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = AV_OPT_FLAG_ENCODING_PARAM },
{ "encryption_key", "The media encryption key (hex)", offsetof(MOVMuxContext, encryption_key), AV_OPT_TYPE_BINARY, .flags = AV_OPT_FLAG_ENCODING_PARAM },
{ "encryption_kid", "The media encryption key identifier (hex)", offsetof(MOVMuxContext, encryption_kid), AV_OPT_TYPE_BINARY, .flags = AV_OPT_FLAG_ENCODING_PARAM },
加密时,需要指定上面三个参数。
针对解密&#x