Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#5009 closed defect (fixed)

HLS Segmenter: Declared EXTINF duration of the last segment in the m3u8 is incorrect

Reported by: an_ffmpeg_user Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: HLS
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary. When encoding using the FFmpeg HLS output, the declared EXTINF duration of the last segment in the mediaplaylist.m3u8 is shorter than the actual duration of the last MPEG-TS file.

Unfortunately, this affects the playback on strict HLS Players that consider playback to be over when the last segment's EXTINF has expired. End credits or copyright frames do not get displayed.

It appears to be an issue with FFmpeg's generation of EXTINF duration in the m3u8 for the last segment. The duration of the last segment in the playlist should not be lower than the actual TS duration.

The FFmpeg 2.8 HLS Segmenter generates a EXT-X-VERSION:3 Playlist with integers to six decimal places. HLS Protocol version 3, Draft 5 https://tools.ietf.org/html/draft-pantos-http-live-streaming-05

#EXTINF:<duration>,<title>
"duration" is an integer or floating-point number that specifies the duration of the media file in seconds.  Integer durations SHOULD be rounded to the nearest integer.  

Floating-point durations should be accurate. If the duration is being declared to six decimal places, it should be accurate to six decimal places.

It is acknowledged that the duration of a TS can be ambiguous as there are multiple durations reported by FFprobe and MediaInfo

  • container duration
  • video duration
  • audio duration

Therefore to avoid ambiguity, the following example uses a video-only stream. FFprobe outputs of both 'container duration' and 'video duration' are included below.

How to replicate...

First, generate a 1080p30 mezzanine MP4 file to be used as a source for the test. Using testsrc input so that anyone is able to reproduce:

$ ffmpeg -f lavfi -i testsrc=duration=14:size=1920x1080:rate=30*1000/1001 -vf "drawtext=fontfile=/Library/Fonts/Verdana.ttf:timecode='00\:00\:00\:00':r=30*1000/1001:x=(w-tw)/2:y=h-(2*lh):fontcolor=white:box=1:boxcolor=0x00000099" -c:v libx264 -profile:v high -level 4.0 -x264opts "bitrate=3500:vbv-maxrate=3500:vbv-bufsize=3500" -pix_fmt yuv420p -f mp4 ./mezzanine.mp4

Inspect the duration of the mezzanine file. The mezzanine MP4 has a duration of 14.014000 seconds (due to 29.970 vs 30.00fps).

$ ffprobe -loglevel quiet -print_format flat -show_entries format=duration "./mezzanine.mp4"
format.duration="14.014000"
$ ffprobe -loglevel quiet -print_format flat -show_streams -select_streams v -show_entries stream=duration "./mezzanine.mp4"
streams.stream.0.duration="14.014000"

Now, transcode and segment the source file using the HLS output (including full FFmpeg command line output):

