下载 m3u8 推流
在浏览器 Network 中查找 m3u8
如果是上图所示嵌套,逐级打开对应 m3u8 文件,直到出现 ts 文件列表和密钥
如果要先下载再合并,则观察 ts 文件 url 规律,使用 curl 批量下载文件
1
curl -O https://what-ever-[1-999].ts
将 m3u8 文件下载到同一目录,并替换删除其中 url 前缀
按照 URI 参数值下载 m3u8 文件中的密钥 key 文件,应为16字节长度。同时改写 m3u8 文件中 key 路径使其指向此文件
使用 ffmpeg 批量解密合并 ts 文件即可获得 mp4 视频
1
ffmpeg -loglevel error -allowed_extensions ALL -i prog-index.m3u8 -c copy "output.mkv"
如果要直接下载,则不需要下载 ts 文件,直接用 ffmpeg 解密 m3u8 文件
1
ffmpeg -loglevel error -protocol_whitelist file,http,https,tcp,tls,crypto -allowed_extensions ALL -i prog-index.m3u8 -c copy "output.mkv"
All articles in this blog are licensed under CC BY-SA 4.0 unless stating additionally.
Comment