需要ffmepg 支持
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
# 开启 HLS
hls on;
hls_path /mnt/hls;
hls_fragment 5s; # 切片时长
hls_playlist_length 30s; # 播放列表时长
}
}
}
HLS 推流配置
server {
listen 8090;
server_name localhost;
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /mnt/hls; # HLS 存放目录(可以改成你的目录)
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
}
}