$ ffmpeg -i "./mezzanine.mp4" -vf "scale=1280:720" -c:v libx264 -preset medium -profile:v main -level 3.1 -x264opts "bitrate=2400:vbv-maxrate=2400:vbv-bufsize=2400:min-keyint=30:keyint=60:scenecut=0" -pix_fmt yuv420p -f hls -hls_time 6 -hls_list_size 0 -hls_segment_filename 'test_1280x720_%03d.ts' ./test_mediaplaylist_1280x720.m3u8

    ffmpeg version 2.8.1 Copyright (c) 2000-2015 the FFmpeg developers
      built with Apple LLVM version 7.0.0 (clang-700.1.76)
      configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.1_1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfontconfig --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfaac --enable-libass --enable-ffplay --enable-libssh --enable-libspeex --enable-libschroedinger --enable-libfdk-aac --enable-openssl --enable-libopus --enable-frei0r --enable-libcaca --enable-libsoxr --enable-libquvi --enable-libvidstab --enable-libx265 --enable-libwebp --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/1.5.2_1/include/openjpeg-1.5 --enable-nonfree --enable-vda
      libavutil      54. 31.100 / 54. 31.100
      libavcodec     56. 60.100 / 56. 60.100
      libavformat    56. 40.101 / 56. 40.101
      libavdevice    56.  4.100 / 56.  4.100
      libavfilter     5. 40.101 /  5. 40.101
      libavresample   2.  1.  0 /  2.  1.  0
      libswscale      3.  1.101 /  3.  1.101
      libswresample   1.  2.101 /  1.  2.101
      libpostproc    53.  3.100 / 53.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './mezzanine.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf56.40.101
      Duration: 00:00:14.01, start: 0.000000, bitrate: 394 kb/s
        Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 393 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
        Metadata:
          handler_name    : VideoHandler
    [libx264 @ 0x7f9fe181e600] using SAR=1/1
    [libx264 @ 0x7f9fe181e600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
    [libx264 @ 0x7f9fe181e600] profile Main, level 3.1
    Output #0, hls, to './test_mediaplaylist_1280x720.m3u8':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf56.40.101
        Stream #0:0(und): Video: h264 (libx264), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 2400 kb/s, 29.97 fps, 90k tbn, 29.97 tbc (default)
        Metadata:
          handler_name    : VideoHandler
          encoder         : Lavc56.60.100 libx264
    Stream mapping:
      Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    frame=  420 fps= 43 q=-1.0 Lsize=N/A time=00:00:13.94 bitrate=N/A    
    video:1275kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
    [libx264 @ 0x7f9fe181e600] frame I:7     Avg QP: 0.82  size: 24041
    [libx264 @ 0x7f9fe181e600] frame P:413   Avg QP: 1.21  size:  2754
    [libx264 @ 0x7f9fe181e600] mb I  I16..4: 89.6%  0.0% 10.4%
    [libx264 @ 0x7f9fe181e600] mb P  I16..4:  8.2%  0.0%  0.1%  P16..4:  6.6%  1.1%  0.7%  0.0%  0.0%    skip:83.4%
    [libx264 @ 0x7f9fe181e600] coded y,uvDC,uvAC intra: 1.8% 7.7% 7.6% inter: 1.4% 4.9% 4.5%
    [libx264 @ 0x7f9fe181e600] i16 v,h,dc,p: 99%  0%  0%  0%
    [libx264 @ 0x7f9fe181e600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 60% 20% 13%  3%  1%  1%  0%  1%  0%
    [libx264 @ 0x7f9fe181e600] i8c dc,h,v,p: 12%  1% 85%  1%
    [libx264 @ 0x7f9fe181e600] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0x7f9fe181e600] ref P L0: 74.9%  0.5% 17.8%  6.8%
    [libx264 @ 0x7f9fe181e600] kb/s:745.37

Now inspect the m3u8...

$ cat ./test_mediaplaylist_1280x720.m3u8 
    #EXTM3U
    #EXT-X-VERSION:3
    #EXT-X-TARGETDURATION:7
    #EXT-X-MEDIA-SEQUENCE:0
    #EXTINF:6.006000,
    test_1280x720_000.ts
    #EXTINF:6.006000,
    test_1280x720_001.ts
    #EXTINF:1.968633,
    test_1280x720_002.ts
    #EXT-X-ENDLIST

FFprobe sums the EXTINF values of the m3u8 and calculates a duration of 13.980633 not 14.014000

$ ffprobe -loglevel quiet -print_format flat -show_entries format=duration "./test_mediaplaylist_1280x720.m3u8" 
format.duration="13.980633"

Analyzing each MPEG-TS segment using FFprobe (MediaInfo also confirms FFprobe's results)

$ ffprobe -loglevel quiet -print_format flat -show_entries format=duration "./test_1280x720_000.ts"
format.duration="6.006000"
$ ffprobe -loglevel quiet -print_format flat -show_streams -select_streams v -show_entries stream=duration "./test_1280x720_000.ts"
programs.program.0.streams.stream.0.duration="6.006000"
streams.stream.0.duration="6.006000"

$ ffprobe -loglevel quiet -print_format flat -show_entries format=duration "./test_1280x720_001.ts"
format.duration="6.006000"
$ ffprobe -loglevel quiet -print_format flat -show_streams -select_streams v -show_entries stream=duration "./test_1280x720_001.ts"
programs.program.0.streams.stream.0.duration="6.006000"
streams.stream.0.duration="6.006000"

$ ffprobe -loglevel quiet -print_format flat -show_entries format=duration "./test_1280x720_002.ts"
format.duration="2.002000"
$ ffprobe -loglevel quiet -print_format flat -show_streams -select_streams v -show_entries stream=duration "./test_1280x720_002.ts"
programs.program.0.streams.stream.0.duration="2.002000"
streams.stream.0.duration="2.002000"

(6.006 + 6.006 + 2.002) = 14.014s, as expected.

But the sum of the EXTINF durations in the mediaplaylist.m3u8 is (6.006000 + 6.006000 + 1.968633) = 13.980633s. The discrepancy is caused by the duration of the last segment getting under-reported.

Although this seems a small difference within this example, we have seen quite significant differences depending on the source file. The example uses a 14s testsrc as it is the simplest way to reproduce the issue with the minimum number of segments. But the issue occurs with any source file.

The last segment's declared EXTINF duration in the m3u8 is always lower than the actual MPEG-TS duration.

Thanks!

Change History (4)

comment:1 by an_ffmpeg_user, 8 years ago

Summary: Declared EXTINF duration of the last segment in the mediaplaylist.m3u8 is shorter than the actual duration of the last MPEG-TS fileHLS Segmenter: Declared EXTINF duration of the last segment in the m3u8 is incorrect

comment:2 by an_ffmpeg_user, 7 years ago

Fixed by http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=2deafd98988871f25b0778059ee84a704372ec24

Install FFmpeg from latest build on OS X

$ brew install ffmpeg --HEAD --with-freetype --with-sdl2 --with-tools --with-fdk-aac
  1. create a mezzanine file
    $ ffmpeg -f lavfi -i testsrc=duration=14:size=1920x1080:rate=30*1000/1001 -vf "drawtext=fontfile=/Library/Fonts/Verdana.ttf:timecode='00\:00\:00\:00':r=30*1000/1001:x=(w-tw)/2:y=h-(2*lh):fontcolor=white:box=1:boxcolor=0x00000099" -c:v libx264 -profile:v high -level 4.0 -x264opts "bitrate=3500:vbv-maxrate=3500:vbv-bufsize=3500" -pix_fmt yuv420p -f mp4 ./mezzanine.mp4
    ffmpeg version N-43585-g9ea2998 Copyright (c) 2000-2017 the FFmpeg developers
      built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
      configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-9ea2998 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-nonfree --enable-vda
      libavutil      55. 44.100 / 55. 44.100
      libavcodec     57. 75.100 / 57. 75.100
      libavformat    57. 63.100 / 57. 63.100
      libavdevice    57.  2.100 / 57.  2.100
      libavfilter     6. 69.100 /  6. 69.100
      libavresample   3.  2.  0 /  3.  2.  0
      libswscale      4.  3.101 /  4.  3.101
      libswresample   2.  4.100 /  2.  4.100
      libpostproc    54.  2.100 / 54.  2.100
    Input #0, lavfi, from 'testsrc=duration=14:size=1920x1080:rate=30*1000/1001':
      Duration: N/A, start: 0.000000, bitrate: N/A
        Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 tbr, 29.97 tbn, 29.97 tbc
    File './mezzanine.mp4' already exists. Overwrite ? [y/N] y
    [libx264 @ 0x7fb03d001800] using SAR=1/1
    [libx264 @ 0x7fb03d001800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
    [libx264 @ 0x7fb03d001800] profile High, level 4.0
    [libx264 @ 0x7fb03d001800] 264 - core 148 r2728 4d5c8b0 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=cbr mbtree=1 bitrate=3500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=3500 vbv_bufsize=3500 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to './mezzanine.mp4':
      Metadata:
        encoder         : Lavf57.63.100
        Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 3500 kb/s, 29.97 fps, 30k tbn, 29.97 tbc
        Metadata:
          encoder         : Lavc57.75.100 libx264
        Side data:
          cpb: bitrate max/min/avg: 3500000/0/3500000 buffer size: 3500000 vbv_delay: -1
    Stream mapping:
      Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    frame=   17 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   31 fps= 30 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   44 fps= 29 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   47 fps= 20 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   57 fps= 20 q=18.0 size=      28kB time=00:00:00.13 bitrate=1689.8kbits/frame=   68 fps= 20 q=11.0 size=      54kB time=00:00:00.50 bitrate= 880.6kbits/frame=   78 fps= 20 q=11.0 size=      92kB time=00:00:00.83 bitrate= 906.7kbits/frame=   85 fps= 19 q=11.0 size=     120kB time=00:00:01.06 bitrate= 918.9kbits/frame=   93 fps= 19 q=11.0 size=     150kB time=00:00:01.33 bitrate= 918.9kbits/frame=  101 fps= 18 q=11.0 size=     184kB time=00:00:01.60 bitrate= 940.1kbits/frame=  113 fps= 19 q=11.0 size=     232kB time=00:00:02.00 bitrate= 947.6kbits/frame=  125 fps= 19 q=11.0 size=     279kB time=00:00:02.40 bitrate= 952.8kbits/frame=  137 fps= 19 q=11.0 size=     326kB time=00:00:02.80 bitrate= 954.0kbits/frame=  147 fps= 19 q=11.0 size=     366kB time=00:00:03.13 bitrate= 957.1kbits/frame=  157 fps= 19 q=11.0 size=     405kB time=00:00:03.47 bitrate= 957.0kbits/frame=  168 fps= 19 q=11.0 size=     448kB time=00:00:03.83 bitrate= 956.4kbits/frame=  179 fps= 19 q=11.0 size=     492kB time=00:00:04.20 bitrate= 958.0kbits/frame=  185 fps= 19 q=11.0 size=     513kB time=00:00:04.40 bitrate= 954.4kbits/frame=  194 fps= 19 q=11.0 size=     547kB time=00:00:04.70 bitrate= 952.8kbits/frame=  202 fps= 18 q=11.0 size=     578kB time=00:00:04.97 bitrate= 953.0kbits/frame=  210 fps= 18 q=11.0 size=     611kB time=00:00:05.23 bitrate= 955.9kbits/frame=  218 fps= 18 q=11.0 size=     645kB time=00:00:05.50 bitrate= 959.0kbits/frame=  226 fps= 18 q=11.0 size=     676kB time=00:00:05.77 bitrate= 959.7kbits/frame=  236 fps= 18 q=11.0 size=     713kB time=00:00:06.10 bitrate= 956.0kbits/frame=  243 fps= 18 q=11.0 size=     744kB time=00:00:06.33 bitrate= 961.0kbits/frame=  255 fps= 18 q=11.0 size=     792kB time=00:00:06.74 bitrate= 962.0kbits/frame=  267 fps= 18 q=12.0 size=     833kB time=00:00:07.14 bitrate= 955.4kbits/frame=  280 fps= 18 q=12.0 size=     864kB time=00:00:07.57 bitrate= 934.5kbits/frame=  292 fps= 18 q=13.0 size=     902kB time=00:00:07.97 bitrate= 927.0kbits/frame=  297 fps= 18 q=13.0 size=     914kB time=00:00:08.14 bitrate= 920.1kbits/frame=  307 fps= 18 q=11.0 size=     958kB time=00:00:08.47 bitrate= 926.3kbits/frame=  317 fps= 18 q=11.0 size=     989kB time=00:00:08.80 bitrate= 919.3kbits/frame=  330 fps= 18 q=11.0 size=    1039kB time=00:00:09.24 bitrate= 920.6kbits/frame=  341 fps= 18 q=11.0 size=    1085kB time=00:00:09.60 bitrate= 924.8kbits/frame=  354 fps= 18 q=11.0 size=    1133kB time=00:00:10.04 bitrate= 924.3kbits/frame=  366 fps= 18 q=11.0 size=    1180kB time=00:00:10.44 bitrate= 925.7kbits/frame=  379 fps= 19 q=11.0 size=    1230kB time=00:00:10.87 bitrate= 926.6kbits/frame=  392 fps= 19 q=11.0 size=    1283kB time=00:00:11.31 bitrate= 929.5kbits/frame=  405 fps= 19 q=11.0 size=    1335kB time=00:00:11.74 bitrate= 931.0kbits/frame=  418 fps= 19 q=11.0 size=    1387kB time=00:00:12.17 bitrate= 932.7kbits/frame=  420 fps= 18 q=-1.0 Lsize=    1627kB time=00:00:13.91 bitrate= 957.9kbits/s speed=0.596x    
    video:1621kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.355593%
    [libx264 @ 0x7fb03d001800] frame I:2     Avg QP: 1.33  size: 23156
    [libx264 @ 0x7fb03d001800] frame P:106   Avg QP: 1.93  size:  2744
    [libx264 @ 0x7fb03d001800] frame B:312   Avg QP: 2.27  size:  4237
    [libx264 @ 0x7fb03d001800] consecutive B-frames:  1.0%  0.0%  0.0% 99.0%
    [libx264 @ 0x7fb03d001800] mb I  I16..4: 95.1%  0.6%  4.3%
    [libx264 @ 0x7fb03d001800] mb P  I16..4:  1.7%  0.2%  0.3%  P16..4:  4.1%  0.3%  0.1%  0.0%  0.0%    skip:93.4%
    [libx264 @ 0x7fb03d001800] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  3.1%  0.1%  0.0%  direct: 8.7%  skip:88.1%  L0:49.4% L1:49.6% BI: 1.0%
    [libx264 @ 0x7fb03d001800] 8x8 transform intra:4.0% inter:31.6%
    [libx264 @ 0x7fb03d001800] coded y,uvDC,uvAC intra: 6.5% 21.2% 20.9% inter: 0.1% 7.2% 6.7%
    [libx264 @ 0x7fb03d001800] i16 v,h,dc,p: 96%  3%  1%  0%
    [libx264 @ 0x7fb03d001800] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 56% 13% 31%  0%  0%  0%  0%  0%  0%
    [libx264 @ 0x7fb03d001800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 57% 24%  1%  0%  0%  0%  1%  0%
    [libx264 @ 0x7fb03d001800] i8c dc,h,v,p: 52% 12% 35%  1%
    [libx264 @ 0x7fb03d001800] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0x7fb03d001800] ref P L0: 59.0%  0.3% 39.1%  1.7%
    [libx264 @ 0x7fb03d001800] ref B L0: 94.6%  5.1%  0.3%
    [libx264 @ 0x7fb03d001800] ref B L1: 97.7%  2.3%
    [libx264 @ 0x7fb03d001800] kb/s:947.21
    
  1. Inspect the duration of mezzanine file
    $ ffprobe -loglevel quiet -print_format flat -show_entries format=duration "./mezzanine.mp4"
    format.duration="14.014000"
    
    ffprobe -loglevel quiet -print_format flat -show_streams -select_streams v -show_entries stream=duration "./mezzanine.mp4"
    streams.stream.0.duration="14.014000"
    streams.stream.0.disposition.default=1
    streams.stream.0.disposition.dub=0
    streams.stream.0.disposition.original=0
    streams.stream.0.disposition.comment=0
    streams.stream.0.disposition.lyrics=0
    streams.stream.0.disposition.karaoke=0
    streams.stream.0.disposition.forced=0
    streams.stream.0.disposition.hearing_impaired=0
    streams.stream.0.disposition.visual_impaired=0
    streams.stream.0.disposition.clean_effects=0
    streams.stream.0.disposition.attached_pic=0
    streams.stream.0.disposition.timed_thumbnails=0
    streams.stream.0.tags.language="und"
    streams.stream.0.tags.handler_name="VideoHandler"
    
  1. Encode a HLS version
    $ ffmpeg -i "./mezzanine.mp4" -vf "scale=1280:720" -c:v libx264 -preset medium -profile:v main -level 3.1 -x264opts "bitrate=2400:vbv-maxrate=2400:vbv-bufsize=2400:min-keyint=30:keyint=60:scenecut=0" -pix_fmt yuv420p -f hls -hls_time 6 -hls_list_size 0 -hls_segment_filename 'test_1280x720_%03d.ts' ./test_mediaplaylist_1280x720.m3u8
    ffmpeg version N-43585-g9ea2998 Copyright (c) 2000-2017 the FFmpeg developers
      built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
      configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-9ea2998 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-nonfree --enable-vda
      libavutil      55. 44.100 / 55. 44.100
      libavcodec     57. 75.100 / 57. 75.100
      libavformat    57. 63.100 / 57. 63.100
      libavdevice    57.  2.100 / 57.  2.100
      libavfilter     6. 69.100 /  6. 69.100
      libavresample   3.  2.  0 /  3.  2.  0
      libswscale      4.  3.101 /  4.  3.101
      libswresample   2.  4.100 /  2.  4.100
      libpostproc    54.  2.100 / 54.  2.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './mezzanine.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf57.63.100
      Duration: 00:00:14.01, start: 0.000000, bitrate: 951 kb/s
        Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 947 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
        Metadata:
          handler_name    : VideoHandler
    [libx264 @ 0x7fb095019a00] using SAR=1/1
    [libx264 @ 0x7fb095019a00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
    [libx264 @ 0x7fb095019a00] profile Main, level 3.1
    Output #0, hls, to './test_mediaplaylist_1280x720.m3u8':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf57.63.100
        Stream #0:0(und): Video: h264 (libx264), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 2400 kb/s, 29.97 fps, 90k tbn, 29.97 tbc (default)
        Metadata:
          handler_name    : VideoHandler
          encoder         : Lavc57.75.100 libx264
        Side data:
          cpb: bitrate max/min/avg: 2400000/0/2400000 buffer size: 2400000 vbv_delay: -1
    Stream mapping:
      Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    frame=  420 fps= 44 q=-1.0 Lsize=N/A time=00:00:13.91 bitrate=N/A speed=1.47x    
    video:1610kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
    [libx264 @ 0x7fb095019a00] frame I:7     Avg QP: 0.43  size: 25272
    [libx264 @ 0x7fb095019a00] frame P:105   Avg QP: 0.61  size:  4410
    [libx264 @ 0x7fb095019a00] frame B:308   Avg QP: 1.83  size:  3274
    [libx264 @ 0x7fb095019a00] consecutive B-frames:  1.7%  0.0%  5.0% 93.3%
    [libx264 @ 0x7fb095019a00] mb I  I16..4: 90.7%  0.0%  9.3%
    [libx264 @ 0x7fb095019a00] mb P  I16..4:  9.0%  0.0%  0.5%  P16..4:  5.3%  1.1%  0.7%  0.0%  0.0%    skip:83.3%
    [libx264 @ 0x7fb095019a00] mb B  I16..4:  0.6%  0.0%  0.0%  B16..8:  4.2%  0.5%  0.0%  direct: 7.6%  skip:87.0%  L0:53.6% L1:43.3% BI: 3.1%
    [libx264 @ 0x7fb095019a00] coded y,uvDC,uvAC intra: 4.3% 12.0% 11.7% inter: 0.5% 9.3% 9.1%
    [libx264 @ 0x7fb095019a00] i16 v,h,dc,p: 98%  1%  1%  0%
    [libx264 @ 0x7fb095019a00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 40% 18%  2%  1%  1%  0%  1%  0%
    [libx264 @ 0x7fb095019a00] i8c dc,h,v,p: 27%  5% 66%  1%
    [libx264 @ 0x7fb095019a00] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0x7fb095019a00] ref P L0: 58.0%  0.5% 23.9% 17.6%
    [libx264 @ 0x7fb095019a00] ref B L0: 68.9%  4.1% 27.0%
    [libx264 @ 0x7fb095019a00] ref B L1: 97.4%  2.6%
    [libx264 @ 0x7fb095019a00] kb/s:941.01
    
  1. Inspect the manifest file
    $ cat ./test_mediaplaylist_1280x720.m3u8 
    #EXTM3U
    #EXT-X-VERSION:3
    #EXT-X-TARGETDURATION:7
    #EXT-X-MEDIA-SEQUENCE:0
    #EXTINF:6.006000,
    test_1280x720_000.ts
    #EXTINF:6.006000,
    test_1280x720_001.ts
    #EXTINF:2.002000,
    test_1280x720_002.ts
    #EXT-X-ENDLIST
    
  1. Inspect the duration of the file using FFprobe
    $ ffprobe -loglevel quiet -print_format flat -show_entries format=duration "./test_mediaplaylist_1280x720.m3u8"
    format.duration="14.013999"
    

comment:3 by an_ffmpeg_user, 7 years ago

Resolution: fixed
Status: newclosed
Last edited 7 years ago by an_ffmpeg_user (previous) (diff)

comment:4 by Carl Eugen Hoyos, 7 years ago

Component: ffmpegavformat
Keywords: Segment Duration removed
Version: unspecifiedgit-master
Note: See TracTickets for help on using tickets.