2017-08-24 32 views
0

我有用rtmp module编译的nginx。我开始nginx并运行以下开始串流我的摄像头,其工作原理:rtmp Nginx使用控制端点进行记录?

ffmpeg -i /dev/video0 -f flv rtmp://localhost/live/test                        

然后我尝试使用control module开始录音:

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=testname=live既不会导致错误响应。

Complete nginx.conf file.

更新#2:

我看/var/log/nginx/error.log,而我使用上面的curl命令。每当我使用它时,记录如下:

client 127.0.0.1 closed keepalive connection 
+0

邮政完整的nginx的配置,只是它的一部分 –

+0

@TarunLalwani https://gist.github.com/kirkins/fb811f8caf34d3cdf1d9874050fb1a62 –

回答

0

我主张修复这个问题。问题是两倍。

  1. 申请不是我的申请名称,它是live
  2. rec1块不在活动应用程序块内,它是hls的一个不相关的代码块。