[FFmpeg-trac] #9484(undetermined:new): HLS muxer: inital fmp4 segment has non-zero duration even if `hls_init_time` is set to zero

FFmpeg trac at avcodec.org
Sun Oct 31 12:30:13 EET 2021


#9484: HLS muxer: inital fmp4 segment has non-zero duration even if
`hls_init_time` is set to zero
-------------------------------------+-------------------------------------
             Reporter:  kebl         |                    Owner:  (none)
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
                                     |  undetermined
              Version:  unspecified  |               Resolution:
             Keywords:  hls ffmpeg   |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Comment (by Steven Liu):

 The option named hls_init_time is not be used set init.mp4 duration, it is
 used for hls live streaming first window list size segments duration time.
 the init.mp4 is only storage mp4 header,  will not storage video or audio
 data.
 you can read init.mp4 first to build mp4 header and read fragments to on
 file.



 {{{
 ./ffmpeg -f lavfi -i testsrc2=s=176x144:d=60:r=12 -g 24 -sc_threshold 0 -f
 hls -hls_time 6 -hls_segment_type fmp4 -hls_init_time 0 out.m3u8
 }}}


 split fragment 6s per fragment.
 there should 5 fragments in out.m3u8

 {{{
 (base) liuqideMacBook-Pro:build liuqi$ cat out.m3u8
 #EXTM3U
 #EXT-X-VERSION:7
 #EXT-X-TARGETDURATION:6
 #EXT-X-MEDIA-SEQUENCE:5
 #EXT-X-MAP:URI="init.mp4"
 #EXTINF:6.000000,
 out5.m4s
 #EXTINF:6.000000,
 out6.m4s
 #EXTINF:6.000000,
 out7.m4s
 #EXTINF:6.000000,
 out8.m4s
 #EXTINF:6.000000,
 out9.m4s
 #EXT-X-ENDLIST
 (base) liuqideMacBook-Pro:build liuqi$
 }}}


 {{{
 cat init.mp4 out2.m4s out3.m4s | ffplay -
 }}}

 This command should play from 12s.


 the sequence from 0.


 {{{
 (base) liuqideMacBook-Pro:build liuqi$ ./ffmpeg -f lavfi -i
 testsrc2=s=176x144:d=60:r=12 -g 24 -sc_threshold 0 -f hls -hls_time 6
 -hls_segment_type fmp4 -hls_init_time 0 -hls_list_size 0 out.m3u8
 ffmpeg version N-104454-gd92fdc7144 Copyright (c) 2000-2021 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
 --samples=/Users/liuqi/multimedia/fate-suite/ --enable-libopencv
   libavutil      57.  7.100 / 57.  7.100
   libavcodec     59. 12.100 / 59. 12.100
   libavformat    59.  8.100 / 59.  8.100
   libavdevice    59.  0.101 / 59.  0.101
   libavfilter     8. 16.100 /  8. 16.100
   libswscale      6.  1.100 /  6.  1.100
   libswresample   4.  0.100 /  4.  0.100
   libpostproc    56.  0.100 / 56.  0.100
 Input #0, lavfi, from 'testsrc2=s=176x144:d=60:r=12':
   Duration: N/A, start: 0.000000, bitrate: N/A
   Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 176x144 [SAR
 1:1 DAR 11:9], 12 tbr, 12 tbn
 Stream mapping:
   Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
 Press [q] to stop, [?] for help
 [libx264 @ 0x7fb6335157c0] using SAR=1/1
 [libx264 @ 0x7fb6335157c0] using cpu capabilities: MMX2 SSE2Fast SSSE3
 SSE4.2 AVX
 [libx264 @ 0x7fb6335157c0] profile High, level 1.0
 [libx264 @ 0x7fb6335157c0] 264 - core 148 r2694 3b70645 - 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=4
 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=24 keyint_min=2
 scenecut=0 intra_refresh=0 rc_lookahead=24 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 @ 0x7fb633514b80] Opening 'init.mp4' for writing
 Output #0, hls, to 'out.m3u8':
   Metadata:
     encoder         : Lavf59.8.100
   Stream #0:0: Video: h264, yuv420p(progressive), 176x144 [SAR 1:1 DAR
 11:9], q=2-31, 12 fps, 12288 tbn
     Metadata:
       encoder         : Lavc59.12.100 libx264
     Side data:
       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
 [hls @ 0x7fb633514b80] Opening 'out0.m4s' for writingitrate=N/A speed=
 0x
 [hls @ 0x7fb633514b80] Opening 'out.m3u8.tmp' for writing
 [hls @ 0x7fb633514b80] Opening 'out1.m4s' for writing
 [hls @ 0x7fb633514b80] Opening 'out.m3u8.tmp' for writing
 [hls @ 0x7fb633514b80] Opening 'out2.m4s' for writing
 [hls @ 0x7fb633514b80] Opening 'out.m3u8.tmp' for writing
 [hls @ 0x7fb633514b80] Opening 'out3.m4s' for writing
 [hls @ 0x7fb633514b80] Opening 'out.m3u8.tmp' for writing
 [hls @ 0x7fb633514b80] Opening 'out4.m4s' for writing
 [hls @ 0x7fb633514b80] Opening 'out.m3u8.tmp' for writing
 [hls @ 0x7fb633514b80] Opening 'out5.m4s' for writingbitrate=N/A
 speed=68.8x
 [hls @ 0x7fb633514b80] Opening 'out.m3u8.tmp' for writing
 [hls @ 0x7fb633514b80] Opening 'out6.m4s' for writing
 [hls @ 0x7fb633514b80] Opening 'out.m3u8.tmp' for writing
 [hls @ 0x7fb633514b80] Opening 'out7.m4s' for writing
 [hls @ 0x7fb633514b80] Opening 'out.m3u8.tmp' for writing
 [hls @ 0x7fb633514b80] Opening 'out8.m4s' for writing
 [hls @ 0x7fb633514b80] Opening 'out.m3u8.tmp' for writing
 [hls @ 0x7fb633514b80] Opening 'out9.m4s' for writing
 [hls @ 0x7fb633514b80] Opening 'out.m3u8.tmp' for writing
 frame=  720 fps=0.0 q=-1.0 Lsize=N/A time=00:00:59.83 bitrate=N/A
 speed=68.9x
 video:875kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: unknown
 [libx264 @ 0x7fb6335157c0] frame I:30    Avg QP:18.06  size:  4103
 [libx264 @ 0x7fb6335157c0] frame P:209   Avg QP:25.75  size:  1640
 [libx264 @ 0x7fb6335157c0] frame B:481   Avg QP:29.38  size:   893
 [libx264 @ 0x7fb6335157c0] consecutive B-frames:  6.1%  7.2% 21.7% 65.0%
 [libx264 @ 0x7fb6335157c0] mb I  I16..4: 36.2% 11.1% 52.7%
 [libx264 @ 0x7fb6335157c0] mb P  I16..4:  4.7%  4.1%  5.1%  P16..4: 19.8%
 15.2% 12.3%  0.0%  0.0%    skip:38.7%
 [libx264 @ 0x7fb6335157c0] mb B  I16..4:  0.8%  0.3%  0.6%  B16..8: 27.6%
 15.3%  7.0%  direct: 4.1%  skip:44.2%  L0:48.1% L1:44.6% BI: 7.3%
 [libx264 @ 0x7fb6335157c0] 8x8 transform intra:19.8% inter:20.7%
 [libx264 @ 0x7fb6335157c0] coded y,uvDC,uvAC intra: 28.7% 58.7% 50.6%
 inter: 13.2% 31.2% 27.1%
 [libx264 @ 0x7fb6335157c0] i16 v,h,dc,p: 79% 15%  6%  0%
 [libx264 @ 0x7fb6335157c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16%  7% 76%  0%
 0%  0%  0%  0%  0%
 [libx264 @ 0x7fb6335157c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 48% 24% 21%  1%
 1%  1%  2%  2%  2%
 [libx264 @ 0x7fb6335157c0] i8c dc,h,v,p: 42% 19% 37%  3%
 [libx264 @ 0x7fb6335157c0] Weighted P-Frames: Y:0.0% UV:0.0%
 [libx264 @ 0x7fb6335157c0] ref P L0: 58.9%  7.8% 17.0% 16.2%
 [libx264 @ 0x7fb6335157c0] ref B L0: 80.9% 15.4%  3.7%
 [libx264 @ 0x7fb6335157c0] ref B L1: 93.1%  6.9%
 [libx264 @ 0x7fb6335157c0] kb/s:119.36
 (base) liuqideMacBook-Pro:build liuqi$
 }}}


 it's ok, or am i misunderstand some things?
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9484#comment:1>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list