[FFmpeg-trac] #6533(avformat:reopened): Invalid EXT-X-TARGETDURATION in HLS

FFmpeg trac at avcodec.org
Thu Aug 10 12:39:08 EEST 2017


#6533: Invalid EXT-X-TARGETDURATION in HLS
-------------------------------------+------------------------------------
             Reporter:  tonn81       |                    Owner:
                 Type:  defect       |                   Status:  reopened
             Priority:  normal       |                Component:  avformat
              Version:  unspecified  |               Resolution:
             Keywords:  hls          |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+------------------------------------

Comment (by tonn81):

 OK, let me be more specific.

 Specification says this rule must be followed:

     `all {round(chunk_duration) <= EXT_X_TARGETDURATION}`

 In current implementation, we have:

     `EXT_X_TARGETDURATION = ceil(max{chunk_duration})`

     It gives result that matches the specification (part about `less`) but
 not precise.

 I suggest to have:

     `EXT_X_TARGETDURATION = round(max{chunk_duration})`

     It gives result that matches the specification (part about `equal`)
 and precise.

     Also, that aligns with the value that user provided as input to ffmpeg
 (`-hls_time`) and allows to ignore small difference that HLS segmenter
 generates (e.g. `4.02` instead of `4.0`).

 Current implementation:

 {{{
     for (en = hls->segments; en; en = en->next) {
         if (target_duration <= en->duration)
             # that would actually ceil
             target_duration = get_int_from_double(en->duration);
     }
 }}}

 Suggested implementation (pseudo-code):

 {{{
     for (en = hls->segments; en; en = en->next) {
         if (target_duration < en->duration)
             # if chunk duration is bigger than target duration -- round it
 and use it,
             # it could be also the same value as target_duration if
 rounded to lower value
             target_duration = round(en->duration);
     }
 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/6533#comment:12>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list