Wowza Community

value of EXT-X-TARGETDURATION when using custom playstart/playduration

when using cupertino on demand streaming of AAC audio file, the content of the wowza-generated playlist with audio chunks looks like:

#EXTM3U
#EXT-X-TARGETDURATION:13
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:11,
media_1.ts?wowzasessionid=1584231945
#EXTINF:12,
media_2.ts?wowzasessionid=1584231945
#EXTINF:11,
media_3.ts?wowzasessionid=1584231945
#EXTINF:11,
media_4.ts?wowzasessionid=1584231945
#EXTINF:10,
media_5.ts?wowzasessionid=1584231945
#EXTINF:13,
media_6.ts?wowzasessionid=1584231945
#EXTINF:11,
media_7.ts?wowzasessionid=1584231945
...
#EXTINF:11,
media_54.ts?wowzasessionid=1584231945
#EXTINF:1,
media_55.ts?wowzasessionid=1584231945
#EXT-X-ENDLIST

Now, when I specify the playstart/playduration, either by passing the wowzaplaystart and wowzaplayduration parameters to the initial playlist.m3u8 URL, or via httpSession.setPlayStart() and httpSession.setPlayDuration() calls in the server module, the m3u8 playlist looks like:

#EXTM3U
#EXT-X-TARGETDURATION:41
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:11,
media_1.ts?wowzasessionid=1814880444
#EXTINF:10,
media_2.ts?wowzasessionid=1814880444
#EXTINF:13,
media_3.ts?wowzasessionid=1814880444
#EXTINF:9,
media_4.ts?wowzasessionid=1814880444
#EXTINF:10,
media_5.ts?wowzasessionid=1814880444
#EXTINF:4,
media_6.ts?wowzasessionid=1814880444
#EXT-X-ENDLIST

(this example is for playstart=30000 and playduration=57000).

Notice the unexpectedly high value of EXT-X-TARGETDURATION in this case (41), compared to a lower value (13) in case of not overriding the playstart/playduration.

The spec at http://tools.ietf.org/html/draft-pantos-http-live-streaming-01

describes this tag as follows:

3.1.1.  EXT-X-TARGETDURATION
   The EXT-X-TARGETDURATION tag indicates the approximate duration of
   the next media file that will be added to the main presentation.  It
   MUST appear in the Playlist file.  Its format is:
   #EXT-X-TARGETDURATION:<seconds>
   The actual duration of the media file MAY differ slightly from the
   target duration.

This is happening on wowza 3.0.3. I’ve noticed that recently there were some bugs related to this EXT-X-TARGETDURATION tag, so i’m wondering if this behavior is correct or it would create problems with playback of such streams with custom playstart and playduration.

This a bug. Will address in next patch. Wil post back here when patch is available.

Charlie

This patch should address this issue:

WowzaMediaServer3.0.3-patch8.zip

Charlie

First, the file is Main profile so be sure you are playing it on a device that support Main profile.

Second, there must be huge distances between key frames. That is why the chunk sizes are so sporatic and so large. You should re-encode the files to have a consistent key frame interval that is a factor of the target chunk duration. Such as 2 or 5 seconds.

Charlie

The key frame interval is not going to show up in the media info. The fact that is plays in 2.2.3 does not mean that it should play. Newer versions of Wowza Server now produce playlists that are compliant with the newer versions of the Apple HLS specification. That is most likely why this stream is not playing in newer versions. We cannot go back to the less compliant code.

Again, it seems the key frame interval is not consistent. To play on iOS devices it is best that the video have a key frame interval that is a factor of target duration. If you re-encode the video with a key frame interval of 2 or 5 seconds it should be fine. You can see here that this segment is very long:

#EXTINF:1085,
media_4.ts?wowzasessionid=269234416

It is 1085 seconds long. That just won’t work for iOS devices. I know it is not a great answer but the content needs to be re-encoded with a consistent and reasonable key frame interval.

Charlie

Per the specification the #EXT-X-TARGETDURATION is set to the largest segment. This change/fix went in in Wowza Server 3. In Wowza Server 2 the #EXT-X-TARGETDURATION was set to the target chunk duration. The Wowza Server 3 method is the right way to do it. Before making this change streams were not playing properly in iOS 5.

Charlie

This may or be related, but observing some really strange behavior. The same file streams fine using Apple Live Streaming in 2.2.3 and does not stream correctly 3.0.x (no video or audio) . Tried dev patches up to 9, no luck. I also tried cupertinoCalculateCodecs and cupertinoCalculateResolution tags for HTTPStreamer. Please see the below output:

2.2.3 (works)

