1. 프로그램소개 (http://www.wowzamedia.com/quickstart_2_1_1.html) Wowza Media Server 2 는아래의재생클라이언트를지원한다. Adobe Flash (Adobe Flash player), Microsoft Smooth Streaming (Microsoft Silverlight player) Apple HTTP Live Streaming (iphone, ipad, ipod touch, Safari browser, QuickTime player) Real Time Streaming Protocol (RTSP/RTP) (QuickTime player and VLC media player and many mobile devices) MPEG2 Transport Streams (MPEG-TS) (set-top boxes and IPTV solutions) 프로그램설정 Wowza Media Server 2 를시작하기위해서는우선 application 을생성해야한다. application 은 [install-dir]/applications 폴더를만드는것으로간단하게정의할수있다. 예를들면 myapplication 이라명명된폴더를만들기위해서는아래와같은경로의폴더를만들면된다. [install-dir]/applications/myapplication 위어플리케이션은 simple video on demand streaming( 주문형비디오스트리밍 ) 을위한준비가된상태이다. 이는 [install-dir]/conf 경로에위치하고있는기본설정파일을이용하게된다. [install-dir]/conf/application.xml (Default configuration file) 어플리케이션에기본설정파일대신별도의 Application.xml 파일을할당하기위해선 [install-dir]/conf 경로하단에어플리케이션이름과동일한이름의폴더를생성하고그폴더에기본설정파일을복사해넣어주면된다. [install-dir]/conf/myapplication/application.xml (Configuration file for myapplication) 공통적으로범하게되는실수로는 [install-dir]/applications/[application] 폴더에 Application.xml 파일을넣는경우이다. Wowza Server 와어플리케이션을위한모든설정파일은 [install-dir]/conf 폴더안에있다. 단일어플리케이션은 Adobe Flash player, the Silverlight player, an Apple iphone, ipad, ipod touch device, RTSP/RTP based player 로동시에 live 나 video on demand stream 방식으로전송할수있도록설정될수있다.
지원하는스트림방식 default record live live-lowlatency live-record shoutcast shoutcastrecord liverepeaterorigin liverepeateredge rtp-live rtp-live-record Video on demand streaming of static Flash media, H.264/AAC and MP3 content Video recording Publish and play live video content (best for one-to-many streaming of live events) Publish and play live video content (best for one-to-one or oneto-few video/audio chat applications) Same as live in addition content will be recorded Audio re-streaming of a SHOUTcast/Icecast MP3 or AAC+ audio stream Same as shoutcast in addition content will be recorded Origin stream type used by live stream repeater to deliver a single streaming using origin/edge configuration Edge stream type used by live stream repeater to deliver a single stream using origin/edge configuration Re-streaming of an RTSP/RTP, native RTP or MPEG-TS stream Same as rtp-live in addition content will be recorded 지원되는미디어 flv: FLV (Flash Video - this is the default media type so the qualifier and the file extension can be omitted) Example: "flv:mycoolvideo.flv" mp4: MP4 (QuickTime container -.mp4,.f4v,.mov,.m4v,.mp4a,.3gp, and.3g2) Example: "mp4:mycoolvideo.mov" mp3: MP3 (.mp3) Example: "mp3:mycoolsong.mp3" smil: SMIL (XML files used to configure multi-bitrate streams -.smil) 컨텐츠저장소 Wowza Media Server 2 는 [install-dir]/content 경로에위치한단일컨텐츠디렉토리를사용토록기본설정되어있다. Application.xml 파일에서 Streams/StorageDir 지시자를수정하는것으로저장소경로를변경할수있다.
Real Time Messaging Protocol (RTMP - Adobe Flash Player) Wowza Media Server 2 는멀티비트레이트라이브와주문형비디오컨텐트를 RTMP 기반의어도비플래시플레이어에서재생할수있다. Wowza Server 는플래시미디어인터렉티브서버 (FMIS) 와플래시미디어스트리밍서버로다방면으로손색이없는뛰어난기능을갖추고있다. Wowza Server 는플래시플레이어가지원하는아래의모든비디오와오디오포맷을지원한다. Video H.264 VP6 SorensonSpark Screen Shared codec Audio AAC - AAC, AAC Low Complexity (AAC LC), High Efficiency AAC v1 and v2 (HE-AAC) MP3 Speex NellyMoser ASAO. 어도비플래시플레이어에서재생하기위한 URL 형식의예는아래와같다. rtmp://[wowza-address]/myapplication/mp4:mycoolvideo.mov mp4:mycoolvideo.mov 부분에서콜론 (:) 좌측의 mp4 는앞서소개한지원되는미디어 (flv, mp4, mp3, smil) 중에서택일하여입력한인자이다. 뒤에계속설명할각스트림프로토콜별 url 주소에서도동일한형식을따른다는점에주목한다. Apple HTTP Live Streaming (Cupertino Streaming - iphone, ipad, ipod touch) Wowza Media Server 2 는 Apple HTTP Live Streaming 프로토콜을사용하는아이폰, 아이팟터치, 퀵타임플레이어특수버전, 사파리브라우저에서 H.264, AAC, MP3 컨텐츠를멀티비트레이트라이브와주문형비디오로재생할수있다. 애플 HTTP 라이브스트리밍은 HTTP 전송방식을사용하는스트리밍프로토콜에적합하다. 애플기기에서재생하기위한 URL 형식은아래와같다. http://[wowza-address]:1935/myapplication/mp4:mycoolvideo.mov/playlist.m3u8 상기 url 은 html5 를지원하는애플기기기반의사파리브라우저에서만접근가능하다. 윈도우즈에윈도우즈용사파리브라우저를설치한다해도재생할수없다. 익스플로러에서도물론접근할수없다.
지원하는비디오, 오디오포맷 Video H.264 (Baseline profiile level 3.0 or below) Audio AAC, AAC Low Complexity (AAC LC), High Efficiency AAC v1 (HE-AAC) MP3 Smooth Streaming (Microsoft Silverlight) Wowza Media Server 2 는멀티비트레이트라이브와 H.264, AAC, MP3 주문형비디오를 Smooth Streaming 프로토콜을사용하는 Microsoft Silverlight 플레이어에서재생할수있다. Smooth Streaming 은 HTTP 전송방식을사용한다. Smooth Streaming 은 Manifest 라는플레이리스트를사용하는방식을고수하고있다. URL 형식 http://[wowza-address]1935/myapplication/mp4:mycoolvideo.mov/manifest 지원하는비디오, 오디오포맷 Video H.264 Audio AAC - AAC, AAC Low Complexity (AAC LC), High Efficiency AAC v1 and v2 (HE-AAC) MP3 RTSP/RTP/MPEG-TS (QuickTime, VLC, mobile devices, set top boxes, encoders) Wowza Media Server 2 는멀티비트레이트라이브와 H.264, AAC, MP3 주문형비디오를 Real Time Streaming Protocol (RTSP), Real-time Transport Protocol (RTP), MPEG2 Transport Stream protocol (MPEG-TS) 프로코톨을지원하는플레이어와기기에서재생할수있다. 퀵타임플레이어, VideoLAN VLC 플레이어, 셋톱박스, 모바일기기등이이에해당한다. 또한 Wowza Server 는동일프로토콜을사용하는편집기능이있는기기로부터인코딩입력을받아스트리밍을할수도있다. URL 형식 rtsp://[wowza-address]:1935/myapplication/mylivestream
2. 설치하기 아래 URL 에서다운로드 http://www.wowzamedia.com/store.html Wowza 공식홈페이지에서각 OS 별로설치가능토록패키지타입을구분해서배포중, 레드햇계열의리눅스배포판엔 rpm 버전을다운로드하여설치 http://www.wowzamedia.com/store.html 의 Step 1 로이동 [root@localhost ~]# wget http://www.wowzamedia.com/downloads/wowzamediaserver-2-1- 1/WowzaMediaServer-2.1.1.rpm.bin [root@localhost ~]# chmod +x WowzaMediaServer-2.1.1.rpm.bin [root@localhost ~]#./WowzaMediaServer-2.1.1.rpm.bin 중간에 yes 라고한번입력하기만하면간단하게설치가끝난다.
Wowza 구동을위해선 java 1.6 이상이설치되어있어야하므로리눅스서버에 jdk 가설치되어있는지먼저확인한다. [root@localhost ~]# java -version java version "1.6.0" Java(TM) SE Runtime Environment (build 1.6.0-b105) Java HotSpot(TM) Server VM (build 1.6.0-b105, mixed mode) [root@localhost ~]# 최초구동시에라이센스키를물어보므로 Wowza 홈페이지에서 Free 라이센스용키를받는다. http://www.wowzamedia.com/store.html 의 Step 2 로이동 Free 라이센스버전은 10 건의동시접속을허용하는조건으로 RTMP, RSTP/RTP, MPEG-TS 프로토콜로스트리밍전송시엔기능상의제한이없고 HTTP( 애플아이폰 / 아이패드 / 아이팟터치전용 ) 로전송시엔스트리밍지속시간에제한을두고있다.
개인정보를기입하고하단의 SUBMIT 버튼을누르면이메일로라이센스키가전송된다.
iptables 에아래룰추가 [root@localhost ~]# iptables -A INPUT -p tcp --dport 80 -j ACCEPT [root@localhost ~]# iptables -A INPUT -p tcp --dport 443 -j ACCEPT [root@localhost ~]# iptables -A INPUT -p tcp --dport 554 -j ACCEPT [root@localhost ~]# iptables -A INPUT -p tcp --dport 1935 -j ACCEPT [root@localhost ~]# iptables -A INPUT -p udp --dport 6970:9999 -j ACCEPT [root@localhost ~]# iptables -A INPUT -p tcp --dport 8084:8086 -j ACCEPT 각포트별용도에대한설명은아래링크참고 (http://www.wowzamedia.com/quickstart_2_1_1.html#ports)
jdk 가설치되어있고라이센스키가준비되었다면 Wowza 를구동한다. [root@localhost ~]# cd /usr/local/wowzamediaserver/bin [root@localhost bin]#./startup.sh Configure logging: file:///usr/local/wowzamediaserver/conf/log4j.properties Please enter serial number: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX 라이센스키를입력하면된다. 아래와같은메시지가뜬다면정상적으로구동된것이다. Configure logging: file:///usr/local/wowzamediaserver/conf/log4j.properties Please enter serial number: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX INFO server server-start Wowza Media Server 2 Developer 2.1.1 build24490 - INFO server comment - Serial number: XXXXX-XXXXX-XXXXX-XXXXX-HWJK9 INFO server comment - Maximum connections: 10 INFO server comment - Hardware Available Processors: 1 INFO server comment - Hardware Physical Memory: 51MB/2026MB INFO server comment - Hardware Swap Space: 2045MB/2047MB INFO server comment - Max File Descriptor Count: 20000 INFO server comment - Open File Descriptor Count: 38 INFO server comment - OS Name: Linux INFO server comment - OS Version: 2.6.18-194.3.1.el5 INFO server comment - OS Architecture: i386 INFO server comment - Java Name: Java HotSpot(TM) Server VM INFO server comment - Java Vendor: Sun Microsystems Inc. INFO server comment - Java Version: 1.6.0 INFO server comment - Java VM Version: 1.6.0-b105 INFO server comment - Java Spec Version: 1.6 INFO server comment - Java Home: /usr/java/jdk1.6.0/jre INFO server comment - Java Max Heap Size: 1186MB INFO server comment - Java Architecture: 32 INFO server comment - Java Args[0]: -Xmx1200M INFO server comment - Java Args[1]: -Djava.net.preferIPv4Stack=true INFO server comment - Java Args[2]: -Dcom.sun.management.jmxremote=true INFO server comment - Java Args[3]: -Dcom. wowza.wms.apphome=/usr/local/wowzamediaserver INFO server comment - Java Args[4]: -Dcom.wowza.wms.ConfigURL= INFO server comment - Java Args[5]: -Dcom. wowza.wms.confighome=/usr/local/wowzamediaserver INFO server comment - Java GC[0]: Copy INFO server comment - Java GC[1]: MarkSweepCompact INFO server comment - Server threads[h/t]: 10/10 INFO server comment - CMDInterface now listening: [any]:8083 INFO vhost vhost-start _defaultvhost_ - INFO server comment - _defaultvhost_ threads[h/t]:120/80
home:/usr/local/wowzamediaserver INFO vhost comment _defaultvhost_ Bind attempt ([any]:1935:4) INFO vhost comment _defaultvhost_ Bind successful ([any]:1935) INFO vhost comment _defaultvhost_ Bind attempt ([any]:8086:1) INFO vhost comment _defaultvhost_ Bind successful ([any]:8086) http://[wowza-address]:1935 로접속하여아래와같이출력되어야정상 프로세스현황이아래와같이 4 가지로출력되어야정상 (tcp 1935, 8083, 8086 은고정적이며 15492 포트로올라온것은랜덤 ) [root@localhost ~]# netstat -nlp grep java tcp 0 0 0.0.0.0:15492 0.0.0.0:* LISTEN 12127/java tcp 0 0 0.0.0.0:1935 0.0.0.0:* LISTEN 12127/java tcp 0 0 0.0.0.0:8083 0.0.0.0:* LISTEN 12127/java tcp 0 0 0.0.0.0:8086 0.0.0.0:* LISTEN 12127/java [root@localhost ~]# rpm 버전의 Wowza 는 init 구동스크립트를제공하므로 chkconfig 에서비스명을등록하여간편하게구동할수있다. [root@localhost ~]# chkconfig - add WowzaMediaServer [root@localhost ~]# chkconfig - level 345 WowzaMediaServer on [root@localhost ~]# /etc/init.d/wowzamediaserver Usage: WowzaMediaServer {start stop restart status} [root@localhost ~]# 설치경로
/usr/local/wowzamediaserver-2.1.1 이며 /usr/local/wowzamediaserver 로심볼릭링크경로존재 디렉토리구조 [root@localhost ~]# ls -lh /usr/local/wowzamediaserver-2.1.1 합계 260K -rw-rw-rw- 1 root root 22K 6 월 4 07:19 NOTICE.txt -rw-rw-rw- 1 root root 414 6 월 4 07:19 QUICKSTART.html -rw-rw-rw- 1 root root 6.4K 6 월 4 07:19 README.html -rw-rw-rw- 1 root root 180K 6 월 4 07:19 WowzaMediaServer- 2.1.1_LicenseAgreement.pdf drw-rw-rw- 5 root root 4.0K 7 월 16 10:19 applications drwxrwxr-x 2 root root 4.0K 7 월 12 14:48 bin drw-rw-rw- 4 root root 4.0K 7 월 17 23:06 conf drw-rw-rw- 2 root root 4.0K 7 월 18 01:07 content drw-rw-rw- 4 root root 4.0K 7 월 12 14:35 documentation drwxrwxr-x 15 root root 4.0K 7 월 12 14:35 examples drw-rw-rw- 2 root root 4.0K 6 월 4 07:19 keys drwxrwxr-x 2 root root 4.0K 7 월 12 14:35 lib drw-rw-rw- 2 root root 4.0K 7 월 18 00:12 logs [root@localhost ~]#
3. 사용하기 모든컨텐츠는 /usr/local/wowzamediaserver/content 에저장한것을가정한다. ( 예제파일 : /usr/local/wowzamediaserver/content/extremists.m4v) [root@localhost ~]# mkdir /usr/local/wowzamediaserver/applications/vod [root@localhost ~]# mkdir /usr/local/wowzamediaserver/conf/vod [root@localhost ~]# cp /usr/local/wowzamediaserver/conf/application.xml /usr/local/wowzamediaserver/conf/vod vi /usr/local/wowzamediaserver/conf/vod/application.xml 27 번째줄의 Streams/StreamType property 를아래와같이수정 <StreamType>default</StreamType> 57 번째줄의 RTP/Authentication/PlayMethod property 를아래와같이수정 <PlayMethod>none</PlayMethod> a. 어도비플래시플레이어에서재생 (/usr/local/wowzamediaserver/examples 의플래시플레이어템플릿을활용하거나 jw player 를이용하여재생여부를테스트할수있다 ) Server: rtmp://[wowza-address]/vod Stream: mp4:extremists.m4v 템플릿을이용한재생 /usr/local/wowzamediaserver/examples/example 디렉토리를웹으로접근할수있는경로에복사해넣고 http://[wowzaaddress]/examples/simplevideostreaming/client/simplevideostreaming.html 로접근하면다음과같은화면이나온다.
Server, Stream 에 URL 정보를입력하면된다. 예 ) Server : rtmp://[wowza-address]/vod Stream : mp4:extremists.m4v flv 파일의경우 Stream 인자에 flv:aaa.flv 형식으로입력하면된다. jw player 를이용한재생 jw player 배포사이트에서소스를받아압축을풀어붉은테두리표시를한파일들을웹으로접근할수있는경로에넣어둔다 ( 예 : http://[wowza-address]/jwplayer)
아래와같은소스를 html 문서에넣거나게시판에넣어동영상출력이잘되는지확인해본다. Embed 태그의 src 속성을통해 player.swf 파일의소스경로만유의하면된다. <EMBED id=single2 height=360 name=single2 type=application/x-shockwaveflash width=640 src=http://[wowza-address]/jwplayer/player.swf bgcolor="undefined" allowscriptaccess="always" allowfullscreen="true" wmode="transparent" flashvars="fullscreen=true&bufferlength=2&streamer=rtmp://[wowzaaddress]/vod&file=mp4:extremists.m4v"> b. 아이폰, 아이패드, 아이팟터치에서재생 http://[wowza-address]:1935/vod/mp4:extremists.m4v/playlist.m3u8 애플기기의사파리브라우저에서만접근가능하다는점에유의한다. c. Microsoft Silverlight 에서재생우선아래링크에서 Microsoft Expression 4 Encoder Silverlight Smooth Streaming player 템플릿을받아압축을풀고웹브라우저로접속할수있는경로에위치시킴 http://www.wowzamedia.com/downloads/examples/msexpression4sltemplategra phing.zip Default.html 파일을편집기로열어 342 번째부근의 MediaSource property 를아래와같이수정 http://[wowza-address]:1935/vod/mp4:extremists.m4v/manifest /usr/local/wowzamediaserver/conf/clientaccesspolicy.xml 파일생성하고아래와같이내용작성하고 Wowza 재시작 <?xml version="1.0" encoding="utf-8"?> <access-policy> <cross-domain-access> <policy> <allow-from http-request-headers="*"> <domain uri="*"/> </allow-from> <grant-to> <resource path="/" include-subpaths="true"/> </grant-to> </policy> </cross-domain-access> </access-policy> Deault.html 파일을웹브라우저로접근하여재생하면된다. d. RTSP/RTP 플레이어에서재생 rtsp://[wowza-address]:1935/vod/mp4:extremists.m4v 퀵타임플레이어나 VLC 플레이어로재생해서확인할수있다.
서브디렉토리경로에동영상소스를올렸을경우 URL 형식 예 ) /home 디렉토리하단에각시스템계정별디렉토리를두어웹호스팅처럼스트리밍계정서비스를하고자하는경우 --> /home/foobar/movie/extremists.m4v vi /usr/local/wowzamediaserver/conf/vod/application.xml 28 번째줄의 StorageDir/StorageDirType property 를아래와같이수정하고 Wowza 재시작 <StorageDir>/home</StorageDir> 플래시플레이어 Server : rtmp://[wowza-address]/vod Stream : mp4:foobar/movie/extremists.m4v 실버라이트재생기 http://[wowzaaddress]:1935/vod/_definst_/mp4:foobar/movie/extremists.m4v/manifest RTSP/RTP 플레이어 rtsp://[wowza-address]:1935/vod/_definst_/mp4:foobar/movie/extremists.m4v