github仓库可以用来存储m3u8的视频,开始白嫖
使用ffmpeg将mp4文件分割成ts文件,然后自动生成一个m3u8的列表
打开.bat文件,输入以下命令:
ffmpeg -i D:\video\BeginAgain.mp4 -c:v libx264 -hls_time 10 -hls_list_size 0 -c:a aac -strict -2 -f hls D:\videos\BeginAgain.m3u8
文件源目录是: D:\video\BeginAgain.mp4
,视频被分割后的位置是 `D:\videos\BeginAgain.m3u8`` ,
{alert type="warning"}
目标路径的文件夹一定要存在!
{/alert}
如下图:
{alert type="info"} hls_times 10 每个文件的时间在10s,其余的不用改,建议不改 {/alert}
{dotted startColor="#ff6c6c" endColor="#1989fa"/} 将分割好后的整个文件夹一起上传到github仓库上
{dotted startColor="#ff6c6c" endColor="#1989fa"/}
{dotted startColor="#ff6c6c" endColor="#1989fa"/}
接着来访问它
{message type="warning" content="图片上的地址输错了"/}
应该在BeginAgain.m3u8
的前面再加上文件夹得名字BeginAgain
最后的地址是
https://github.com/lfl0919/cloud/BeginAgain/BeginAgain.m3u8
{dotted startColor="#ff6c6c" endColor="#1989fa"/}
这样直接访问github还是太慢了,接着借助Jsdelivr加速github
地址前缀:https://cdn.jsdelivr.net/gh/
你的仓库的文件位置
{message type="info" content="不用加上github.com"/}
加速后的地址是这样的
https://cdn.jsdelivr.net/gh/lfl0919/cloud/BeginAgain/BeginAgain.m3u8
{progress percentage="90%" color="#ff6c6c"/}
这样的到的链接,浏览器不能直接解析,需要借助播放器插件
https://q6q.cc/m3u8/?url= 这是别人写好的播放器,拿来可以用就行 {message type="success" content="在这里感谢一下这位博主"/} 现在我们访问它 : https://q6q.cc/m3u8/?url=https://cdn.jsdelivr.net/gh/lfl0919/cloud/BeginAgain/BeginAgain.m3u8
{dotted startColor="#ff6c6c" endColor="#1989fa"/}
其他的内置的网页播放器也是可以直接使用的,例如使用Dplayer之类的,那就直接加上原来的文件地址就行
我这是使用的是苹果cms的哔哩哔哩风格的一个播放器
{dplayer src="https://cdn.jsdelivr.net/gh/lfl0919/cloud/BeginAgain/BeginAgain.m3u8"/}
类似于这样去使用它
{dotted startColor="#ff6c6c" endColor="#1989fa"/}
以下附上效果:
{progress percentage="100%" color="#ff6c6c"/}
{message type="success" content="速度还是相当不错的"/}
{dotted startColor="#ff6c6c" endColor="#1989fa"/}
{callout color="#f0ad4e"} 附上ffempg文件下载链接 {/callout}
{cloud title="ffmepg 工具下载" type="default" url="http://cloud.liangblog.xyz/_uploads/%E7%94%B5%E8%84%91%E8%BD%AF%E4%BB%B6/ffmpeg.zip" password=""/}