3

I have this m3u8 file. #EXT-X-TARGETDURATION is 8. the #EXTINF of first segment is 6. When the avplayer switched to this m3u8, it gave the following error.

Error Domain=CoreMediaErrorDomain Code=-12312 \"Media Entry time value does not match previous playlist for MEDIA-SEQUENCE 477000: 8.000000 vs 6.000000\" UserInfo={NSDescription=Media Entry time value does not match previous playlist for MEDIA-SEQUENCE 477000: 8.000000 vs 6.000000}"

 #EXTM3U
 #EXT-X-MEDIA-SEQUENCE:477000
#EXT-X-ALLOW-CACHE:NO
    #EXT-X-VERSION:2
    #EXT-X-FAXS-CM:URI="xxxxxxxx"
    #EXT-X-KEY:METHOD=xxxxxxx
    #EXT-X-TARGETDURATION:8
    #EXTINF:6,
    477000.ts
    #EXTINF:8,
    477001.ts
    #EXTINF:8,
    477002.ts
    #EXTINF:8,
    477003.ts
    #EXTINF:8,
    477004.ts
    #EXTINF:8,
    477005.ts
    #EXTINF:8,
    477006.ts

The question is in a live playlist, must #EXT-X-TARGETDURATION and #EXTINF of each segment be equal?! I can't find any document from Apple to define this rule. In this document, https://developer.apple.com/library/ios/technotes/tn2288/_index.html
the Lie Playlist sample, they are all same.

Jigar Tarsariya
  • 3,189
  • 3
  • 14
  • 38
Victor Chen
  • 31
  • 1
  • 1
  • 3

1 Answers1

7

Short answer: No.

Wether Live or VOD, EXT-X-TARGETDURATION specifies a maximum duration for the segments in the playlist. The actual duration specified by EXTINF may be less. In the HLS draft it says:

The EXT-X-TARGETDURATION tag specifies the maximum Media Segment duration. The EXTINF duration of each Media Segment in the Playlist file, when rounded to the nearest integer, MUST be less than or equal to the target duration; longer segments can trigger playback stalls or other errors.

The way I read the error

Media Entry time value does not match previous playlist for MEDIA-SEQUENCE 477000: 8.000000 vs 6.000000

is that the EXTINF for the particular segment with sequence number 477000, 477000.ts that is, was 8.000000 in the previous playlist and is 6.000000 in the playlist just switched to. AFAIK there is no regulation that demands for those durations to be equal. Maybe the player cannot handle this for some reason.

You can test your HLS stream for conformance using Apple's MediaStreamValidator command-line tool. It will show any issues that the stream might have.

Saleh
  • 1,819
  • 1
  • 17
  • 44
jmsn
  • 990
  • 7
  • 14
  • regard to 'segments in the playlist', it was static for VOD, but it is dynamic for Live, so in the case of Live, 'segments in the playlist' is changing, thus we need to calculate the Max Duration every time playlist got updated, is this right? – http8086 Jun 03 '20 at 09:27
  • @workplaylifecycle The HLS spec actually states `The value of the EXT-X-TARGETDURATION tag in the Media Playlist MUST NOT change.` which means that you may not add segments that are longer than the current value of that tag. – jmsn Jun 05 '20 at 14:12