Your segments may have discontinuities between them. If so you will need to enter the tag
#EXT-X-DISCONTINUITYbetween them. The HLS spec specifies that you need to mark discontinuities in the following scenarios:
- file format
- number, type, and identifiers of tracks
- timestamp sequence
See Section 126.96.36.199: https://tools.ietf.org/html/rfc8216
What it reports for segment duration is the difference between the start time stamp of this segment and the start time stamp of the next segment.
So a negative means that the time stamp jumps back.
I have duration issue too, but with invalid positive duration.
Could you please give more explanation, which time stamps are used? Is it only video frames PTSs or audio frames counts too? Should a frame be keyframe or not?