DEBUG server comment - MediaReaderH264.mp4ReadAheadSize: 65536
DEBUG server comment - MediaReaderH264.mp4ReadAheadTrigger: 32768
DEBUG server comment - MediaReaderH264.mp4IndexBufferSize: 16384
DEBUG server comment - MediaReaderH264.randomAccessReaderClass: com.wowza.io.DirectRandomAccessReader
DEBUG server comment - audioDuration:5132.202666666667:24000:123172864
DEBUG server comment - videoDuration:5132.168708333334:24000:123172049
DEBUG server comment - duration:5132.202666666667
DEBUG server comment - HTTPStreamerAdapterCupertinoStreamer.canHandle[vod/_definst_/sh.mp4/playlist.m3u8]: true
DEBUG server comment - HTTPStreamerAdapterCupertinoStreamer.service: vod/_definst_/sh.mp4/playlist.m3u8
INFO server comment - onPlaylist: vod/_definst_/sh.mp4/playlist.m3u8
INFO cupertino connect 269234416 -
INFO stream create sh.mp4 -
DEBUG server comment - MediaReaderH264.mp4ReadAheadSize: 65536
DEBUG server comment - MediaReaderH264.mp4ReadAheadTrigger: 32768
DEBUG server comment - MediaReaderH264.mp4IndexBufferSize: 16384
DEBUG server comment - MediaReaderH264.randomAccessReaderClass: com.wowza.io.DirectRandomAccessReader
DEBUG server comment - audioDuration:5132.202666666667:24000:123172864
DEBUG server comment - videoDuration:5132.168708333334:24000:123172049
DEBUG server comment - duration:5132.202666666667
INFO server comment - MediaReaderH264Cupertino.indexFile[vod/_definst_/sh.mp4][mp4a.40.2]: AAC Audio info: {MediaCodecIn
foAudio: codec:AAC, channels:2, frequency:24000, samplesPerFrame:1024, objectType:LC}
INFO server comment - MediaReaderH264Cupertino.indexFile[vod/_definst_/sh.mp4][avc1.77.31]: H.264 (Video may not be play
able on older iPhone and iPod touch devices where Baseline/Level 3.0 or lower is required) Video info: {MediaCodecInfoVi
deo: codec:H264, profile:Main, level:3.1, frameSize:1280x720, displaySize:1280x720, frameRate:23.980000}
application/vnd.apple.mpegurl:
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1505013,CODECS="avc1.77.31, mp4a.40.2",RESOLUTION=1280x720
playlist.m3u8?wowzasessionid=269234416
DEBUG server comment - HTTPStreamerAdapterCupertinoStreamer.canHandle[vod/_definst_/sh.mp4/playlist.m3u8]: true
DEBUG server comment - HTTPStreamerAdapterCupertinoStreamer.service: vod/_definst_/sh.mp4/playlist.m3u8?wowzasessionid=2
69234416
INFO server comment - onPlaylist: vod/_definst_/sh.mp4/playlist.m3u8?wowzasessionid=269234416
application/vnd.apple.mpegurl:
#EXTM3U
#EXT-X-TARGETDURATION:1085
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:22,
media_1.ts?wowzasessionid=269234416
#EXTINF:59,
media_2.ts?wowzasessionid=269234416
#EXTINF:295,
media_3.ts?wowzasessionid=269234416
#EXTINF:1085,
media_4.ts?wowzasessionid=269234416
#EXTINF:35,
media_5.ts?wowzasessionid=269234416
#EXTINF:236,
media_6.ts?wowzasessionid=269234416
#EXTINF:122,
media_7.ts?wowzasessionid=269234416
#EXTINF:621,
media_8.ts?wowzasessionid=269234416
#EXTINF:49,
media_9.ts?wowzasessionid=269234416
#EXTINF:29,
media_10.ts?wowzasessionid=269234416
#EXTINF:107,
media_11.ts?wowzasessionid=269234416
#EXTINF:244,
media_12.ts?wowzasessionid=269234416
#EXTINF:714,
media_13.ts?wowzasessionid=269234416
#EXTINF:11,
media_14.ts?wowzasessionid=269234416
#EXTINF:14,
media_15.ts?wowzasessionid=269234416
#EXTINF:19,
media_16.ts?wowzasessionid=269234416
#EXTINF:16,
media_17.ts?wowzasessionid=269234416
#EXTINF:12,
media_18.ts?wowzasessionid=269234416
#EXTINF:17,
media_19.ts?wowzasessionid=269234416
#EXTINF:52,
media_20.ts?wowzasessionid=269234416
#EXTINF:15,
media_21.ts?wowzasessionid=269234416
#EXTINF:232,
media_22.ts?wowzasessionid=269234416
#EXTINF:140,
media_23.ts?wowzasessionid=269234416
#EXTINF:450,
media_24.ts?wowzasessionid=269234416
#EXTINF:229,
media_25.ts?wowzasessionid=269234416
#EXTINF:112,
media_26.ts?wowzasessionid=269234416
#EXTINF:195,
media_27.ts?wowzasessionid=269234416
#EXT-X-ENDLIST
DEBUG server comment - HTTPStreamerAdapterCupertinoStreamer.canHandle[vod/_definst_/sh.mp4/media_1.ts]: true
DEBUG server comment - HTTPStreamerAdapterCupertinoStreamer.service: vod/_definst_/sh.mp4/media_1.ts?wowzasessionid=2692
34416
INFO server comment - onMediaFile: vod/_definst_/sh.mp4/media_1.ts?wowzasessionid=269234416
INFO stream play sh.mp4 -
INFO server comment - onMediaFile: contentLength:3390768
DEBUG server comment - HTTPStreamerAdapterCupertinoStreamer.canHandle[vod/_definst_/sh.mp4/media_2.ts]: true
DEBUG server comment - HTTPStreamerAdapterCupertinoStreamer.service: vod/_definst_/sh.mp4/media_2.ts?wowzasessionid=2692
34416
INFO server comment - onMediaFile: vod/_definst_/sh.mp4/media_2.ts?wowzasessionid=269234416
INFO server comment - onMediaFile: contentLength:2600416

