[FFmpeg-trac] #7798(undetermined:new): hls muxer often generates segments shorter than -hls_time

FFmpeg trac at avcodec.org
Sun Mar 17 03:02:44 EET 2019


#7798: hls muxer often generates segments shorter than -hls_time
-------------------------------------+-------------------------------------
             Reporter:  JoshuaWalsh  |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
                                     |  undetermined
              Version:  git-master   |               Resolution:
             Keywords:  hls          |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------

Comment (by stevenliu):

 Replying to [comment:4 JoshuaWalsh]:
 > With GOP and fps, this time using Windows binaries:
 >
 > {{{
 > PS D:\> ffmpeg -nostdin -i ./4minutetest.mp4 -vcodec libx264 -g 125 -r:v
 25 -preset veryfast -acodec aac -b:a 128k -hls_init_time 5 -hls_time 5
 -hls_list_size 5 -hls_allow_cache 0 ./output/index.m3u8
 > ffmpeg version N-93120-ga84af760b8 Copyright (c) 2000-2019 the FFmpeg
 developers
 >   built with gcc 8.2.1 (GCC) 20190212
 >   configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-
 fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-
 libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame
 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
 --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr
 --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack
 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2
 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-
 libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa
 --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx
 --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-
 nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
 >   libavutil      56. 26.100 / 56. 26.100
 >   libavcodec     58. 47.100 / 58. 47.100
 >   libavformat    58. 26.101 / 58. 26.101
 >   libavdevice    58.  6.101 / 58.  6.101
 >   libavfilter     7. 48.100 /  7. 48.100
 >   libswscale      5.  4.100 /  5.  4.100
 >   libswresample   3.  4.100 /  3.  4.100
 >   libpostproc    55.  4.100 / 55.  4.100
 > Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './4minutetest.mp4':
 >   Metadata:
 >     major_brand     : isom
 >     minor_version   : 512
 >     compatible_brands: isomiso2avc1mp41
 >     encoder         : Lavf57.83.100
 >   Duration: 00:04:00.02, start: 0.000000, bitrate: 5381 kb/s
 >     Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
 1920x1080 [SAR 1:1 DAR 16:9], 5033 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
 (default)
 >     Metadata:
 >       handler_name    : VideoHandler
 >     Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
 5.1, fltp, 342 kb/s (default)
 >     Metadata:
 >       handler_name    : SoundHandler
 > Stream mapping:
 >   Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
 >   Stream #0:1 -> #0:1 (aac (native) -> aac (native))
 > [libx264 @ 0000019097632080] using SAR=1/1
 > [libx264 @ 0000019097632080] using cpu capabilities: MMX2 SSE2Fast SSSE3
 SSE4.2 AVX FMA3 BMI2 AVX2
 > [libx264 @ 0000019097632080] profile High, level 4.0, 4:2:0, 8-bit
 > [libx264 @ 0000019097632080] 264 - core 157 r2935 545de2f - H.264/MPEG-4
 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html -
 options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2
 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0
 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=24
 lookahead_threads=8 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=1 keyint=125 keyint_min=12
 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=crf mbtree=1 crf=23.0
 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
 > [hls @ 0000019097a81500] Opening './output/index0.ts' for writing
 > Output #0, hls, to './output/index.m3u8':
 >   Metadata:
 >     major_brand     : isom
 >     minor_version   : 512
 >     compatible_brands: isomiso2avc1mp41
 >     encoder         : Lavf58.26.101
 >     Stream #0:0(und): Video: h264 (libx264), yuv420p, 1920x1080 [SAR 1:1
 DAR 16:9], q=-1--1, 25 fps, 90k tbn, 25 tbc (default)
 >     Metadata:
 >       handler_name    : VideoHandler
 >       encoder         : Lavc58.47.100 libx264
 >     Side data:
 >       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
 >     Stream #0:1(eng): Audio: aac (LC), 48000 Hz, 5.1, fltp, 128 kb/s
 (default)
 >     Metadata:
 >       handler_name    : SoundHandler
 >       encoder         : Lavc58.47.100 aac
 > [hls @ 0000019097a81500] Opening './output/index1.ts' for
 writingspeed=8.83x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index2.ts' for
 writingspeed=6.93x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index3.ts' for
 writingspeed=6.83x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index4.ts' for
 writingspeed=6.46x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index5.ts' for
 writingspeed=6.44x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index6.ts' for
 writingspeed=6.86x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index7.ts' for writingspeed=
 7.2x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index8.ts' for
 writingspeed=7.33x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index9.ts' for
 writingspeed=7.14x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index10.ts' for
 writingpeed=6.97x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index11.ts' for
 writingpeed=6.54x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index12.ts' for
 writingpeed=6.46x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index13.ts' for
 writingpeed=6.43x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index14.ts' for
 writingpeed=6.47x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index15.ts' for
 writingpeed=6.56x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index16.ts' for
 writingpeed=6.57x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index17.ts' for
 writingpeed=6.54x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index18.ts' for
 writingpeed=6.54x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index19.ts' for
 writingpeed=6.59x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index20.ts' for
 writingpeed=6.56x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index21.ts' for
 writingpeed=6.55x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index22.ts' for
 writingpeed=6.57x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index23.ts' for
 writingpeed=6.55x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index24.ts' for
 writingpeed=6.62x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index25.ts' for
 writingpeed=6.68x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index26.ts' for
 writingpeed=6.76x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index27.ts' for
 writingpeed=6.78x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index28.ts' for
 writingpeed=6.74x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index29.ts' for
 writingpeed=6.69x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index30.ts' for
 writingpeed=6.65x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index31.ts' for
 writingpeed=6.68x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index32.ts' for
 writingpeed=6.73x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index33.ts' for
 writingpeed=6.79x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index34.ts' for
 writingpeed=6.78x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index35.ts' for writing
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index36.ts' for
 writingpeed=6.75x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index37.ts' for
 writingpeed=6.68x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index38.ts' for
 writingpeed=6.66x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index39.ts' for
 writingpeed=6.68x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index40.ts' for
 writingpeed=6.74x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index41.ts' for
 writingpeed=6.65x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index42.ts' for
 writingpeed=6.62x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index43.ts' for
 writingpeed=6.65x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index44.ts' for
 writingpeed=6.61x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index45.ts' for
 writingpeed=6.63x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index46.ts' for
 writingpeed=6.59x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index47.ts' for
 writingpeed=6.59x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index48.ts' for
 writingpeed=6.61x
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for writing
 > [hls @ 0000019097a81500] Opening './output/index.m3u8.tmp' for
 writing=6.63x
 > frame= 6000 fps=165 q=-1.0 Lsize=N/A time=00:04:00.00 bitrate=N/A
 speed=6.62x
 > video:122822kB audio:3905kB subtitle:0kB other streams:0kB global
 headers:0kB muxing overhead: unknown
 > [libx264 @ 0000019097632080] frame I:80    Avg QP:19.91  size:115814
 > [libx264 @ 0000019097632080] frame P:2061  Avg QP:22.66  size: 36890
 > [libx264 @ 0000019097632080] frame B:3859  Avg QP:24.85  size: 10488
 > [libx264 @ 0000019097632080] consecutive B-frames:  5.3% 25.5%  4.0%
 65.1%
 > [libx264 @ 0000019097632080] mb I  I16..4: 15.3% 55.1% 29.6%
 > [libx264 @ 0000019097632080] mb P  I16..4:  9.8% 21.2%  2.5%  P16..4:
 22.8%  9.0%  4.1%  0.0%  0.0%    skip:30.7%
 > [libx264 @ 0000019097632080] mb B  I16..4:  1.6%  3.0%  0.3%  B16..8:
 13.2%  3.7%  0.5%  direct: 3.8%  skip:74.0%  L0:38.7% L1:44.9% BI:16.4%
 > [libx264 @ 0000019097632080] 8x8 transform intra:62.4% inter:56.8%
 > [libx264 @ 0000019097632080] coded y,uvDC,uvAC intra: 51.6% 35.9% 4.3%
 inter: 6.7% 7.1% 0.1%
 > [libx264 @ 0000019097632080] i16 v,h,dc,p: 35% 41% 14% 11%
 > [libx264 @ 0000019097632080] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 31% 20%
 4%  4%  4%  4%  4%  5%
 > [libx264 @ 0000019097632080] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 60%  7%
 3%  3%  3%  3%  3%  3%
 > [libx264 @ 0000019097632080] i8c dc,h,v,p: 57% 19% 20%  4%
 > [libx264 @ 0000019097632080] Weighted P-Frames: Y:3.0% UV:1.5%
 > [libx264 @ 0000019097632080] kb/s:4192.30
 > [aac @ 0000019097c40980] Qavg: 693.003
 > PS D:\> Get-Content .\output\index.m3u8
 > #EXTM3U
 > #EXT-X-VERSION:3
 > #EXT-X-ALLOW-CACHE:NO
 > #EXT-X-TARGETDURATION:6
 > #EXT-X-MEDIA-SEQUENCE:44
 > #EXTINF:5.000000,
 > index44.ts
 > #EXTINF:4.360000,
 > index45.ts
 > #EXTINF:5.520000,
 > index46.ts
 > #EXTINF:5.000000,
 > index47.ts
 > #EXTINF:4.160000,
 > index48.ts
 > #EXT-X-ENDLIST
 > }}}
 >
 > Segment duration ranges from 2 seconds to 9 seconds.
 >
 > (Also, setting GOP shouldn't be necessary based on the documentation's
 description of -hls_time)

 your output is near 5s,

 if you want segment duration at 5, you can try -hls_time witn -hls_flags
 split_by_time, but i don't suggest this option, because it maybe not split
 at keyframe.

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


More information about the FFmpeg-trac mailing list