• How to configure Apple HTTP Live Streaming packetization (cupertinostreaming)

    This article describes the properties that you can use to control how the Cupertino (iOS device) segmenter segments an incoming live stream. All time values are in milliseconds. The values can be set on a per-application basis as LiveStreamPacketizer/Properties in [install-dir]/conf/[application]/Application.xml (where [application] is the name of the application to which you want to apply the settings):

    Properties


    Note: Be sure the to add the properties to the correct <Properties> container on Application.xml. There are several in the file.
    Code:
    <Property>
    	<Name>cupertinoChunkDurationTarget</Name>
    	<Value>10000</Value>
    	<Type>Integer</Type>
    </Property>
    <Property>
    	<Name>cupertinoMaxChunkCount</Name>
    	<Value>10</Value>
    	<Type>Integer</Type>
    </Property>
    <Property>
    	<Name>cupertinoPlaylistChunkCount</Name>
    	<Value>3</Value>
    	<Type>Integer</Type>
    </Property>
    <Property>
    	<Name>cupertinoRepeaterChunkCount</Name>
    	<Value>3</Value>
    	<Type>Integer</Type>
    </Property>

    Details


    The process is quite simple. Audio and video packets from the live encoder enter Wowza Media Server and are segmented into chunks based on time. The duration of each chunk (in milliseconds) is control by the cupertinoChunkDurationTarget setting. As the chunks are created, they are added to the available chunk list. The maximum number of chunks stored in the available chunk list is controlled by the cupertinoMaxChunkCount setting. When an iOS device requests the stream, a playlist is returned that contains the [n] most recently added chunks. The number of items returned in the playlist ([n]) is controlled by the cupertinoPlaylistChunkCount setting.

    The live stream repeater is the system that's used to deliver a single live stream in an origin/edge configuration to multiple edge servers. The first time an edge server requests the stream, it pulls the previously segmented chunks from the origin to the edge for delivery to an iOS device. The cupertinoRepeaterChunkCount setting controls the number of chunks that are immediately sent from the origin to the edge after initial connection. It's best if this setting is equal to or greater than cupertinoPlaylistChunkCount but less then cupertinoMaxChunkCount.

    Notes


    Chunks must start on a key frame, so it's best to use a key frame interval that is factor of the cupertinoChunkDurationTarget setting. For example, if cupertinoChunkDurationTarget is set to 10 seconds then use a key frame interval of either 2, 2.5, 5, or 10 seconds.

    To estimate how much memory is used to store the chunks for a single live stream, use the following formula:
    Code:
    [total-memory-mb] = ([stream-bitrate-kbps]/([1024-kb-per-mb]*[8-bits-per-byte])) * [cupertinoChunkDurationTarget-seconds] * [cupertinoMaxChunkCount]
    For example, a 500 kbps stream will consume the following amount of memory given the default settings above:
    Code:
    (500/(1024*8)) * 10 * 10 = 6 MB of memory
    You can control the video on demand (VOD) chunk size by adding the following property to the HTTPStreamer/Properties container:
    Code:
    <Property>
    	<Name>cupertinoChunkDurationTarget</Name>
    	<Value>10000</Value>
    	<Type>Integer</Type>
    </Property>



    Comments 29 Comments
    1. arturocalle -
      I undestand this properties help to fill a list, if list is filled and sent more fast then we have less delay is right? in that case, what are the min and max values? what is a recomended balance and relation with bandwidth? it works too with "live" from SMIL list?...
    1. rrlanham -
      This is used for live and vod. Set the chunkDurationTarget in relation to key frame frequency, as explained in that guide

      Richard
    1. Andster -
      We are using the following parameters for live streaming to iPhone:
      - <LiveStreamPacketizer>
      - <!-- Properties defined here will override any properties defined in conf/LiveStreamPacketizers.xml for any LiveStreamPacketizers loaded by this applications
      -->
      - <Properties>
      - <Property>
      <Name>chunkDurationTarget</Name>
      <Value>20000</Value>
      <Type>Integer</Type>
      </Property>
      - <Property>
      <Name>maxChunkCount</Name>
      <Value>10</Value>
      <Type>Integer</Type>
      </Property>
      - <Property>
      <Name>playlistChunkCount</Name>
      <Value>3</Value>
      <Type>Integer</Type>
      </Property>
      - <Property>
      <Name>repeaterChunkCount</Name>
      <Value>3</Value>
      <Type>Integer</Type>
      </Property>
      </Properties>
      </LiveStreamPacketizer>
      We want to test with large segments (20 seconds) in order to se if we get a better listener experience in the iPhone. We have previously tried with an increased amount of Chunkcount but that did not increase the buffer in the iPhone for live streaming.

      The problem is that when we download a segment from the streamingserver it is only 10 seconds long. Exampel of an index-file.

      #EXTM3U
      #EXT-X-ALLOW-CACHE:NO
      #EXT-X-TARGETDURATION:20
      #EXT-X-MEDIA-SEQUENCE:126266
      #EXTINF:10,
      media_126266.aac?wowzasessionid=132685594
      #EXTINF:10,
      media_126267.aac?wowzasessionid=132685594
      #EXTINF:10,
      media_126268.aac?wowzasessionid=132685594
      The #EXT-X-TARGETDURATION:20 parameter looks fine bur the segments are still 10 seconds (#EXTINF:10,..).

      What do we need to in order to increase the actual segment size to 20 seconds?

      Anders
    1. rrlanham -
      Anders,

      This will work with the latest development patch:

      http://www.wowzamedia.com/forums/con...lopment-Builds

      The development patch requires 2.1.2 build24878 or higher. If you are lower, apply this patch first:
      http://www.wowzamedia.com/forums/con...oduction-Build

      Richard
    1. Andster -
      Thanks, we will test the patch.

      Anders
    1. gpulier -
      Hi,

      I'm looking for suggestions on FMLE3 settings.
      I have tried a huge number of combinations of H.264 (from baseline 1 to 3), with lots of different frame rates and key frame settings (as described here) and bandwidth settings along with AAC (mono and stereo, with different khz and bitrates) and it all works but the video is a jerky in a weird way: every few seconds the video seems to jump back a few frames and replay them and then keep going normally. This happens when playing on the iPhone or through a quicktime player on a mac.

      Has anyone else seen this?

      I am running the newest patch (Wowza Media Server 2 for Amazon EC2 2.1.2.06 build25881) and I have the XML described here in my live Application.xml.

      Sincerely,

      Greg Pulier
    1. ianbeyer -
      Baseline 3.0, 30fps, with 96Kbps stereo audio does it for me.

      Are you using the mainconcept AAC plugin? If so, make sure you're running the latest version (1.0.6 currently)
    1. rrlanham -
      Greg,

      Make sure your Application.xml /StreamType is "live" and the /LiveStreamPacketizers is "cupertinostreamingpacketizer"

      If you don't have AAC audio, use MP3 stereo 44100 for best results.

      Richard
    1. videodoctor -
      For VOD, do you need to specify the cupertinoChunkDurationTarget if there's already a "general" chunkDurationTarget property setup?
    1. rrlanham -
      I think the default is 10000 (10 seconds). So if that's okay, there is no need to specify.

      Richard
    1. ipjohn -
      Hi Guys

      <LiveStreamPacketizer>
      - <!-- Properties defined here will override any properties defined in conf/LiveStreamPacketizers.xml for any LiveStreamPacketizers loaded by this applications
      -->
      - <Properties>
      - <Property>
      <Name>chunkDurationTarget</Name>
      <Value>8000</Value>
      <Type>Integer</Type>
      </Property>
      - <Property>
      <Name>maxChunkCount</Name>
      <Value>2</Value>
      <Type>Integer</Type>
      </Property>
      - <Property>
      <Name>playlistChunkCount</Name>
      <Value>2</Value>
      <Type>Integer</Type>
      </Property>
      - <Property>
      <Name>repeaterChunkCount</Name>
      <Value>2</Value>
      <Type>Integer</Type>
      </Property>
      </Properties>
      </LiveStreamPacketizer>


      The latency was around 6-7 seconds for the above settings on i-pads ,but the resolution or the canvas size was affected (crop)

      Any advice

      Regard
      ipjohn
    1. rrlanham -
      So, other settings, all else being the same, resulted in different resolution on the IPad? How exactly was resolution affected.

      What were the other settings and resolution?

      Any similar affect on IPhone?

      Which encoder and what encoding parameters?

      Richard
    1. ipjohn -
      Dear Richard,

      The stream was cropped or chopped off (letter box form)

      YES all the settings are same apart from Properties defined in conf/LiveStreamPacketizers.xml for any LiveStreamPacketizers

      parameters settings are

      Video Format 720p/60*
      Video Input HDMI* Video Aspect ratio 16:9*
      Brightness 50*
      Contrast 50*
      Saturation 64*
      H264 Video Enable Enabled*
      H264 Video Template 750k High Motion*
      H264 Video Profile Baseline*
      H264 Video Resolution 1280x720*
      H264 Video Target Bit Rate (bit/sec) 4608000*
      H264 Video Target Frame Rate(frames/sec) 30*
      H264 Video IDR Frame Interval(sec.) 4*
      H264 Video In-loop Deblocking Filter Enabled*
      Enable Stream Enabled*
      Name rtp rate 1*
      Program Select 1*
      Video Rate Select 1*
      Audio Rate Select 1*
      Transport Type RTP*
      Enable KLV Enabled*
      Closed Caption Enable Enabled*
      Network Metered Disabled*
      Metering Aggressiveness Medium*
      MPEG2TS Mode Variable Med Delay*
      MPEG2TS Bitrate Mode Variable*
      MPEG2TS Overhead 10*
      MPEG2TS Gap 440*
      MPEG2TS Video PID 33*
      MPEG2TS Audio PID 36*
      MPEG2TS Metadata PID 35*
      MPEG2TS PCR PID 34*
      MPEG2TS PMT PID 66*
      MPEG2TS PCR rate 10 per second*
      Misb User Data Timestamp Enabled*

      V-brick is the encoder ,the affect on I-phone for a lay man is better

      any advice

      Regards
      IpJohn
    1. ipjohn -
      I-pad 2 claims to be the solver for latency issue

      lets see.....eagerly waiting to test
    1. rrlanham -
      John,

      I don't know, don't have the ability to test at the moment but am expecting an IPad 2 soon.

      I would try a much lower resolution, and 2 second key frame interval, and turn on/off other settings to see what might work better.

      Richard
    1. Koinonia -
      Quote Originally Posted by gpulier View Post
      Hi,

      I'm looking for suggestions on FMLE3 settings.
      I have tried a huge number of combinations of H.264 (from baseline 1 to 3), with lots of different frame rates and key frame settings (as described here) and bandwidth settings along with AAC (mono and stereo, with different khz and bitrates) and it all works but the video is a jerky in a weird way: every few seconds the video seems to jump back a few frames and replay them and then keep going normally. This happens when playing on the iPhone or through a quicktime player on a mac.

      Has anyone else seen this?

      I am running the newest patch (Wowza Media Server 2 for Amazon EC2 2.1.2.06 build25881) and I have the XML described here in my live Application.xml.

      Sincerely,

      Greg Pulier
      Hi Greg,

      I am having the same problem. Did you find the solution?

      Best Regards,

      Daniel Choi
    1. rrlanham -
      Daniel,

      Make sure you have configured an application correctly for live streaming. Is the Application.xml in the right place? This is correct"

      /conf/[app-name]/Application.xml

      Make sure the above Application.xml /StreamType "live", and that there are no errors in the xml. Check the error log for errors, and you can validate xml:
      http://www.w3schools.com/xml/xml_validator.asp

      If config is correct and problem persists, next lower the bitrate by half to see if that makes a difference. If it does, you need to decide on an optimal bitrate setting which will work for most people (and which will probably be less than you would like), or use multi-bitrate streaming.

      Richard
    1. Ostap.s -
      Hi Charlie

      thanks for your great work on this forum,
      your comments are very helpful

      My problem is following:
      I'm using live streaming, and I publish video to Wowza via publisher API.
      (Let's assume that this part is not cause of the problem, as it can't be reproduced on RTSP & RTMP protocols )

      I can't get video stream to be constantly smooth on iOS devices.

      Video I'm seeing is smooth some amount of seconds, then it frizzes (freeze time depends on chunk settings), and then it goes back to smooth.
      The pattern "smooth-frozen-smooth" is repetitive.
      I tried many combinations of cupertinoChunkDurationTarget and cupertinoPlaylistChunkCount parameters.
      Changing of this parameters affects the resulting stream, but does not fix the problem.

      Considering all above I went to Wireshark, and captured traffic from iPhone to Wowza

      I found following fact - iPhone seems to delay refreshing of playlist file.
      As I have read from LiveStreaming documentation
      http://developer.apple.com/library/i...ng/_index.html 6.2.3. Reloading the Playlist file
      "The initial minimum reload delay is the duration of the last media file in the Playlist or 3 times the target duration, whichever is less. Media file duration is specified by the EXTINF tag."

      See below for details:
      (below was captured for chunk duration = 3000, playlist count = 10)

      - 1st playlist contained 2 chunks

      #EXTM3U
      #EXT-X-ALLOW-CACHE:NO
      #EXT-X-TARGETDURATION:3
      #EXT-X-MEDIA-SEQUENCE:1
      #EXTINF:3,
      media_1.ts?wowzasessionid=1062392807
      #EXTINF:3,
      media_2.ts?wowzasessionid=1062392807


      Only after 6.84 seconds iPhone requested playlist once again
      As far as I understand - iPhone should have refreshed playlist after 3 sec. In my case it did it after 6.84 sec.
      Do you have any idea why?

      - 2nd playlist contained 5 chunks
      EXTM3U
      #EXT-X-ALLOW-CACHE:NO
      #EXT-X-TARGETDURATION:3
      #EXT-X-MEDIA-SEQUENCE:1
      #EXTINF:3,
      media_1.ts?wowzasessionid=1062392807
      #EXTINF:3,
      media_2.ts?wowzasessionid=1062392807
      #EXTINF:2,
      media_3.ts?wowzasessionid=1062392807
      #EXTINF:3,
      media_4.ts?wowzasessionid=1062392807
      #EXTINF:3,
      media_5.ts?wowzasessionid=1062392807

      Once again, I expect that after this request it will refresh playlist after 3 seconds, however it does not.
      Only after 10 seconds I get next playlist refresh.

      My question is:
      1. Can this late refreshes of playlist file cause frozen video?
      2. Do you have any clue why it's frizzes, if above is false.
    1. charlie -
      Apple suggests a 10 second chunk size. It might be that even if you set it to 3 seconds that it does not honor this setting properly in the way it requests the playlist. I might try using the default segmentation/fragmentation parameters to see if the problem goes away.

      Charlie
    1. Ostap.s -
      Thanks for the advice,

      I re-captured packets with chunk size setting = 10,000
      Basically playlist refresh timeline is following:

      1st 0 sec.
      2nd +9.952718 sec.
      3rd +12.033115 sec.
      4th +12.513644 sec.
      5th +12.756897 sec.
      6th +12.396032 sec.
      7th +23.876467 sec.
      8th +23.589919 sec.

      And few seconds after 3rd playlist refresh I got frozen video.
      Still, looks like iPhone doesn’t follow rules Apple have set for Http Live Streaming players.

      Any ideas would be appreciated
      Maybe I’m digging into wrong direction?