Nginx RTMP与InstagramLive-PHP不起作用



我想知道我是否做错了。所以我使用的两个库是:
1. https://github.com/arut/nginx-rtmp-module
2. https://github.com/JRoy/InstagramLive-PHP

Nginx RTMP模块运行良好,我可以流式传输到从Facebook到Twitch的所有内容,但我似乎无法将其与InstagramLive库一起使用。我在nginx.conf文件上使用以下格式,基于我在运行InstagramLive库后收到的流密钥和URL:

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或我包含的任何其他流都可以使用。

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

最新更新