3.0.3 (no audio or video)

DEBUG server comment - MediaReaderH264.mp4ReadAheadSize: 65536
DEBUG server comment - MediaReaderH264.mp4ReadAheadTrigger: 32768
DEBUG server comment - MediaReaderH264.mp4IndexBufferSize: 16384
DEBUG server comment - MediaReaderH264.randomAccessReaderClass: com.wowza.io.DirectRandomAccessReader
DEBUG server comment - audioDuration:5132.202666666667:24000:123172864
DEBUG server comment - videoDuration:5132.168708333334:24000:123172049
DEBUG server comment - duration:5132.202666666667
DEBUG server comment - HTTPStreamerAdapterCupertinoStreamer.canHandle[vod/_definst_/sh.mp4/playlist.m3u8]: true
DEBUG server comment - HTTPStreamerAdapterCupertinoStreamer.service: vod/_definst_/sh.mp4/playlist.m3u8
INFO server comment - onPlaylist: vod/_definst_/sh.mp4/playlist.m3u8
INFO cupertino connect 1498416291 -
INFO stream create sh.mp4 -
DEBUG server comment - MediaReaderH264.mp4ReadAheadSize: 65536
DEBUG server comment - MediaReaderH264.mp4ReadAheadTrigger: 32768
DEBUG server comment - MediaReaderH264.mp4IndexBufferSize: 16384
DEBUG server comment - MediaReaderH264.randomAccessReaderClass: com.wowza.io.DirectRandomAccessReader
DEBUG server comment - audioDuration:5132.202666666667:24000:123172864
DEBUG server comment - videoDuration:5132.168708333334:24000:123172049
DEBUG server comment - duration:5132.202666666667
INFO server comment - MediaReaderH264Cupertino.indexFile[vod/_definst_/sh.mp4][mp4a.40.2]: AAC Audio info: {MediaCodecIn
foAudio: codec:AAC, channels:2, frequency:24000, samplesPerFrame:1024, objectType:LC}
INFO server comment - MediaReaderH264Cupertino.indexFile[vod/_definst_/sh.mp4][avc1.77.31]: H.264 (Video may not be play
able on older iPhone and iPod touch devices where Baseline/Level 3.0 or lower is required) Video info: {MediaCodecInfoVi
deo: codec:H264, profile:Main, level:3.1, frameSize:1280x720, displaySize:1280x720, frameRate:23.980000}
application/vnd.apple.mpegurl:
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1505013,CODECS="avc1.77.31, mp4a.40.2",RESOLUTION=1280x720
playlist.m3u8?wowzasessionid=1498416291
DEBUG server comment - HTTPStreamerAdapterCupertinoStreamer.canHandle[vod/_definst_/sh.mp4/playlist.m3u8]: true
DEBUG server comment - HTTPStreamerAdapterCupertinoStreamer.service: vod/_definst_/sh.mp4/playlist.m3u8?wowzasessionid=1
498416291
INFO server comment - onPlaylist: vod/_definst_/sh.mp4/playlist.m3u8?wowzasessionid=1498416291
application/vnd.apple.mpegurl:
#EXTM3U
#EXT-X-TARGETDURATION:1085
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:22,
media_1.ts?wowzasessionid=1498416291
#EXTINF:59,
media_2.ts?wowzasessionid=1498416291
#EXTINF:295,
media_3.ts?wowzasessionid=1498416291
#EXTINF:1085,
media_4.ts?wowzasessionid=1498416291
#EXTINF:35,
media_5.ts?wowzasessionid=1498416291
#EXTINF:236,
media_6.ts?wowzasessionid=1498416291
#EXTINF:122,
media_7.ts?wowzasessionid=1498416291
#EXTINF:621,
media_8.ts?wowzasessionid=1498416291
#EXTINF:49,
media_9.ts?wowzasessionid=1498416291
#EXTINF:29,
media_10.ts?wowzasessionid=1498416291
#EXTINF:107,
media_11.ts?wowzasessionid=1498416291
#EXTINF:244,
media_12.ts?wowzasessionid=1498416291
#EXTINF:714,
media_13.ts?wowzasessionid=1498416291
#EXTINF:11,
media_14.ts?wowzasessionid=1498416291
#EXTINF:14,
media_15.ts?wowzasessionid=1498416291
#EXTINF:19,
media_16.ts?wowzasessionid=1498416291
#EXTINF:16,
media_17.ts?wowzasessionid=1498416291
#EXTINF:12,
media_18.ts?wowzasessionid=1498416291
#EXTINF:17,
media_19.ts?wowzasessionid=1498416291
#EXTINF:52,
media_20.ts?wowzasessionid=1498416291
#EXTINF:15,
media_21.ts?wowzasessionid=1498416291
#EXTINF:232,
media_22.ts?wowzasessionid=1498416291
#EXTINF:140,
media_23.ts?wowzasessionid=1498416291
#EXTINF:450,
media_24.ts?wowzasessionid=1498416291
#EXTINF:229,
media_25.ts?wowzasessionid=1498416291
#EXTINF:112,
media_26.ts?wowzasessionid=1498416291
#EXTINF:195,
media_27.ts?wowzasessionid=1498416291
#EXT-X-ENDLIST
DEBUG server comment - HTTPStreamerAdapterCupertinoStreamer.canHandle[vod/_definst_/sh.mp4/media_1.ts]: true
DEBUG server comment - HTTPStreamerAdapterCupertinoStreamer.service: vod/_definst_/sh.mp4/media_1.ts?wowzasessionid=1498
416291
INFO server comment - onMediaFile: vod/_definst_/sh.mp4/media_1.ts?wowzasessionid=1498416291
INFO stream play sh.mp4 -
INFO server comment - onMediaFile: contentLength:3390768
DEBUG server comment - HTTPStreamerAdapterCupertinoStreamer.canHandle[vod/_definst_/sh.mp4/media_2.ts]: true
DEBUG server comment - HTTPStreamerAdapterCupertinoStreamer.service: vod/_definst_/sh.mp4/media_2.ts?wowzasessionid=1498
416291
INFO server comment - onMediaFile: vod/_definst_/sh.mp4/media_2.ts?wowzasessionid=1498416291
INFO server comment - onMediaFile: contentLength:2600416

