如何在 iOS 中下载和解密 HTTP Live Streaming (HLS) 视频?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38184380/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to download and decrypt HTTP Live Streaming (HLS) videos in iOS?
提问by NSPratik
I want to download M3U8 file chunks (HLS) and store that video (after decrypting it) for later viewing. I have made a demo to play M3U8 file but I want to download video data for later view.
我想下载 M3U8 文件块 (HLS) 并存储该视频(解密后)以供以后查看。我做了一个演示来播放 M3U8 文件,但我想下载视频数据供以后查看。
回答by niutech
You can use ffmpegto download and decode the HTTP-LS stream:
您可以使用ffmpeg下载和解码 HTTP-LS 流:
ffmpeg -i http://example.org/playlist.m3u8 -c copy -bsf:a aac_adtstoasc output.mp4
There is an iOS version of ffmpegavailable.
有一个iOS 版本的 ffmpeg可用。
回答by tube-builder
There also exists a Chrome extension that makes a whole video from m3u8 chunks, here's the link HLS Video Saver
还有一个 Chrome 扩展程序可以从 m3u8 块制作整个视频,这里是链接HLS Video Saver
回答by sequielo
This Perl script is a good fetcher: https://github.com/osklil/hls-fetch
这个 Perl 脚本是一个很好的获取器:https: //github.com/osklil/hls-fetch
Steps:
脚步:
wget https://raw.githubusercontent.com/osklil/hls-fetch/master/hls-fetch
chmod +x hls_fetch
./hls_fetch --playlist "THE_URL"
Replace THE_URL
with the full URL of your M3U8 playlist (or try other options with --help
).
替换THE_URL
为 M3U8 播放列表的完整 URL(或尝试其他选项--help
)。
Bonus: If you have missing Perl's JSON module (as I had), simply run sudo cpan JSON
.
奖励:如果您缺少 Perl 的 JSON 模块(就像我一样),只需运行sudo cpan JSON
.