arut / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
13.36k stars 3.51k forks source link

second publish event just before unpublish #789

Open ama-ableton opened 8 years ago

ama-ableton commented 8 years ago

I'm having some weird problems where there is a second publish event with no name or type just before an unpublish event. This only happens sometimes, but about 70% of the time. I came across this because the exec_recording_done directive was returning wrong values for $path, $name, $basename etc. where the filename part would be -1459442871.flv instead of stream-1459442871.flv. I'm assuming because the second publish event has no name, it simply takes the empty string as the name and passes that to to the variables.

The behavior is similar to what is referenced in #341 and #351. I'm using Wirecast 6.0.6 to stream to nginx.

nginx version:

nginx version: nginx/1.8.1
built by gcc 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
built with OpenSSL 1.0.1f 6 Jan 2014
TLS SNI support enabled
configure arguments: --add-module=../nginx-rtmp-module --with-debug --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_spdy_module --with-ipv6

My nginx config:

user www-data;
worker_processes 1;

error_log  logs/error.log debug;

events {
    worker_connections  1024;
}

rtmp {
    server {
        listen 1935;

        application live {
            live on;

            record all;
            record_path /mnt/videos/tmp;
            record_unique on;

            exec_publish bash -c "source /var/www/wind-django/venv/bin/activate && /var/www/wind-django/venv/bin/python /var/www/wind-django/wind/manage.py add_session &>>/var/www/wind-django/logs/log.txt";

            exec_record_done bash -c '/usr/bin/avconv -y -i /mnt/videos/tmp/*$filename -vcodec copy -acodec copy /mnt/videos/$basename.mp4 &>>/var/www/wind-django/logs/log-avconv.txt && source /var/www/wind-django/venv/bin/activate && /var/www/wind-django/venv/bin/python /var/www/wind-django/wind/manage.py attach_video 0 $basename.mp4 &>>/var/www/wind-django/logs/log.txt';

        }
    }
}

debug log:

