ngxin dash 配置
时间: 2024-03-17 10:42:27 浏览: 18
nginx dash 配置需要使用 Nginx 的 rtmp 模块和 nginx-http-flv-module 模块。以下是一个简单的配置示例:
```
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
push rtmp://your-push-url;
pull rtmp://your-pull-url;
dash on;
dash_path /var/www/dash/;
dash_fragment 5s;
dash_playlist_length 30s;
}
}
}
http {
server {
listen 80;
server_name your-server-name;
location /dash {
root /var/www;
add_header Cache-Control no-cache;
# nginx-http-flv-module
flv_live_stream max=1024m;
}
}
}
```
在上面的配置中,通过监听 rtmp 的 1935 端口,将推流和拉流的 URL 配置到 application live 中。同时启用 dash,将视频切片保存到 /var/www/dash/ 目录下,每个切片的时长为 5 秒,播放列表长度为 30 秒。在 http server 中,配置 /dash 路径,将切片文件通过 nginx-http-flv-module 模块进行实时的 HTTP-FLV 播放。