我想知道我是不是做错了。所以我使用的两个库是:
Nginx RTMP模块工作得很好,我可以流媒体到从Facebook到Twitch的所有内容,但我似乎不能让它与InstagramLive库一起工作。根据运行InstagramLive库后收到的流密钥和URL,我对nginx.conf文件使用以下格式:
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
push rtmp://live-upload.instagram.com:80/rtmp/<key>;
}
}
}然而,当我启动OBS流时,Instagram账户显示了它的实况,但没有加载视频,并且在一段时间后出现了一个错误,说明超时了。我假设缩放/分辨率有问题,如果有人能帮上忙,我将不胜感激。
更新:
所以我把它放到了Instagram上,但是在直接播放的时候似乎有一个扩展问题,所以我尝试使用ffmpeg来解决这个问题。想出了以下代码:
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
allow publish all;
allow play all;
push rtmp://127.0.0.1:1935/youtube;
exec ffmpeg -i rtmp://127.0.0.1:1935/live/$name -threads 1 -vcodec flv -acodec copy -s 1280x720 -f flv rtmp://127.0.0.1:1935/youtube;
}
application instagram {
live on;
record off;
push rtmp://live-upload.instagram.com:80/rtmp/KEY;
}
application youtube {
live on;
record off;
push rtmp://a.rtmp.youtube.com/live2/KEY;
}
}
}不知怎么的,现在Instagram视频再次无法加载,Youtube或我所包含的任何其他流都可以正常工作。
发布于 2020-01-22 18:51:14
Instagram使用安全rtmp (rtmps://...)但不幸的是,nginx-rtmp模块不支持rtmps。您可以使用第三方程序(例如,您可以使用stunnel)来完成此工作:
#nginx.conf
application live{
push rtmp://127.0.0.1:19350/rtmp/{your-insta-stream-key}
}并在stunnel配置文件中:
#stunnel.conf
pid=/tmp/stunnel/stunnel.pid
output = /tmp/stunnel/stunnel.log
[insta-live]
client = yes
accept = 127.0.0.1:19350
connect = live-upload.instagram.com:443不要忘记在你的服务器上打开端口19350
https://stackoverflow.com/questions/52132576
复制相似问题