2016/03/31 17:52:09 [debug] 20627#0: *1 exec: publish 1 unmanaged command(s)
2016/03/31 17:52:09 [info] 20627#0: *1 exec: starting unmanaged child 'bash', client: 10.1.0.141, server: 0.0.0.0:1935
2016/03/31 17:52:09 [debug] 20627#0: *1 exec: child 'bash' started pid=20630
2016/03/31 17:52:09 [debug] 20627#0: *1 live: publish: name='stream' type='LIVE'
2016/03/31 17:52:09 [debug] 20627#0: *1 live: join 'stream'
2016/03/31 17:52:09 [debug] 20627#0: *1 live: create stream 'stream'
2016/03/31 17:52:09 [debug] 20627#0: *1 create: status code='NetStream.Publish.Start' level='status' desc='Start publishing'
2016/03/31 17:52:09 [debug] 20627#0: *1 create: amf nelts=4
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (1) 02 '?'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (2) 00 08 '??'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (8) 6F 6E 53 74 61 74 75 73 'onStatus'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (1) 00 '?'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (8) 00 00 00 00 00 00 00 00 '????????'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (1) 05 '?'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (1) 03 '?'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (2) 00 05 '??'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (5) 6C 65 76 65 6C 'level'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (1) 02 '?'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (2) 00 06 '??'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (6) 73 74 61 74 75 73 'status'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (2) 00 04 '??'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (4) 63 6F 64 65 'code'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (1) 02 '?'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (2) 00 17 '??'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (23) 4E 65 74 53 74 72 65 61 6D 2E 50 75 62 6C 69 73 'NetStream.Publis'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (2) 00 0B '??'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (11) 64 65 73 63 72 69 70 74 69 6F 6E 'description'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (1) 02 '?'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (2) 00 10 '??'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (16) 53 74 61 72 74 20 70 75 62 6C 69 73 68 69 6E 67 'Start publishing'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (2) 00 00 '??'
2016/03/31 17:52:09 [debug] 20627#0: *1 AMF write (1) 09 '?'
2016/03/31 17:52:09 [debug] 20627#0: *1 RTMP prep amf_cmd (20) fmt=0 csid=5 timestamp=0 mlen=105 msid=1 nbufs=1
2016/03/31 17:52:09 [debug] 20627#0: *1 RTMP send nmsg=1, priority=0 #6
2016/03/31 17:52:09 [debug] 20627#0: *1 send: fd:3 117 of 117
2016/03/31 17:52:09 [debug] 20627#0: *1 record: publish 1 nodes
2016/03/31 17:52:09 [debug] 20627#0: *1 record: start
2016/03/31 17:52:09 [debug] 20627#0: *1 record:  opening
2016/03/31 17:52:09 [debug] 20627#0: *1 record:  path: '/mnt/videos/tmp/stream-1459439529.flv'
2016/03/31 17:52:09 [debug] 20627#0: *1 record:  opened '/mnt/videos/tmp/stream-1459439529.flv'
2016/03/31 17:52:09 [debug] 20627#0: *1 recv: fd:3 -1 of 146
2016/03/31 17:52:09 [debug] 20627#0: *1 recv() not ready (11: Resource temporarily unavailable)
....
2016/03/31 17:52:13 [debug] 20627#0: *1 RTMP bheader fmt=0 csid=5
2016/03/31 17:52:13 [debug] 20627#0: *1 RTMP mheader fmt=0 amf_cmd (20) time=0+0 mlen=22 len=0 msid=1
2016/03/31 17:52:13 [debug] 20627#0: *1 recv: fd:3 53 of 129
2016/03/31 17:52:13 [debug] 20627#0: *1 RTMP recv amf_cmd (20) csid=5 timestamp=0 mlen=22 msid=1 nbufs=1
2016/03/31 17:52:13 [debug] 20627#0: *1 nhandlers: 1
2016/03/31 17:52:13 [debug] 20627#0: *1 calling handler 0
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF read (1) 02 '?'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF read (2) 00 07 '??'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF read (7) 70 75 62 6C 69 73 68 'publish'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF func 'publish' passed to handler 0/1
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF read (1) 00 '?'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF read (8) 00 00 00 00 00 00 00 00 '????????'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF read (1) 05 '?'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF read (1) 01 '?'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF read (1) XX '?'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF read eof (1)
2016/03/31 17:52:13 [info] 20627#0: *1 publish: name='' args='' type= silent=0, client: 10.1.0.141, server: 0.0.0.0:1935
2016/03/31 17:52:13 [debug] 20627#0: *1 exec: publish 1 unmanaged command(s)
2016/03/31 17:52:13 [info] 20627#0: *1 exec: starting unmanaged child 'bash', client: 10.1.0.141, server: 0.0.0.0:1935
2016/03/31 17:52:13 [debug] 20627#0: *1 exec: child 'bash' started pid=20639
2016/03/31 17:52:13 [debug] 20627#0: *1 live: publish: name='' type=''
2016/03/31 17:52:13 [debug] 20627#0: *1 live: already joined
2016/03/31 17:52:13 [debug] 20627#0: *1 create: status code='NetStream.Publish.Start' level='status' desc='Start publishing'
2016/03/31 17:52:13 [debug] 20627#0: *1 create: amf nelts=4
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (1) 02 '?'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (2) 00 08 '??'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (8) 6F 6E 53 74 61 74 75 73 'onStatus'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (1) 00 '?'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (8) 00 00 00 00 00 00 00 00 '????????'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (1) 05 '?'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (1) 03 '?'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (2) 00 05 '??'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (5) 6C 65 76 65 6C 'level'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (1) 02 '?'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (2) 00 06 '??'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (6) 73 74 61 74 75 73 'status'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (2) 00 04 '??'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (4) 63 6F 64 65 'code'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (1) 02 '?'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (2) 00 17 '??'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (23) 4E 65 74 53 74 72 65 61 6D 2E 50 75 62 6C 69 73 'NetStream.Publis'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (2) 00 0B '??'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (11) 64 65 73 63 72 69 70 74 69 6F 6E 'description'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (1) 02 '?'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (2) 00 10 '??'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (16) 53 74 61 72 74 20 70 75 62 6C 69 73 68 69 6E 67 'Start publishing'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (2) 00 00 '??'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF write (1) 09 '?'
2016/03/31 17:52:13 [debug] 20627#0: *1 RTMP prep amf_cmd (20) fmt=0 csid=5 timestamp=0 mlen=105 msid=1 nbufs=1

