How to play a video on demand file

Instructions on how to set up an application named  vod to stream video on demand content to all supported player technologies. 

Updated for Wowza Media Server 2.2.0 (19 November 2010)

For this tutorial we will use the  sample.mp4 sample video file that is located in the  [install-dir]/content folder:
  1. Create application folder [install-dir]/applications/vod
  2. Create configuration folder [install-dir]/conf/vod 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: default
      Code:
      <StreamType>default</StreamType>
    2. Set the HTTPStreamers property to: cupertinostreaming, smoothstreaming, sanjosestreaming
      Code:
      <HTTPStreamers>cupertinostreaming,smoothstreaming,sanjosestreaming</HTTPStreamers>
    3. Set the RTP/Authentication/PlayMethod to: none
      Code:
      <PlayMethod>none</PlayMethod>
    Download: Right click Application.xml to download a pre-configure version of Application.xml.

  4. Start Wowza Media Server 2
  • To play using Adobe Flash player (RTMP)

    Double-click [install-dir]/examples/SimpleVideoStreaming/client/simplevideostreaming.html, enter the information below and click the Playbutton.

    Code:
    Server: rtmp://[wowza-address]/vod
    Stream: mp4:sample.mp4
  • To play using Adobe Flash player (San Jose/Flash HTTP)

    Double-click [install-dir]/examples/SimpleVideoStreaming/clientOSMF/bin-release/SimpleOSMFPlayer.html, enter the information below and click the Play button.

    Code:
    Stream: http://[wowza-ip-address]:1935/vod/mp4:sample.mp4/manifest.f4m
    Note: The HTTP link above will not play directly in a browser. The stream can only be played from an OSMF based Flash player that is embedded in an HTML page. To play the stream from a remote system, copy the contents of the clientOSMF/bin-release folder to a web server.

  • To play using an Apple iOS device (Cupertino/Apple HTTP Live Streaming)

    Enter the following URL into the Safari web browser on the device:

    Code:
    http://[wowza-address]:1935/vod/mp4:sample.mp4/playlist.m3u8
    Note: This stream can also be played using the Safari Browser or QuickTime 10.x on a computer running OSX version 10.6 or greater (Snow Leopard).
    Note: The iPhone 3GS and older and iPod touch devices require video encoded using H.264 format, Baseline 3 profile, or lower, and AAC or MP3 stereo audio.

  • To play using Microsoft Silverlight (Smooth Streaming)

    Double-click [install-dir]/examples/SimpleVideoStreaming/clientSilverlight/Default.html, enter the URL below and click the Play button.

    Code:
    http://[wowza-address]:1935/vod/mp4:sample.mp4/Manifest
  • To play using RTSP/RTP player or device (Wowza 2.1 or greater)

    Enter the following URL into the RTSP/RTP player:

    Code:
    rtsp://[wowza-address]:1935/vod/mp4:sample.mp4
    See Also:
    Mobile streaming troubleshooting guide
    How to best setup an application for RTSP/RTP streaming
    How to configure QuickTime player ...
    How to configure VLC player ...

    Note: [wowza-address] is the IP address or domain name of the server running Wowza Server.

    Note: RTSP/RTP streaming is the way to stream to Android and Blackberry mobile devices. Newer Android based phones also support Flash player 10.1 along with RTMP and Flash HTTP streaming.

    Note: It is very important to carefully follow the instructions provided in the Mobile streaming troubleshooting guide to properly configure Wowza Server for RTSP/RTP streaming. 

    Note: To stream to RTSP/RTP be sure UDP ports 0-65535 are open and properly mapped to the server running Wowza Media Server.

    Note: To play your own content, copy it into the [install-dir]/content folder and substitute it's file name for the sample.mp4 file name above.

    Note: To play content that is not at the root of the content folder you must add the default application instance name to the URL. For example if you have a file at the path [install-dir]/content/myvideos/sample.mp4, the URLs for the different stream technologies are:
    • Flash player (RTMP)

      Code:
      Server: rtmp://[wowza-address]/vod
      Stream: mp4:myvideos/sample.mp4

      Single URL: rtmp://[wowza-address]/vod/_definst_/mp4:myvideos/sample.mp4
    • Adobe Flash player (San Jose/Flash HTTP)

      Code:
      Stream: http://[wowza-ip-address]:1935/vod/_definst_/mp4:myvideos/sample.mp4/manifest.f4m
    • Apple iOS device (Cupertino/Apple HTTP Live Streaming)

      Code:
      http://[wowza-address]:1935/vod/_definst_/mp4:myvideos/sample.mp4/playlist.m3u8
    • Microsoft Silverlight (Smooth Streaming)

      Code:
      http://[wowza-address]:1935/vod/_definst_/mp4:myvideos/sample.mp4/Manifest
    • RTSP/RTP player or device (Wowza 2.1 or greater)

      Code:
      rtsp://[wowza-address]:1935/vod/_definst_/mp4:myvideos/sample.mp4

Multi-bitrate Video On Demand Streaming

