Nginx-rtmp-module: already publishing when network broken.

Created on 20 Nov 2017  ·  3Comments  ·  Source: arut/nginx-rtmp-module

When I use OBS to pushing the stream and break the network,Reuse the original address push stream after a few seconds,will not be able to push the stream successfully.

the log.

2017/11/20 17:01:25 [info] 8899#0: *7 client connected '192.168.159.1'
2017/11/20 17:01:25 [info] 8899#0: *7 connect: app='live' args='' flashver='' swf_url='' tc_url='rtmp://192.168.159.129/live' page_url='' acodecs=0 vcodecs=0 object_encoding=0, client: 192.168.159.1, server: 0.0.0.0:1935
2017/11/20 17:01:25 [info] 8899#0: *7 createStream, client: 192.168.159.1, server: 0.0.0.0:1935
2017/11/20 17:01:25 [info] 8899#0: *7 publish: name='default12312' args='' type=live silent=0, client: 192.168.159.1, server: 0.0.0.0:1935
2017/11/20 17:01:25 [error] 8899#0: *7 live: already publishing, client: 192.168.159.1, server: 0.0.0.0:1935
2017/11/20 17:02:52 [info] 8899#0: *9 client closed connection while waiting for request, client: 192.168.159.1, server: 0.0.0.0:5000
2017/11/20 17:05:59 [info] 8899#0: *7 recv() failed (104: Connection reset by peer), client: 192.168.159.1, server: 0.0.0.0:1935
2017/11/20 17:05:59 [info] 8899#0: *7 disconnect, client: 192.168.159.1, server: 0.0.0.0:1935
2017/11/20 17:05:59 [info] 8899#0: *7 deleteStream, client: 192.168.159.1, server: 0.0.0.0:1935
2017/11/20 17:06:07 [info] 8899#0: *11 client connected '192.168.159.1'
2017/11/20 17:06:07 [info] 8899#0: *11 connect: app='live' args='' flashver='' swf_url='' tc_url='rtmp://192.168.159.129/live' page_url='' acodecs=0 vcodecs=0 object_encoding=0, client: 192.168.159.1, server: 0.0.0.0:1935
2017/11/20 17:06:07 [info] 8899#0: *11 createStream, client: 192.168.159.1, server: 0.0.0.0:1935
2017/11/20 17:06:07 [info] 8899#0: *11 publish: name='default12312' args='' type=live silent=0, client: 192.168.159.1, server: 0.0.0.0:1935
2017/11/20 17:06:07 [error] 8899#0: *11 live: already publishing, client: 192.168.159.1, server: 0.0.0.0:1935

my config file:

rtmp_auto_push on; # 切换自动推送(多 worker 直播流)模式
rtmp_auto_push_reconnect 1s; # 当 worker 被干掉时设置自动推送连接超时时间。默认为 100 毫秒。
rtmp { # 保存所有 RTMP 配置的块。
server { # 声明一个 RTMP 实例。
listen 1935; # 监听的端口号
# chunk_size 4096; # 流整合的最大的块大小。默认值为 4096。
ping 15s;
ping_timeout 10s;
application vod { # 创建一个 RTMP 应用。
play /usr/local/nginx/html/live; # 点播文件路径
}
application live { # 创建一个 RTMP 应用。
live on; # 是否直播
hls on; # 是否开启hls
hls_path /usr/local/nginx/html/live; # 设置 HLS 播放列表和分段目录。
hls_fragment 10s; # 设置 HLS 分段长度。
max_connections 1024; # 最大连接数
hls_playlist_length 30s; # HLS 播放列表长度
hls_sync 100ms; # HLS 时间戳同步阈值
meta copy; # 是否发送元数据到客户端
recorder manual { # 创建一个录制应用
record all manual; # 设置录制模式
record_suffix %Y-%m-%d-%H_%M_%S.flv; # 设置录制文件名
record_max_size 6200000K; # 设置录制文件的最大值
record_path /usr/local/nginx/html/Rec; # 指定录制的 flv 文件存放目录
}
}
}

Most helpful comment

It seems that the connection didn't close normally, so the server couldn't change the status of publisher. Directive drop_idle_publisher maybe help.

All 3 comments

hi,I met the same problem.the camera connected to nginx server,and it worked well. if i shut down the power and reboot the camera ,it can not reconnect to the server. the stat.xml shows that there is still a connection with same ip .it seems that powering down the camera dosen't make nginx server disconnect the link.how do you solve the problem?thanks

It seems that the connection didn't close normally, so the server couldn't change the status of publisher. Directive drop_idle_publisher maybe help.

yeah,I solved the problem last night , Directive drop_idle_publisher is useful,thanks for your answer!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fishfree picture fishfree  ·  4Comments

hennn picture hennn  ·  6Comments

MikuPanda picture MikuPanda  ·  4Comments

ama-ableton picture ama-ableton  ·  6Comments

sheldonbaker picture sheldonbaker  ·  5Comments