2016/03/31 17:52:13 [debug] 20627#0: *1 RTMP prep amf_cmd (20) fmt=0 csid=5 timestamp=0 mlen=105 msid=1 nbufs=1
2016/03/31 17:52:13 [debug] 20627#0: *1 RTMP send nmsg=1, priority=0 #7
2016/03/31 17:52:13 [debug] 20627#0: *1 send: fd:3 117 of 117
2016/03/31 17:52:13 [debug] 20627#0: *1 record: publish 1 nodes
2016/03/31 17:52:13 [debug] 20627#0: *1 record: start
2016/03/31 17:52:13 [debug] 20627#0: *1 reusing formerly read data: 36
2016/03/31 17:52:13 [debug] 20627#0: *1 RTMP bheader fmt=0 csid=5
2016/03/31 17:52:13 [debug] 20627#0: *1 RTMP mheader fmt=0 amf_cmd (20) time=0+0 mlen=24 len=0 msid=1
2016/03/31 17:52:13 [debug] 20627#0: *1 RTMP recv amf_cmd (20) csid=5 timestamp=0 mlen=24 msid=1 nbufs=1
2016/03/31 17:52:13 [debug] 20627#0: *1 nhandlers: 1
2016/03/31 17:52:13 [debug] 20627#0: *1 calling handler 0
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF read (1) 02 '?'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF read (2) 00 0B '??'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF read (11) 63 6C 6F 73 65 53 74 72 65 61 6D 'closeStream'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF func 'closestream' passed to handler 0/1
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF read (1) 00 '?'
2016/03/31 17:52:13 [debug] 20627#0: *1 AMF read (8) 00 00 00 00 00 00 00 00 '????????'
2016/03/31 17:52:13 [info] 20627#0: *1 closeStream, client: 10.1.0.141, server: 0.0.0.0:1935
2016/03/31 17:52:13 [debug] 20627#0: *1 live: leave 'stream'
2016/03/31 17:52:13 [debug] 20627#0: *1 create: stream_end msid=1
2016/03/31 17:52:13 [debug] 20627#0: *1 RTMP prep user (4) fmt=0 csid=2 timestamp=0 mlen=6 msid=0 nbufs=1
2016/03/31 17:52:13 [debug] 20627#0: *1 live: set active=0
2016/03/31 17:52:13 [debug] 20627#0: *1 create: status code='NetStream.Unpublish.Success' level='status' desc='Stop publishing'

Wirecast log:

Mar 31 17:52:16 M: Init ----------------
Mar 31 17:52:16 M: User Agent Wirecast/FM 1.0
Mar 31 17:52:16 preparing to connect to rtmp://wind.office.ableton.com:1935/live/stream with params:
<xml_tag />
Mar 31 17:52:16 N: Connect rtmp://wind.office.ableton.com:1935/live
Mar 31 17:52:17 N: onStatus: code="NetConnection.Connect.Success" type="status" desc="Connection succeeded." details="FMS/3,0,1,123"
Mar 31 17:52:17 N: Sending Command releaseStream(stream)
Mar 31 17:52:17 N: Sending Command FCPublish(stream)
Mar 31 17:52:17 S: onStatus() : code:"Success" type:"status" desc:"StreamCreated" details:""
Mar 31 17:52:17 M: Publishing 'stream'
Mar 31 17:52:17 S: onStatus() : code:"NetStream.Publish.Start" type:"status" desc:"Start publishing" details:""
Mar 31 17:52:17 N: Send Meta Data OK
Mar 31 17:52:17 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:17 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:17 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:17 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:17 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:17 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:17 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:17 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:17 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:17 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:17 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:17 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:18 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:18 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:18 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:18 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:18 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:18 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:18 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:18 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:18 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:18 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:18 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:18 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:18 FlashNetStream::enqueueForStream - Waiting for Keyframe
Mar 31 17:52:18 V: Start OK
Mar 31 17:52:18 V: Drop 2
Mar 31 17:52:19 N: Connection Status: 1
Mar 31 17:52:19 A: Start OK: sample=4, channels=2, type=2
Mar 31 17:52:19 V: Drop 2
Mar 31 17:52:20 V: Drop 2
Mar 31 17:52:22 N: onStatus: code="NetConnection.Connect.Closed" type="status" desc="" details=""
Mar 31 17:52:22 V: Total drop count   : 3
Mar 31 17:52:22 V: Avg frames per drop: 2
Mar 31 17:52:22 V: Max frames per drop: 2
Mar 31 17:52:22 A: Maximum flutter    : 69.7664 ms
Mar 31 17:52:22 A: Total drop count   : 0
Pat-rice commented 6 years ago

