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

how to use on_play #178

Open freevisitworld opened 11 years ago

freevisitworld commented 11 years ago

how to use on_play? I config nginx.conf according to your specification. However, it does not take effect. lx is stream name.

first host 192.168.10.212 config of ngx-rtmp:        
location /play {
        rewrite .*  rtmp://192.168.10.220/test/lx redirect;
    }
application test { 
     on_play  http://127.0.0.1/play; 
     live on;
}
another host 192.168.10.220 config of ngx-rtmp:
application test { 
    pull rtmp://114.242.120.15:1935/live name=lx static; 
    live on;
}

I play the stream via rtmp://192.168.10.220:1935/test/lx, it is ok. I play the stream via rtmp://192.168.10.212:1935/test/lx, bad luck, black screen. Why? I watch log, as follow:

notify: play redirect to 'rtmp://192.168.10.220/test/lx', client: 192.168.154.252, server: 0.0.0.0:1935 live: play: name='rtmp://192.168.10.220/test/lx' start=0 duration=0 reset=0 live: join 'rtmp://192.168.10.220/test/lx' live: create stream 'rtmp://192.168.10.220/test/lx' create: status code='NetStream.Play.Start' level='status' desc='Start live'

It looks like redirect to another stream server correctly, why I can receive audio video message?

arut commented 11 years ago

According to this

notify: play redirect to 'rtmp://192.168.10.220/test/lx', client: 192.168.154.252, server: 0.0.0.0:1935

Your new stream should be rtmp://192.168.10.220/test/lx which is not what you want. I think you want just lx. Please use this syntax rewrite ^.*$ lx? permanent; to fix that (question sign makes things right)

arut commented 11 years ago

I'm now working on remote redirects. Please wait a little and it will be ready.

arut commented 11 years ago

Please try notify-relay branch. Your syntax is ok with this branch.

arut commented 11 years ago

BTW you should not return domain names as part of rtmp url, but only IP addresses.

Location: rtmp://192.168.0.1/app/stream
freevisitworld commented 11 years ago

Thx, arut. I will test, and tell any bugs. BTW, why hls not supported multiple code rate?

ÔÚ 2013-05-07 21:44:22£¬"Roman Arutyunyan" notifications@github.com дµÀ£º

Please try notify-relay branch. Your syntax is ok with this branch.

¡ª Reply to this email directly or view it on GitHub.

arut commented 11 years ago

You can set up multiple HLS rates with nginx-rtmp. You only have to write HLS variant playlist manually.

freevisitworld commented 11 years ago

sorry, arut. I do not find the branch multiple HLS?

At 2013-05-09 21:53:11,"Roman Arutyunyan" notifications@github.com wrote:

You can set up multiple HLS rates with nginx-rtmp. You only have to write HLS variant playlist manually.

¡ª Reply to this email directly or view it on GitHub.

arut commented 11 years ago

there's not branch. All you need it write a simple m3u8 file and put it in hls directory. I think I will write a manual for that.

freevisitworld commented 11 years ago

arut, I am confused!

this is standard alternative m3u8 playlist. Yeah, I can write a file as it, however, how to generate different code rate AV data. I just config the as offical nginx-rtmp example and do not find ts file of diff code rate.

At 2013-05-10 10:06:58,"Roman Arutyunyan" notifications@github.com wrote:

there's not branch. All you need it write a simple m3u8 file and put it in hls directory. I think I will write a manual for that.

¡ª Reply to this email directly or view it on GitHub.

freevisitworld commented 11 years ago

dear, arut: I test according to your guide, however, it does not take effect. download nginx-rtmp-module-notify-relay.zip ./configure --add-module=./nginx-rtmp-module-notify-relay --with-debug make && make install ################################################ host A 192.168.10.212 config as follow£º location /play { rewrite ^.*$ rtmp://192.168.10.220/test/lanxun redirect; } application test { on_play http://192.168.10.212/play; #192.168.10.212 is localhost live on; } ################################################ host B 192.168.10.220 application test { pull rtmp://192.168.10.222:1935/live name=lanxun static;#this stream exist, i can watch it. live on; } ################################################# I use command:rtmpdump -r rtmp://192.168.10.212/test/lanxun -o file rtmpdump show as: INFO: Connected... Starting download at: 0.000 kB ERROR: RTMP_ReadPacket, failed to read RTMP packet header 0.000 kB / 0.00 sec Download complete ################################################# I really watch nothing and I capture the packet through wireshark and do not find http 302 information. Could you tell me why or give me some advice, Thx in advance, arut.

ÔÚ 2013-05-07 21:44:22£¬"Roman Arutyunyan" notifications@github.com дµÀ£º

Please try notify-relay branch. Your syntax is ok with this branch.

¡ª Reply to this email directly or view it on GitHub.