2017-08-24 58 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的一個不相關的代碼塊。