如何在PHP中实现明键视频加密并在HTML中播放 [英] How to implement Clear-Key video encryption in PHP and play it in HTML
问题描述
我想在php
中实现视频加密,并在HTML5视频中播放加密的视频.我已经阅读了一些相关文件:
我知道我可以使用其他工具和服务:
- https://support.uplynk.com/tut_embedding_the_uplynk_player_3.html
- https://www.wowza.com/products/capabilities/streaming -content-security
- https://www.intertrust.com/products/drm-system/直播/
- https://bitmovin.com/cenc-widevine-drm/
- https://www.html5rocks.com/en/tutorials/eme/基础知识/
我想提供以下示例:
- https://demo.castlabs.com/(播放大块头兔子流畅的流媒体播放:可以'无法下载,并且该网址可以一次性使用)
我应该通过什么步骤? 我在服务器端使用PHP(laravel).
如果您想支持主要的常用DRM,则此时需要Widevine,PlayReady或FairPlay,那么您确实需要多DRM服务器或服务. /p>
如果您只需要基本保护,则可以使用AES加密或将其明显地与DASH结合使用.
这些安全性不高,但有时足以满足某些需求.
您可以使用ffmpeg和openssl创建AES加密的HLS流-ffmpeg文档( http://ffmpeg.org/ffmpeg-all.html#Options-34 )包含以下示例脚本:
#!/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
您还可以使用mp4Box( https://gpac.wp.imt .fr/mp4box/encryption/common-encryption/)来创建基本的清晰DASH加密:
MP4Box -crypt drm_file.xml movie.mp4 -out movie_encrypted.mp4
drm信息包含在drm_file.xml中,并在上面的链接中进行了解释.
I want to implement video encryption in php
and play encrypted video in HTML5 video. I have read some documents about it:
And I know there are alternative tools and services that I can use:
- https://support.uplynk.com/tut_embedding_the_uplynk_player_3.html
- https://www.wowza.com/products/capabilities/streaming-content-security
- https://www.intertrust.com/products/drm-system/livestream/
- https://bitmovin.com/cenc-widevine-drm/
- https://www.html5rocks.com/en/tutorials/eme/basics/
I want to provide like this example:
- https://demo.castlabs.com/ (play big buck bunny smooth streaming : that can't be downloaded and the url is one-time usable)
What steps should I pass? I use PHP (laravel) in server-side.
If you want to support the major commonly used DRM's, at this time Widevine, PlayReady or FairPlay then you do need either a multi-DRM server or service.
If you just want basic protection the you could use AES encryption or clearly with DASH.
These are not as secure but are sometimes good enough for certain needs.
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.
这篇关于如何在PHP中实现明键视频加密并在HTML中播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!