我在Ubuntu 14.04上安装并启动了nginx服务器。我的目标是使用HLS(http直播)流式播放视频(直播)。我按照本教程https://www.vultr.com/docs/setup-nginx-on-ubuntu-to-stream-live-hls-video进行了操作,并建议使用OBS-STUDIO。但是,我不知道如何从OBS-STUDIO流到Nginx,然后能够查看来自其他机器的蒸汽(例如使用VLC)。有什么帮助吗?
答案 0 :(得分:1)
URL: rtmp://domain_name:1935/hlslive stream name: 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