Is it possible to encrypt mpeg-dash clear content in ffmpeg?

大城市里の小女人 提交于 2021-01-28 07:20:49

问题


Is it possible to encrypt mpeg-dash clear content in ffmpeg? or do we need to additional code to handle the encryption?

From ffmpeg dashenc.c code it appears that dash code does not encrypt the content. Can we reuse the mp4 muxer for encrypting and dash for segmenting?


回答1:


You can use ffmpeg and openssl to create an AES encrypted HLS stream if this meets your needs - the ffmpeg documentation (http://ffmpeg.org/ffmpeg-all.html#Options-34) includes this example script:

#!/bin/sh
BASE_URL=${1:-'.'}
openssl rand 16 > file.key
echo $BASE_URL/file.key > file.keyinfo
echo file.key >> file.keyinfo
echo $(openssl rand -hex 16) >> file.keyinfo
ffmpeg -f lavfi -re -i testsrc -c:v h264 -hls_flags delete_segments \
  -hls_key_info_file file.keyinfo out.m3u8

You can also use mp4Box (https://gpac.wp.imt.fr/mp4box/encryption/common-encryption/) to create basic clear DASH encryptions:

MP4Box -crypt drm_file.xml movie.mp4 -out movie_encrypted.mp4

The drm info is included in the drm_file.xml and is explained at the link above.



来源:https://stackoverflow.com/questions/47416739/is-it-possible-to-encrypt-mpeg-dash-clear-content-in-ffmpeg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!