我用rtmp模块编译了nginx。我开始nginx
并运行以下命令以开始流式传输我的网络摄像头,该网络摄像头有效:
ffmpeg -i /dev/video0 -f flv rtmp://localhost/live/test
然后我尝试使用控制模块开始录制:
curl "http://localhost:8080/control/record/start?app=application&name=test&rec=rec1"
但是录制事件似乎没有触发。
这是我nginx.conf
文件的简化版本:
rtmp {
server {
# ... more code here
recorder rec1 {
record all manual;
record_suffix all.flv;
record_path /tmp/rec;
record_unique on;
}
}
}
http {
server {
listen 8080;
server_name localhost;
location /control {
rtmp_control all;
}
}
# ... more code here
}
注意:选中端口 8080 和 1935 都打开,并带有nmap
。
注意/更新:
我注意到,如果我将app=
更改为live
,我会收到一条实际的错误消息:
<html>
<head><title>500 Internal Server Error</title></head>
<body bgcolor="white">
<center><h1>500 Internal Server Error</h1></center>
<hr><center>nginx/1.11.1</center>
</body>
</html>
与具有实际应用程序名称的命令相反,该命令不返回任何内容。这告诉我它在某种程度上是有效的,但我仍然没有最终重新编码。
我还尝试将name=test
切换到name=live
两者都不会导致错误响应。
完整的 nginx.conf 文件。
更新#2:
我在使用上面的curl
命令时正在观察/var/log/nginx/error.log
。每次我使用它时,都会记录以下内容:
client 127.0.0.1 closed keepalive connection
我开始解决这个问题。问题是双重的。
应用程序- 不是我的应用程序名称,而是
live
。 rec1
块不在实时应用程序块内,它是 HLS 的一个不相关的代码块。