Is any way that is safe to display videos in a browser

前端 未结 1 1003
天命终不由人
天命终不由人 2020-12-06 03:34

Is any way that is safe to display videos in a browser, Like, one of his security things, the video cannot be downloaded thanks

相关标签:
1条回答
  • 2020-12-06 04:39

    I think you mean that you don't want your video to be downloaded or copied?

    If so then it is more or less impossible to stop people downloading the video - there are many tools available to download even from big providers like YouTube.

    So the approach most take is to encrypt the video and use HTML5's Encrypted Media Extension (EME) to handle secure playback - basically support DRM on the video.

    If you just want to put a basic barrier to stop casual users copying the video then MPEG DASH 'clearkey' encryption or HLS AES encryption may be sufficient for your needs - these are not considered robust by most large content owners, but may be fine for simple use.

    You can use ffmpeg and openssl to create an AES encrypted HLS stream - 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.

    0 讨论(0)
提交回复
热议问题