PHP对⼀般m3u8视频解密与视频合成#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:6
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-KEY:METHOD=AES-128,URI="/20200509/OMgMS1bn/1500kb/hls/key.key"
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/4416554484484757b2afaccfdc79f381~tplv-obj.image
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/4a92f205162e4781b775b505ee948539~tplv-obj.image
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/efdb74651f98475d9775e846ecd11869~tplv-obj.image
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/f646a8bcb8554acf944884644c3ea73f~tplv-obj.image
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/c22e2efa9ed34b80953b33f1f086a423~tplv-obj.image
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/7e241dd0562d4482acd6703147dca1fe~tplv-obj.image
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/21961a29f94048328e736db712b619c1~tplv-obj.image
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/e083f1905e1543acb65fe0bb9bfd66ae~tplv-obj.image
php实例代码解密
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/eab9fcff6ace46349de1d92bf9ef0caf~tplv-obj.image
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/62a3c11a810e4acb809859db68b5c0f3~tplv-obj.image
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/6ee57d1a15df4081860c1e6fb26f1ad0~tplv-obj.image
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/fb6d7cfcb35d415aa3307c39fb211c61~tplv-obj.image
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/26e9c5139bdb443d9af6ae113335cced~tplv-obj.image
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/488609228cfd4f99aae946b4a7090808~tplv-obj.image
#EXTINF:3.68,
p1.pstatp/img/tos-cn-i-0000/4aa84dc4d66342ae8fac82c7609c0806~tplv-obj.image
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/c32f76881da745ad868a29cfd20e75a8~tplv-obj.image
#EXTINF:2.56,
p1.pstatp/img/tos-cn-i-0000/4ec74ee928aa4d34bb8c61266e4e54f7~tplv-obj.image
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/ae57639370b1475293fb52b58b61fbb9~tplv-obj.image
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/6438ef21fb3c40f7b8e7fd2d76d9ac6d~tplv-obj.image
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/05b46f82fc8548089b2550d96ec4fd87~tplv-obj.image
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/9146b0b7e2ef4b739d0501fec63ab61c~tplv-obj.image
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/83f163495a194340919538957fa8e39b~tplv-obj.image
#EXTINF:3,
p1.pstatp/img/tos-cn-i-0000/4294e9eb19384985be38d71168403f29~tplv-obj.image
m3u8⽂件如上,m3u8原始地址是
可以看到“EXT-X-KEY:” 说明⽚段被“AES-128”加密,加密的key在“/20200509/OMgMS1bn/1500kb/hls/key.key”
这是个路径,真是的访问地址需要带上m3u8的域名;⽐如:abc/test/aaa.m3u8 那么这个key的存放地址就是“abc/20200509/OMgMS1bn/1500kb/hls/key.key”
我拿到的key是“8034146a9b9c8caa”
拿取⼀部分⽚段进⾏解密与合并
$urls = [
'p1.pstatp/img/tos-cn-i-0000/140a4059f7a743459673fb152a0cbdba~tplv-obj.image',
'p1.pstatp/img/tos-cn-i-0000/22ca4b7009a946d99f572522811a070e~tplv-obj.image',
'p1.pstatp/img/tos-cn-i-0000/3f97d2bf95154358973c77626017e308~tplv-obj.image',
'p1.pstatp/img/tos-cn-i-0000/a676b20b54ae47daa5e1266963a01294~tplv-obj.image',
'p1.pstatp/img/tos-cn-i-0000/53d0ad7595ad431291db32e182be3014~tplv-obj.image',
'p1.pstatp/img/tos-cn-i-0000/d530ab2cd2be4639992e71b159333bf3~tplv-obj.image'
];
foreach ($urls as$url) {
$ciphertext_raw = file_get_contents($url);
$cipher="aes128";
$key='8034146a9b9c8caa';
$original_plaintext = openssl_decrypt($ciphertext_raw, $cipher, $key, $options=OPENSSL_RAW_DATA);
file_put_contents('aaa.ts', $original_plaintext, FILE_APPEND);
}
浓浓的⽼⽚⽓质没有问题
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论