How to publish and play a live stream (MPEG-TS based encoder)

发布时间:2020-08-05 13:31:23 作者:fengjihu
来源:网络 阅读:2080

  1. 英文原版配置,最后有简单操作步骤

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)

  1. Create application folder [install-dir]/applications/live

  2. Create configuration folder [install-dir]/conf/live and copy [install-dir]/conf/Application.xml into this new folder

  3. Edit the newly copied Application.xml file and make the following changes (some of these settings may already be present):

  1. Set the Streams/StreamType property to: live
    Code:
    <StreamType>live</StreamType>

  2. Set the HTTPStreamers property to: cupertinostreaming, smoothstreaming, sanjosestreaming
    Code:
    <HTTPStreamers>cupertinostreaming,smoothstreaming,sanjosestreaming</HTTPStreamers>

  3. Set the Streams/LiveStreamPacketizers property to: cupertinostreamingpacketizer, smoothstreamingpacketizer, sanjosestreamingpacketizer:
    Code:
    <LiveStreamPacketizers>cupertinostreamingpacketizer, smoothstreamingpacketizer, sanjosestreamingpacketizer</LiveStreamPacketizers>
    Note cupertinostreamingpacketizer, smoothstreamingpacketizer, sanjosestreamingpacketizer are used for iOS, Silverlight and Flash HTTP clients. You can remove packetizers that you don't need.

  4. Set the RTP/Authentication/PlayMethod to: none
    Code:
    <PlayMethod>none</PlayMethod>
    Download: Right click Application.xml to download a pre-configured version of Application.xml.

  1. Using a text editor, create the file [install-dir]/content/mpegts.stream (有多个流的话此名称做如下变化test.stream test2.stream,mpegts可随意变化,stream不能变动)set the contents of this file to udp://0.0.0.0:10000 (if you are receiving a multicast stream, change the 0.0.0.0 part to the multicast address of the stream)(0.0.0.0可以设置成VLC的服务器IP,端口也可改变,但需要vlc也做相应改变)

  2. Using a text editor, edit the file [install-dir]/conf/admin.password and add a username and password that will be used to start and stop the publishing of the MPEG-TS stream (below is an example of the file with the username myuser and password mypassword):
    Code:
    # Admin password file (format [username][space][password])
    # username password
    myuser mypassword

  3. Start Wowza Media Server 2

  4. Configure the MPEG-TS based encoder to send a live stream to the IP address of the server running Wowza Server using port 10000

  5. Use the Stream Manager to start the MPEG-TS stream


  1. 在浏览器中打开 http://[wowza-address]:8086/streammanager,输入用户名、密码,做下面配置

  1. Open a web browser and enter the url: http://[wowza-address]:8086/streammanager

  2. Enter your admin username and password from above

  3. Click the [start-receiving-stream] link just below the live application folder

  4. Select the MediaCaster Type: rtp

  5. Enter mpegts.stream into the Stream Name field

  6. Click OK



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>

  1. 简单中文操作步骤参考

第一步:建立发布点applicationconf目录下建立发布点live

第二步:修改conf/live下的Applicationxml

第三步:在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 中的端口也需要变化。


推荐阅读:
  1. 利用Python如何实现批量处理套娃式文件夹
  2. 在ASP.Net环境中如何实现async+await异步编程

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

wowza live stream mpeg-ts

上一篇:Web 入门开发简要路线图

下一篇:BCP 数据的导入和导出

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》