0

I have a source mp4 file with duration=17sec (for example). When i convert video to Apple HLS using AWS MediaConvert, i get the m3u8 file with duration 18sec . I mean #EXTINF:18 tag in m3u8. I use ABR mode. SegmentControl settings are default

    {
       "OutputGroups": [
          {
            "Name": "Apple HLS",
            "OutputGroupSettings": {
              "Type": "HLS_GROUP_SETTINGS",
              "HlsGroupSettings": {
                "SegmentLength": 10,
                "MinSegmentLength": 0,
                "TargetDurationCompatibilityMode": "LEGACY",
                "SegmentLengthControl": "GOP_MULTIPLE",
                "SegmentControl": "SEGMENTED_FILES"
              }
          }
       ]
    }

How to fix it? I tried to change different HlsGroupSettings but result remains the same

George p
  • 37
  • 3

1 Answers1

0

Thanks for your post. MediaConvert has a default setting to use whole integers for manifest durations. This means that if the source asset has even 1 extra frame of video or audio, the service will add a whole second to the segment duration. This may be why your output is appearing to be +1s longer than expected. You can change this segment duration setting to 'floating point' duration under "HLS Output Group / Avanced/ Manifest duration format". Try this and you might find the last segment is only slightly longer than expected.

You can ensure the source asset is exactly XX seconds long using the "input Clips" feature to specify a specific start + end timecode (HH:MM::SS:FF).

For the widest compatibility with streaming players we recommend using 1 second as the minimum segment duration. Very short segments (<1s) sometimes get skipped by some players or flagged by stream quality checking products. If a few extra frames of source content are found to exist, they will get added to the previous segment.

When measuring durations, be sure to check the actual media track durations and not just the file header metadata. Utilities such as ffprobe or mediainfo (use the --full flag) are helpful for this. The pts_time for each frame will indicate when it is supposed to start. The pkt_duration_time will indicate the duration of each frame.

aws-robclem
  • 324
  • 2
  • 5