Understanding #EXT-X-TARGETDURATION and #EXTINF in Http Live Streaming Manifest Files (m3u8)

Asked 1 years ago, Updated 1 years ago, 108 views

In the Http Live Streaming manifest file, for example,

http://184.72.239.149/vod/smil:BigBuckBunny.smil/playlist.m3u8

in the description in
#EXT-X-TARGETDURATION: 7

and

#EXTINF:6.25,

is available.

EXT-X-TARGETDURATION may indicate the target number of seconds for each segment, but EXTINF is the actual
segment. Is it the number of seconds?Also, what is the reason for the half-hearted number of 6.25?

The purpose of the question is to conduct a live broadcast with #EXT-X-TARGETDURATION and #EXTINF in exactly 10 seconds, but somehow it stops in the middle (irregular).Actually, I was wondering if there was a clue to the solution to this half-second number.

Please let me know if you know.

hls

2022-09-29 22:17

1 Answers

According to specifications,

4.3.2.1.EXTINF

The EXTINF tag specifications the duration of a Media Segment.It applications
only to the next Media Segment.This tag is REQUIRED for each Media
Segment.

4.3.3.1.EXT-X-TARGETDURATION

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

So roughly, EXTINF indicates the real time of the segment and EXT-X-TARGETDURATION indicates the maximum real time of the segment.

Generally speaking, the video codec does not necessarily allow you to divide any video exactly at a specified time.For example, if you specify a 10-second segment, for codec or encoder reasons, the length of the segment is not 10.00000... seconds, but, for example, 10.001 seconds.
For example, if ffmpeg is used to generate a video segment, -segment_time10, the segment list is as follows:

#EXTM3U
#EXT-X-VERSION: 3
# EXT-X-MEDIA-SEQUENCE:0
# EXT-X-ALLOW-CACHE: YES
# EXT-X-TARGETDURATION: 12
# EXTINF: 10.010000,
test.000.ts
# EXTINF: 10.610600,
test.001.ts
# EXTINF: 5.343667,
test.002.ts
# EXT-X-ENDLIST

The video time in each segment is slightly before and after the specified value of 10 seconds for the above reasons.As a safety measure, ffmpeg means that EXT-X-TARGETDURATION is 12 for the specified value 10, because, as quoted, this indicates the maximum length of the segment.In contrast, EXTINF indicates the actual segment length, based on which players are supposed to retrieve/play videos.

In conclusion, if

Live broadcast with this #EXT-X-TARGETDURATION and #EXTINF in exactly 10 seconds

If is really done, that is, if the length of the segment is completely correctly divided into 10 seconds, then there is no problem with the specification.However, if you think about the segment at the end of the video, for example, this is exactly 10 seconds, only if the entire video is exactly 10 times the length.Such a system would be good, but generally, it is meaningless and conditional and troublesome to design it (or as a specification).

It stops in the middle for some reason

I think this is the cause.If EXT-X-TARGETDURATION is set to 10, each segment must be at least 10 seconds or less.However, if you specify 10 seconds and divide it, there can be segments that are repeatedly greater than 10 seconds.This means longer segments can trigger playback stalls or other errors.


2022-09-29 22:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.