This tutorial provides the basic steps for using a live encoder that publishes a stream using the MPEG2 Transport Stream protocol (MPEG-TS). Follow these steps to setup an application named live to stream live content to Adobe Flash player, Microsoft Silverlight player, Apple iOS devices, and RTSP/RTP based players & devices.
Updated for Wowza Media Server 2.2.0 (19 November 2010)
Publishing:
Playback:
Multi-bitrate Live Streaming
Multi-bitrate live streaming to Flash, Apple iOS devices and Silverlight requires that you have an encoder that can generate multiple bitrate streams from the same source that are properly key-frame aligned. Once you have an encoder that can generate properly aligned streams then you need to create a Synchronized Multimedia Integration Language (SMIL) file that links the streams together for playback.
For example, let's say we have three live streams encoded at three different bitrates myStream_700.stream (700kbps total bitrate), myStream_350.stream(350kbps total bitrate) and myStream_200.stream (200kbps total bitrate). Using a text editor, create a SMIL file in the [install-dir]/content folder with the namemyStream.smil with the following content:
Code:
<smil>
<head>
</head>
<body>
<switch>
<video src="myStream_700.stream" system-bitrate="700000"/>
<video src="myStream_350.stream" system-bitrate="350000"/>
<video src="myStream_200.stream" system-bitrate="200000"/>
</switch>
</body>
</smil>
You can see that there is a <video> entry in the <switch> container for each rendition of the stream. The system-bitrate value is set to the total bitrate in bits-per-second for that stream.
Note: Silverlight Smooth Streaming will only switch between the video portion of the streams. The audio track of the first stream listed in the <switch> container will be used. If you want to use a stream other then the first stream for the audio track, add an <audio> entry to the <switch> container for that item. The <audio>item will be ignored when streaming using San Jose or Cupertino streaming. For example:
Code:
<smil>
<head>
</head>
<body>
<switch>
<video src="myStream_700.sdp" system-bitrate="700000"/>
<video src="myStream_350.sdp" system-bitrate="350000"/>
<video src="myStream_200.sdp" system-bitrate="200000"/>
<audio src="myStream_200.sdp" system-bitrate="96000"/>
</switch>
</body>
</smil>
Note: By default Silverlight Smooth Streaming will calculate video and audio bitrates for the Manifest data on the fly by inspecting the file. If you would like to instruct Wowza Server to use the bitrates in the SMIL file, add the following property to the HTTPStreams/Properties <Properties> container in [install-dir]/conf/[application]/Application.xml (be sure to get the correct properties container - there are several in the Application.xml file). When running in this mode, Wowza will assume the video and audio system-bitrate values are only for the video and audio data only:
Code:
<Property>
<Name>smoothStreamingUseSMILBitrates</Name>
<Value>true</Value>
<Type>Boolean</Type>
</Property>
Note: When streaming out using RTSP/RTP you can force the output to MPEG-TS (which is needed by many set-top boxes) by adding the following two properties to the RTP/Properties (be sure to get the correct <Properties> container) in [install-dir]/conf/[application]/Application.xml:
Code:
<Property>
<Name>forceMPEGTSOut</Name>
<Value>true</Value>
<Type>Boolean</Type>
</Property>
<Property>
<Name>rtpWrapMPEGTS</Name>
<Value>true</Value>
<Type>Boolean</Type>
</Property>
Note: Wowza Server can output AAC audio using two different packetization methods; mpeg4-generic and mp4a-latm (3gpp). The default packetization method ismpeg4-generic. To switch to mp4a-latm (3gpp) add the following property to the RTP/Properties container in [install-dir]/[application]/Application.xml (be sure to get the correct Properties container - there are several in Application.xml):
Code:
<Property>
<Name>audioPacketizerAAC</Name>
<Value>com.wowza.wms.rtp.packetizer.RTPPacketizerMPEG4LATM</Value>
</Property>
Note: Some MPEG-TS based encoders send out video and audio in such a way that the media frames are not aligned on PES packet boundaries. This will cause the video and audio to not play. Wowza Server can re-aligned unaligned streams but it requires a property be added to [install-dir]/conf/[application]/Application.xml to enable this feature.
To turn on the code to fix audio alignment, add the following property to the RTP/Properties container in [install-dir]/[application]/Application.xml (be sure to get the correct Properties container - there are several in Application.xml):
Code:
<Property>
<Name>audioIsAligned</Name>
<Value>false</Value>
<Type>Boolean</Type>
</Property>
To turn on the code to fix video alignment, add the following property to the RTP/Properties container in [install-dir]/[application]/Application.xml (be sure to get the correct Properties container - there are several in Application.xml) (Wowza Media Server 3 or greater is required):
Code:
<Property>
<Name>videoIsAligned</Name>
<Value>false</Value>
<Type>Boolean</Type>
</Property>
Note: Some (not many) MPEG-TS encoders send do not properly align TS packets in UDP packets. When this happens you will see lots of the following warning messages in the logs:
Code:
RTPDePacketizerMPEGTS.handleRTPPacket: Out of sync: 0x[nn]
Add the following property to the RTP/Properties container in [install-dir]/[application]/Application.xml (be sure to get the correct Properties container - there are several in Application.xml):
Code:
<Property>
<Name>rtpDePacketizerWrapper</Name>
<Value>com.wowza.wms.rtp.depacketizer.RTPDePacketizerWrapperReChunkMPEGTS</Value>
</Property>
Wowza Server only allows a single rtpDePacketizerWrapper value. If you have setup a jitter buffer or packet recorder that uses the samertpDePacketizerWrapper they must be removed.
Optional Configuration for Flash RTMP Clients Only
If your application will only stream to Flash RTMP clients you can, optionally, change StreamType "rtp-live", then you will not need to use StreamManager (steps 8a-f above). The first Flash client that plays the stream will trigger Wowza to start re-streaming.
Code:
<StreamType>rtp-live</StreamType>
Also make the /conf/[app-name]/Application.xml /Streams /LiveStreamPacketizers empty:
Code:
<LiveStreamPacketizers></LiveStreamPacketizers>
源文档 <http://www.wowza.com/forums/content.php?37>
第一步:建立发布点application、conf目录下建立发布点live
第二步:修改conf/live下的Application。xml
第三步:在content下建立mpegts.stream(流),mpegts可以随意修改,stream不可修改。修改文件内容为udp://0.0.0.0:10000(地址和端口都是vlc的)
第四步:打开http://wowzaip:8086/streammanager 添加rtp流,流名称填写mpegts.stream(或自定义的流名称)
第五步:播放,rtmp://wowzaip:1935/live/mpegts.stream
<<Application.xml>>
<<vlc.txt>>
VLC编码配置
vlc -vvv "mms://lmdb.nbradio.com/jjpd" --sout
"#transcode{venc=x2
64{keyint=60,profile=baseline,level=3.0,nocabac},vcodec=x264,vb=150,scale=0.5,acodec=mp4a,ab=96,channels=2,samplerate=48000}:rtp{dst=192.168.0.52,port=10000,mux=ts}"
dst=192.168.0.52指wowza服务器IP
port=10000 指端口,可进行变化,变化收[wowza-install]/content/mpegts.stream 中的端口也需要变化。