I've noticed this problem too, it's happening 100% of the time when using wirecast 10.0. If the empty publish event is successful then I receive an empty publish_done Request body received:

{
    "app": "source",
    "flashver": "Wirecast/FM 1.0 (compatible; MS",
    "swfurl": "",
    "tcurl": "rtmp://my-rtmp-server/source",
    "pageurl": "",
    "addr": "x.x.x.x",
    "clientid": "670",
    "call": "publish",
    "name": "",
    "type": ""
}

config file:

rtmp {
        server {
            listen 1935;
            ping 30s;
            application source {
                live on;
                wait_key on;
                wait_video on;
                record all;
                record_path /tmp/live/source-records;
                record_suffix -%d-%b-%y-%H_%M_%S.flv;
                on_publish http://localhost/publish;
                on_publish_done http://localhost/unpublish;
                on_record_done http://localhost/recorded;
                idle_streams off;
                hls on;
                hls_type event;
                hls_path /tmp/live/source_hls;
                hls_fragment 2s;
                hls_playlist_length 5m;
                hls_nested on;
                hls_fragment_naming system;
            }
    }
}
PyvesB commented 6 years ago

Hi there,

We were facing similar issues with the "done" notification having an empty name field, and have come up with a patch proposal on our fork. #1305 was submitted as a pull request, but I would be interested in knowing whether that solves your problem as well and whether you have any additional thoughts on the matter. 😉

Pat-rice commented 6 years ago

@PyvesB Thanks for that ! However on my end, the main problem is that I receive this second "publish" event, and I ended up adding special rules to let it through in order to receive the "done" notification. Getting the name is better (I ended up using "clientid" from nginx) but I don't receive it for "record" event. I've tried to look at the code but I'm not a C developer 😄

tmakin commented 6 years ago

@PyvesB @Pat-rice I've just been messing around with a similar issue with missing $filename for exec_record_done. After lots of messing around with the nginx-rtmp source code I found the smoking gun to be inside my flash streaming app. I was using ns.publish(null) to stop the stream which I now changed to ns.close(). My guess is that ns.publish(null) was appropriate for Flash Media Server in the cases where recording might be restarted.

What I really don't understand is why my previous version worked fine a few weeks ago. Probably a timing issue of some description, perhaps due to docker or other gremlins on my dev machine.

atyachin commented 5 years ago

Hi there,

We were facing similar issues with the "done" notification having an empty name field, and have come up with a patch proposal on our fork. #1305 was submitted as a pull request, but I would be interested in knowing whether that solves your problem as well and whether you have any additional thoughts on the matter. 😉

@PyvesB We tried your fork with Wirecast 12.2.1 and same issues still happen as other people reported once you stop streaming in Wirecast:

The below is nginx log when starting/stopping a stream from the same machine using OBS and Wirecast (compare the events after notify: publish):

OBS: 2019/08/31 18:35:45 [info] 574#0: 54 client connected '84.109.29.107' 2019/08/31 18:35:45 [info] 574#0: 54 connect: app='push' args='' flashver='FMLE/3.0 (compatible; FMSc/1.0)' swf_url='rtmp://rtmp.myserver.com/push' tc_url='rtmp://rtmp.myserver.com/push' page_url='' acodecs=0 vcodecs=0 object_encoding=0, client: 84.109.29.107, server: 0.0.0.0:1935 2019/08/31 18:35:45 [info] 574#0: 54 createStream, client: 84.109.29.107, server: 0.0.0.0:1935 2019/08/31 18:35:45 [info] 574#0: 54 publish: name='Z2l5ujA-ZWF6E1' args='' type=live silent=0, client: 84.109.29.107, server: 0.0.0.0:1935 2019/08/31 18:35:45 [info] 574#0: 54 notify: publish '127.0.0.1:4200/rtmp/start', client: 84.109.29.107, server: 0.0.0.0:1935 2019/08/31 18:35:51 [info] 574#0: 54 deleteStream, client: 84.109.29.107, server: 0.0.0.0:1935 2019/08/31 18:35:51 [info] 574#0: 54 notify: publish_done '127.0.0.1:4200/rtmp/stop', client: 84.109.29.107, server: 0.0.0.0:1935 2019/08/31 18:35:51 [info] 574#0: 54 disconnect, client: 84.109.29.107, server: 0.0.0.0:1935 2019/08/31 18:35:51 [info] 574#0: *54 deleteStream, client: 84.109.29.107, server: 0.0.0.0:1935