Multi-bitrate video on demand streaming to Flash, the iOS devices and Silverlight requires that you have multiple files pre-encoded to the desired bitrates for streaming. For stream switching to occur properly, the key frames of each of the files must be aligned. This must be done at encoding time and can be achieved by setting the key frame interval and frame rate values the same for each encoded file. Once you have the files properly encoded, copy them to the  [install-dir]/content folder and create a Synchronized Multimedia Integration Language (SMIL) file that links the files together for playback. 

For example, let's say we have four files encoded at different four different bitrates  bigbuckbunny_15000.mp4 (1500kbps total bitrate),  bigbuckbunny_11000.mp4 (1100kbps total bitrate),  bigbuckbunny_750.mp4 (750kbps total bitrate) and  bigbuckbunny_450.mp4 (450kbps total bitrate). Using a text editor create a SMIL file in the  [install-dir]/content folder with the name  bigbuckbunny.smil with the following content:

Code:
<smil>
<head>
</head>
<body>
<switch>
<video src="mp4:bigbuckbunny_450.mp4" system-bitrate="450000"/>
<video src="mp4:bigbuckbunny_750.mp4" system-bitrate="750000"/>
<video src="mp4:bigbuckbunny_1100.mp4" system-bitrate="1100000"/>
<video src="mp4:bigbuckbunny_1500.mp4" system-bitrate="1500000"/>
</switch>
</body>
</smil>
You can see that there is a  <video> entry in the  <switch> container for each rendition of the file. The  system-bitrate value is set to the total bitrate in  bits-per-second for that file (both audio and video). 
  • To play using Adobe Flash player (San Jose/Flash HTTP)

    Double-click [install-dir]/examples/SimpleVideoStreaming/clientOSMF/bin-release/SimpleOSMFPlayer.html, enter the information below and click the Play button.

    Code:
    Stream: http://[wowza-ip-address]:1935/vod/smil:bigbuckbunny.smil/manifest.f4m
  • To play using an Apple iOS device (Cupertino/Apple HTTP Live Streaming)

    Enter the following URL into the Safari web browser on the device:

    Code:
    http://[wowza-address]:1935/vod/smil:bigbuckbunny.smil/playlist.m3u8
  • To play using Microsoft Silverlight (Smooth Streaming)

    Double-click [install-dir]/examples/SimpleVideoStreaming/clientSilverlight/Default.html, enter the URL below and click the Play button.

    Code:
    http://[wowza-address]:1935/vod/smil:bigbuckbunny.smil/Manifest
  • To play using Adobe Flash player (RTMP)

    Dynamic Streaming to the Flash player requires a fair amount of work on the client-side. These articles cover the details of how to achieve dynamic streaming in Flash:

    Dynamic streaming in Flash (part 1)
    Dynamic streaming in Flash (part 2)
    Dynamic streaming in Flash (part 3)

    See Also:
    JW Player Dynamic Streaming
    Flowplayer Dynamic Streaming

    Note: JW Player and Flowplayer use a client-side xml file to reference each version not the server-side smil file shown in this tutorial. The both also use the BWCheck module.

You can download the smil file and the videos referenced in this tutorial from these links (H.264 Main profile):
http://www.wowzamedia.com/_h264/bigbuckbunny.smil
http://www.wowzamedia.com/_h264/bigbuckbunny_450.mp4
http://www.wowzamedia.com/_h264/bigbuckbunny_750.mp4
http://www.wowzamedia.com/_h264/bigbuckbunny_1100.mp4
http://www.wowzamedia.com/_h264/bigbuckbunny_1500.mp4

Lower bitrate set for mobile streaming (H.264 Baseline profile - iPhone and iPod touch compatible)
http://www.wowzamedia.com/_h264/bigbuckbunnyiphone.smil
http://www.wowzamedia.com/_h264/bigb...iphone_300.mp4
http://www.wowzamedia.com/_h264/bigb...iphone_400.mp4
http://www.wowzamedia.com/_h264/bigb...iphone_600.mp4

These sample mutiple-rate files where encoded with  Microsoft Expression Encoder 4 and are properly encoded with key frames aligned.

Note: Silverlight Smooth Streaming will only switch between the video portion of the files. The audio track of the first file listed in the  <switch> container will be used. If you want to use a file other then the first file 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="mp4:bigbuckbunny_450.mp4" system-bitrate="450000"/>
<video src="mp4:bigbuckbunny_750.mp4" system-bitrate="750000"/>
<video src="mp4:bigbuckbunny_1100.mp4" system-bitrate="1100000"/>
<video src="mp4:bigbuckbunny_1500.mp4" system-bitrate="1500000"/>
<audio src="mp4:bigbuckbunny_1500.mp4" system-bitrate="128000"/>
</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 is  mpeg4-generic. To switch to  mp4a-latm (3gpp) add the following property to the  RTP/Properties container in  [install-dir]/live/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>

转载于:https://www.cnblogs.com/pengyingh/articles/2418046.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值