wowza + nginx(rtmp) + centOS 설정
구성
[Encoder] - [Oring Wowza ] - [Relay Wowza ] - [Ngonx + rtmp ]
버전
Wowza : service WowzaStreamingEngin 4.0
OS : CentOS 5.5
Nginx : 1.4.2
설정.
VM 1 : 192.168.0.173 (wowza origin)
와우자 설치시, 자바설치 할것 : yum install java-1.7.0-openjdk-devel
/usr/local/WowzaStreamingEngine/conf/live-test
Application.xml
1 2 3 4 5 | <StreamType>liverepeater-origin</StreamType> . . <LiveStreamPacketizers>cupertinostreamingpacketizer, sanjosestreamingpacketizer, smoothstreamingpacketizer</LiveStreamPacketizers> | cs |
VM 2: 192.168.0.174 (wowza - relay)
/usr/local/WowzaStreamingEngine/conf/live-test
Application.xml
1 2 3 4 5 6 7 8 9 10 11 12 | <StreamType>liverepeater-edge</StreamType> . . <LiveStreamPacketizers>cupertinostreamingpacketizer, sanjosestreamingpacketizer, smoothstreamingpacketizer</LiveStreamPacketizers> . . . <Repeater> <OriginURL>rtmp://192.168.0.173/live-test</OriginURL> <QueryString><![CDATA[]] > </QueryString> </Repeater> | cs |
VM 3: 192.168.0.175
Install (nginx , nginx-rtmp-module)
1 2 3 4 5 6 7 8 9 10 | nginx-1.4.3 받기 # cd /uer/local/src # wget http://nginx.org/download/nginx-1.4.3.tar.gz # tar xzvf nginx-1.4.3.tar.gz rtmp 모둘 받기 #git clone git://github.com/arut/nginx-rtmp-module.git nginx-1.4.3 + nginx-rtmp-module 설치 #cd /usr/local/nginx # ./configure --add-module=/usr/local/src/nginx-rtmp-module/ --with-http_ssl_module --prefix=/usr/local/nginx | cs |
* hls도 의 컴파일로 적용 가능함.
#vi /usr/local/nginx/conf/ nginx.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | events { worker_connections 1024; } # HTTP can be used for accessing RTMP stats http { access_log /var/log/nginx/access-streaming.log; error_log /var/log/nginx/error-streaming.log; server { # in case we have another web server on port 80 listen 80; # This URL provides RTMP statistics in XML location /stat { rtmp_stat all; rtmp_stat_stylesheet stat.xsl; } location /stat.xsl { # XML stylesheet to view RTMP stats. # Copy stat.xsl wherever you want # and put the full directory path here root /usr/local/nginx/html/; } #rtmp control location /control { rtmp_control all; } error_page 500 502 503 504 /50x.html; location =/50x.html { root html; } #hls location /hls { types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } root /tmp; add_header Cache-Control no-cache; } } } rtmp { server { listen 1935; chunk_size 4096; application live-test { live on; pull rtmp://192.168.0.173/live-test/aaa; hls on; hls_path /tmp/hls; hls_fragment 5s; } } } | cs |
stat.xsl 복사
cp /usr/local/src/nginx-rtmp-module/stat.xsl /usr/local/nginx/html
/usr/local/nginx/html
1 2 3 4 5 6 7 8 9 10 | [root@nginx html]# ll -rw-r--r-- 1 root root 537 Feb 16 11:45 50x.html -rw-r--r-- 1 root root 15145 Feb 16 12:22 bg.jpg -rw-r--r-- 1 root root 494 Feb 16 12:26 index.html ------------> /usr/local/src/nginx-rtmp-module/test/www/index.html 에서 복사해옴. drwxr-xr-x 2 root root 4096 Apr 18 2013 jwplayer ------------> jwplayer 설치 -rw-r--r-- 1 root root 209760 May 9 2013 jwplayer-3359.zip -rw-r--r-- 1 root root 614 Feb 16 12:15 player.html -------------> /usr/local/src/nginx-rtmp-module/test/rtmp-publisher/player.html 복사해옴 -rw-r--r-- 1 root root 1454 Feb 16 12:22 record.html -------------> /usr/local/src/nginx-rtmp-module/test/rtmp-publisher/record.html 복사해옴. -rw-r--r-- 1 root root 11765 Feb 16 20:57 stat.xsl --------------> /usr/local/src/nginx-rtmp-module/stat.xsl 복사해옴. | cs |
index.html (jwplay - test page)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <b>Play</b> | <a href="record.html">Record</a> <br/> <script type="text/javascript" src="/jwplayer/jwplayer.js"></script> <div id="container">Loading the player ...</div> <script type="text/javascript"> jwplayer("container").setup({ sources: [ { file: "rtmp://192.168.0.175/live-test/aaa" ##wowza relay 서버 정보등록 } ], image: "bg.jpg", autostart: false, width: 640, height: 480, primary: "flash" }); </script> | cs |
참고 사항 (wowza 오리진 - edge 구성방법)
Uninstall 방법
1 2 3 4 | cd /usr/local sudo rm –f WowzaStreamingEngine sudo rm –rf WowzaStreamingEngine-4.0.0 | cs |