Wirecast: 2019/08/31 18:34:17 [info] 574#0: 51 client connected '84.109.29.107' 2019/08/31 18:34:18 [info] 574#0: 51 connect: app='push' args='' flashver='Wirecast/FM 1.0 (compatible; MS' swf_url='' tc_url='rtmp://rtmp.myserver.com/push' page_url='' acodecs=1026 vcodecs=128 object_encoding=0, client: 84.109.29.107, server: 0.0.0.0:1935 2019/08/31 18:34:18 [info] 574#0: 51 createStream, client: 84.109.29.107, server: 0.0.0.0:1935 2019/08/31 18:34:18 [info] 574#0: 51 publish: name='Z2l5ujA-ZWF6E1' args='' type=LIVE silent=0, client: 84.109.29.107, server: 0.0.0.0:1935 2019/08/31 18:34:18 [info] 574#0: 51 notify: publish '127.0.0.1:4200/rtmp/start', client: 84.109.29.107, server: 0.0.0.0:1935 2019/08/31 18:34:24 [info] 574#0: 51 publish: name='' args='' type= silent=0, client: 84.109.29.107, server: 0.0.0.0:1935 2019/08/31 18:34:24 [info] 574#0: 51 notify: publish '127.0.0.1:4200/rtmp/start', client: 84.109.29.107, server: 0.0.0.0:1935 2019/08/31 18:34:24 [info] 574#0: 51 disconnect, client: 84.109.29.107, server: 0.0.0.0:1935 2019/08/31 18:34:24 [info] 574#0: *51 deleteStream, client: 84.109.29.107, server: 0.0.0.0:1935

cescp commented 4 years ago

Same issue with Wirecast 13.0.1. This is my suggested solution (from version v1.2.1):

---
 ngx_rtmp_exec_module.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/ngx_rtmp_exec_module.c b/ngx_rtmp_exec_module.c
index fccd4ba..f94a5f4 100644
--- a/ngx_rtmp_exec_module.c
+++ b/ngx_rtmp_exec_module.c
@@ -1164,28 +1164,30 @@ ngx_rtmp_exec_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
     ngx_rtmp_exec_ctx_t       *ctx;
     ngx_rtmp_exec_app_conf_t  *eacf;

-    eacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_exec_module);

+    eacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_exec_module);
+    
     if (eacf == NULL || !eacf->active) {
-        goto next;
+      goto next;
     }
-
+    
     if (s->auto_pushed) {
-        goto next;
+      goto next;
     }
+    
+    if (ngx_strlen(v->name) != 0) {
+      if (ngx_rtmp_exec_init_ctx(s, v->name, v->args, NGX_RTMP_EXEC_PUBLISHING)
+         != NGX_OK)
+       {
+         goto next;
+       }

-    if (ngx_rtmp_exec_init_ctx(s, v->name, v->args, NGX_RTMP_EXEC_PUBLISHING)
-        != NGX_OK)
-    {
-        goto next;
-    }
-
-    ngx_rtmp_exec_unmanaged(s, &eacf->conf[NGX_RTMP_EXEC_PUBLISH], "publish");
+      ngx_rtmp_exec_unmanaged(s, &eacf->conf[NGX_RTMP_EXEC_PUBLISH], "publish");

-    ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_exec_module);
-
-    ngx_rtmp_exec_managed(s, &ctx->push_exec, "push");
+      ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_exec_module);

+      ngx_rtmp_exec_managed(s, &ctx->push_exec, "push");
+    }
 next:
     return next_publish(s, v);
 }
-- 
2.21.0