我有一台nginx web服务器,它的RTMP模块运行得很好,可以将视频推送到几个RTMP目的地(Facebook,YouTube,Periscope等)。
我现在需要在HLS协议中输出流,这样我就可以为它构建一个自定义播放器,而不需要依赖flash。我已经尝试了其他一些教程,但我正在苦苦挣扎。
我有安装nginx时附带的默认配置文件,最后添加了以下内容:
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
push rtmp://<streaming-service/key>
}
}
}我到底需要在这个配置文件中添加什么才能保留将视频推送到这些RTMP目的地的能力,以及在没有Flash的情况下可以在播放器中使用的HLS提要?
我已经在机器上安装了FFMPEG,以便将视频发送到Periscope。我见过不需要FFMPEG的解决方案,但我只想补充一句,我确实安装了FFMPEG,并且对它比较熟悉。
编辑:有关更多信息,我正在通过Teradek编码器通过服务器发送视频。
发布于 2018-04-26 05:33:56
我用FFMPEG解决了这个问题。pull指令不能正常工作。下面是为我工作的配置文件:
#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
server {
listen 80;
server_name localhost;
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /tmp/;
add_header Cache-Control no-cache;
add_header 'Access-Control-Allow-Origin' '*';
}
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
push rtmp://<location/key>
exec ffmpeg -i rtmp://localhost/live/test -vcodec libx264 -vprofile baseline -x264opts keyint=40 -acodec aac -strict -2 -f flv rtmp://localhost/hls/test;
}
application hls {
live on;
hls on;
hls_path /tmp/hls/;
hls_fragment 6s;
hls_playlist_length 60s;
}
}
}https://stackoverflow.com/questions/49836813
复制相似问题