我已经安装Nginx Plus并configurationHLS进行stream式传输。 在请求m3u8
文件时,我收到错误:
2015/09/29 13:32:34 [error] 5814#5814: *1 open() "/usr/video/hls/CODECS="avc1.42e00a,mp4a.40.2"" failed (2: No such file or directory)
m3u8
文件有以下内容:
#EXTM3U #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=545600,RESOLUTION=416x234,CODECS="avc1.42e00a,mp4a.40.2" /usr/video/hls/myvideo_low.m3u8 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1755600,RESOLUTION=640x360,CODECS="avc1.42e00a,mp4a.40.2" /usr/video/hls/myvideo_high.m3u8
Nginx的configuration是:
location /hls { root /usr/video; hls; hls_fragment 5s; hls_buffers 10 10m; hls_mp4_buffer_size 1m; hls_mp4_max_buffer_size 5m; types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } add_header 'Access-Control-Allow-Origin' '*'; add_header 'Cache-Control' 'no-cache'; }
在浏览器中,我收到警告:“找不到TS碎片”。
为了从静态文件(如mp4
动态创建ts
片段,文件名和扩展名必须存在于m3u8
播放列表文件名中:
myvideo_high.mp4.m3u8
为myvideo_high.mp4
对于:
myvideo_high.m3u8
它假定分段已经存在。
使用NGINX Plus白皮书的服务介质显示了手动创建的m3u8
变体播放列表的示例,该页面由于页面格式(换行)而不正确 :
#EXTM3U #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=545600,RESOLUTION=416x234, CODECS="avc1.42e00a,mp4a.40.2" /hls/myvideo_low.mp4.m3u8 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1755600,RESOLUTION=640x360, CODECS="avc1.42e00a,mp4a.40.2" /hls/myvideo_high.mp4.m3u8
这个#EXT-X-STREAM-INF
信息应该在一行中(不换行字符):
#EXTM3U #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=545600,RESOLUTION=416x234,CODECS="avc1.42e00a,mp4a.40.2" /hls/myvideo_low.mp4.m3u8 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1755600,RESOLUTION=640x360,CODECS="avc1.42e00a,mp4a.40.2" /hls/myvideo_high.mp4.m3u8