我已经在Ubuntu14.04上安装并启动了Nginx服务器。我的目标是使用HLS (HTTP实时流)来流视频( live )。我遵循了本教程https://www.vultr.com/docs/setup-nginx-on-ubuntu-to-stream-live-hls-video,它建议使用OBS。但是,我不知道如何从OBS流到Nginx,然后从其他机器(例如,使用VLC)查看流。
发布于 2018-12-17 09:36:13
网址:rtmp://domain:1935/hlslive流名: test
vim /usr/local/nginx/conf/nginx.conf
添加或配置以下模块:
rtmp {
server {
listen 1935; #listen port
chunk_size 4096;
application hlslive { #rtmp push stream request path
live on;
hls on;
hls_path /usr/share/nginx/html/hlslive/test;
hls_fragment 3s;
hls_playlist_length 18s;
}
}
}另外,配置为hls m3u8请求的http服务器:
http {
...
server {
listen 8080;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}运行nginx
nginx -c /usr/local/nginx/conf/nginx.conf
name:8080/hlslive/test/test.m3u8
https://stackoverflow.com/questions/34248149
复制相似问题