标签:dash IV fragment math mod options method alt m3u8
备注:
以前写过使用ffmpeg 转换为m3u8进行hls 视频处理,实际上有一个开源的很强大的工具,我们基本不用什么代码就可以实现hls、
dash、Thumbnail ,很强大
./configure --add-module=/path/to/nginx-vod-module
make
make install
已经有别人做好的镜像了
docker pull nytimes/nginx-vod-module
我直接clone 别人的参考代码
docker run -p 3030:80 -v $PWD/videos:/opt/static/videos -v $PWD/nginx.conf:/usr/local/nginx/conf/nginx.conf nytimes/nginx-vod-module
HLS: http://localhost:3030/hls/devito,360p.mp4,480p.mp4,720p.mp4,.en_US.vtt,.urlset/master.m3u8
Dash: http://localhost:3030/dash/devito,360p.mp4,480p.mp4,720p.mp4,.en_US.vtt,.urlset/manifest.mpd
Thumbnail: http://localhost:3030/thumb/devito360p.mp4/thumb-1000.jpg
nginx config
hls dash thumb
location /hls/ {
vod hls;
alias /opt/static/videos/;
add_header Access-Control-Allow-Headers ‘*‘;
add_header Access-Control-Allow-Origin ‘*‘;
add_header Access-Control-Allow-Methods ‘GET, HEAD, OPTIONS‘;
}
location /thumb/ {
vod thumb;
alias /opt/static/videos/;
add_header Access-Control-Allow-Headers ‘*‘;
add_header Access-Control-Allow-Origin ‘*‘;
add_header Access-Control-Allow-Methods ‘GET, HEAD, OPTIONS‘;
}
location /dash/ {
vod dash;
alias /opt/static/videos/;
add_header Access-Control-Allow-Headers ‘*‘;
add_header Access-Control-Allow-Origin ‘*‘;
add_header Access-Control-Allow-Methods ‘GET, HEAD, OPTIONS‘;
}
核心vod 配置
vod_mode local;
vod_metadata_cache metadata_cache 16m;
vod_response_cache response_cache 2048m;
vod_last_modified_types *;
vod_segment_duration 9000;
vod_align_segments_to_key_frames on;
vod_dash_fragment_file_name_prefix "segment";
vod_hls_segment_file_name_prefix "segment";
vod_manifest_segment_durations_mode accurate;
open_file_cache max=1000 inactive=5m;
open_file_cache_valid 2m;
open_file_cache_min_uses 1;
open_file_cache_errors on;
https://github.com/NYTimes/nginx-vod-module-docker/tree/master/examples
https://github.com/kaltura/nginx-vod-module
https://hub.docker.com/r/nytimes/nginx-vod-module/
使用nginx-vod-module hls &&dash &&Thumbnail 处理
标签:dash IV fragment math mod options method alt m3u8
原文地址:https://www.cnblogs.com/rongfengliang/p/9186441.html