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

FFmpeg trac at avcodec.org
Sat Mar 16 16:20:21 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):

 you should set the GOP and fps for the video codec: -g 125 -r:v 25  125/25
 = 5s,   every 5 seconds preset a keyframe, and the hls will split the
 segment by the keyframe. looks like the bellow.

 {{{
 liuqideMacBook-Pro:ffmpeg liuqi$ ffmpeg -nostdin -f lavfi -i anullsrc -f
 lavfi -i nullsrc -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 -t 60 ./output/index.m3u8
 ffmpeg version N-92522-g370b8bd847 Copyright (c) 2000-2018 the FFmpeg
 developers
   built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
   configuration: --enable-fontconfig --enable-gpl --enable-libass
 --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-
 libspeex --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-
 version3 --enable-nonfree --enable-videotoolbox --enable-libxml2
   libavutil      56. 24.101 / 56. 24.101
   libavcodec     58. 40.100 / 58. 40.100
   libavformat    58. 23.100 / 58. 23.100
   libavdevice    58.  6.100 / 58.  6.100
   libavfilter     7. 46.100 /  7. 46.100
   libswscale      5.  4.100 /  5.  4.100
   libswresample   3.  4.100 /  3.  4.100
   libpostproc    55.  4.100 / 55.  4.100
 Input #0, lavfi, from 'anullsrc':
   Duration: N/A, start: 0.000000, bitrate: 705 kb/s
     Stream #0:0: Audio: pcm_u8, 44100 Hz, stereo, u8, 705 kb/s
 Input #1, lavfi, from 'nullsrc':
   Duration: N/A, start: 0.000000, bitrate: N/A
     Stream #1:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240
 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
 Stream mapping:
   Stream #1:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
   Stream #0:0 -> #0:1 (pcm_u8 (native) -> aac (native))
 [libx264 @ 0x7f988583e200] using SAR=1/1
 [libx264 @ 0x7f988583e200] using cpu capabilities: MMX2 SSE2Fast SSSE3
 SSE4.2 AVX
 [libx264 @ 0x7f988583e200] profile High, level 1.3
 [libx264 @ 0x7f988583e200] 264 - core 148 r2694 3b70645 - H.264/MPEG-4 AVC
 codec - Copyleft 2003-2016 - 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=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=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 @ 0x7f988583dc00] Opening './output/index0.ts' for writing
 Output #0, hls, to './output/index.m3u8':
   Metadata:
     encoder         : Lavf58.23.100
     Stream #0:0: Video: h264 (libx264), yuv420p(progressive), 320x240 [SAR
 1:1 DAR 4:3], q=-1--1, 25 fps, 90k tbn, 25 tbc
     Metadata:
       encoder         : Lavc58.40.100 libx264
     Side data:
       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
     Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s
     Metadata:
       encoder         : Lavc58.40.100 aac
 [hls @ 0x7f988583dc00] Opening './output/index1.ts' for writing
 [hls @ 0x7f988583dc00] Cannot use rename on non file protocol, this may
 lead to races and temporary partial files
 [hls @ 0x7f988583dc00] Opening './output/index2.ts' for writing
 [hls @ 0x7f988583dc00] Opening './output/index3.ts' for writing
 [hls @ 0x7f988583dc00] Opening './output/index4.ts' for writing
 [hls @ 0x7f988583dc00] Opening './output/index5.ts' for writing
 [hls @ 0x7f988583dc00] Opening './output/index6.ts' for writing
 [hls @ 0x7f988583dc00] Opening './output/index7.ts' for writing
 [hls @ 0x7f988583dc00] Opening './output/index8.ts' for writingA
 speed=71.4x
 [hls @ 0x7f988583dc00] Opening './output/index9.ts' for writing
 [hls @ 0x7f988583dc00] Opening './output/index10.ts' for writing
 [hls @ 0x7f988583dc00] Opening './output/index11.ts' for writing
 frame= 1500 fps=0.0 q=-1.0 Lsize=N/A time=00:01:00.00 bitrate=N/A
 speed=72.4x
 video:24kB audio:15kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: unknown
 [libx264 @ 0x7f988583e200] frame I:12    Avg QP: 7.25  size:    75
 [libx264 @ 0x7f988583e200] frame P:372   Avg QP:10.01  size:    18
 [libx264 @ 0x7f988583e200] frame B:1116  Avg QP:12.68  size:    15
 [libx264 @ 0x7f988583e200] consecutive B-frames:  0.8%  0.0%  0.0% 99.2%
 [libx264 @ 0x7f988583e200] mb I  I16..4: 99.7%  0.0%  0.3%
 [libx264 @ 0x7f988583e200] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.0%
 0.0%  0.0%  0.0%  0.0%    skip:100.0%
 [libx264 @ 0x7f988583e200] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.0%
 0.0%  0.0%  direct: 0.0%  skip:100.0%
 [libx264 @ 0x7f988583e200] 8x8 transform intra:0.0%
 [libx264 @ 0x7f988583e200] coded y,uvDC,uvAC intra: 0.1% 0.3% 0.0% inter:
 0.0% 0.0% 0.0%
 [libx264 @ 0x7f988583e200] i16 v,h,dc,p: 94%  0%  6%  0%
 [libx264 @ 0x7f988583e200] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  0%  0% 100%  0%
 0%  0%  0%  0%  0%
 [libx264 @ 0x7f988583e200] i8c dc,h,v,p: 100%  0%  0%  0%
 [libx264 @ 0x7f988583e200] Weighted P-Frames: Y:0.0% UV:0.0%
 [libx264 @ 0x7f988583e200] kb/s:3.19
 [aac @ 0x7f988583fa00] Qavg: 65536.000
 liuqideMacBook-Pro:ffmpeg liuqi$ cat output/index.m3u8
 #EXTM3U
 #EXT-X-VERSION:3
 #EXT-X-ALLOW-CACHE:NO
 #EXT-X-TARGETDURATION:5
 #EXT-X-MEDIA-SEQUENCE:7
 #EXTINF:5.000000,
 index7.ts
 #EXTINF:5.000000,
 index8.ts
 #EXTINF:5.000000,
 index9.ts
 #EXTINF:5.000000,
 index10.ts
 #EXTINF:5.000000,
 index11.ts
 #EXT-X-ENDLIST
 liuqideMacBook-Pro:ffmpeg liuqi$ ffmpeg -i output/index.m3u8
 ffmpeg version N-92522-g370b8bd847 Copyright (c) 2000-2018 the FFmpeg
 developers
   built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
   configuration: --enable-fontconfig --enable-gpl --enable-libass
 --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-
 libspeex --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-
 version3 --enable-nonfree --enable-videotoolbox --enable-libxml2
   libavutil      56. 24.101 / 56. 24.101
   libavcodec     58. 40.100 / 58. 40.100
   libavformat    58. 23.100 / 58. 23.100
   libavdevice    58.  6.100 / 58.  6.100
   libavfilter     7. 46.100 /  7. 46.100
   libswscale      5.  4.100 /  5.  4.100
   libswresample   3.  4.100 /  3.  4.100
   libpostproc    55.  4.100 / 55.  4.100
 [hls,applehttp @ 0x7fbf07002400] Opening 'output/index7.ts' for reading
 Input #0, hls,applehttp, from 'output/index.m3u8':
   Duration: 00:00:25.00, start: 36.402811, bitrate: 0 kb/s
   Program 0
     Metadata:
       variant_bitrate : 0
     Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p,
 320x240 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
     Metadata:
       variant_bitrate : 0
     Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz,
 stereo, fltp
     Metadata:
       variant_bitrate : 0
 At least one output file must be specified
 liuqideMacBook-Pro:ffmpeg liuqi$
 }}}

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


More information about the FFmpeg-trac mailing list