#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 stevenliu):

 Replying to [comment:4 tonn81]:
 > I would disagree with @stevenliu -- result generated by ffmpeg is not
 what is expected -- `TARGETDURATION` does not match the value given as
 `--hls_time`.
 >
 > Actually, there are two bugs in ffmpeg. Together they give this false
 result.
 >
 > Here are the bugs:
 >
 > 1. **ffmpeg generate HLS chunks with duration that does not match given
 `--hls_time`**
 >
 >    ffmpeg should generate chunks not longer than given with
 `--hls_time`. For `--hls_time 4` it generated `4.02` chunk instead of
 `4.0` or less.
 Write a full frame is better than half frame. for example, the frame
 duration is 40, the frame sequence is: IPPIPPIPP, do you mean it should
 split IP and half of next P? and leave the other half to the next segment?
 or leave the full P frame to the next segment start frame?

 >
 > 2. **ffmpeg converts chunk duration into `EXT-X-TARGETDURATION`
 incorrectly**
 >
 >    According to official HLS validator (`mediastreamvalidator`), there
 could be 25% difference between actual chunk size and value. That means we
 should not ceil the value but rather round to nearest integer (so that
 delta between maximum chunk duration and `TARGETDURATION` is minimal).
 Then `4.02` would become `4`, not `5`.
 Reference Spec:

 https://tools.ietf.org/html/draft-pantos-http-live-streaming-22#page-49

 4.3.3.1.  EXT-X-TARGETDURATION

    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.  It applies to the entire Playlist file.  Its format
    is:

    #EXT-X-TARGETDURATION:<s>

    where s is a decimal-integer indicating the target duration in
    seconds.  The EXT-X-TARGETDURATION tag is REQUIRED.

 >
 > I could file another bug report for HLS chunks generation if needed.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/6533#comment:5>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
_______________________________________________
FFmpeg-trac mailing list
FFmpeg-trac@avcodec.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-trac

Reply via email to