It seems like #EXT-X-TARGETDURATION:10 vs #EXT-X-TARGETDURATION:1085 could be the issue…

This is a serious problem as it is occurring in a live environment.

Thank you

Thanks Charlie. It plays fine using 2.2.3.

This file was encoded by one of our vendors, so I can only provide the MediaInfo output if that helps. Please see below.

Is there any way to force 3.0.x to simulate the behavior of 2.2.3?

ID                               : 1
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format profile                   : Main@L3.1
Format settings, CABAC           : Yes
Format settings, ReFrames        : 2 frames
Codec ID                         : avc1
Codec ID/Info                    : Advanced Video Coding
Duration                         : 1h 25mn
Bit rate mode                    : Variable
Bit rate                         : 1 274 Kbps
Maximum bit rate                 : 1 509 Kbps
Width                            : 1 280 pixels
Height                           : 720 pixels
Display aspect ratio             : 16:9

Thanks Charlie, this definitely makes sense (and it does work with other files). However, the part that does not quite makes sense to me is that the #EXT-X-TARGETDURATION:1085 tag for the 3.0 sample. The next three segments are 22,59 and 295 seconds and only the fourth one is 1085.

While I am not defending the encoding of this particular file, there may be another issue with the EXT-X-TARGETDURATION calculation. The only significant difference between the playlists is the EXT-X-TARGETDURATION tag, so there may be something else happening which is exacerbated by the improper encoding.

Thank you,

Greg