【问题标题】:rtmp Nginx use control endpoint for record?rtmp Nginx 使用控制端点进行记录?
【发布时间】:2017-08-24 21:22:54
【问题描述】:

我用rtmp module 编译了 nginx。我启动 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=test 切换到 name=live 都不会导致错误响应。

Complete nginx.conf file.

更新 #2:

当我使用上面的curl 命令时,我正在观看/var/log/nginx/error.log。每次我使用它都会记录以下内容:

client 127.0.0.1 closed keepalive connection

【问题讨论】:

标签: nginx rtmp


【解决方案1】:

我已经解决了这个问题。问题有两个方面。

  1. 应用程序不是我的应用程序名称,它是live
  2. rec1 块不在实时应用程序块中,它是与 hls 无关的代码块。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-12
    相关资源
    最近更新 更多