[FFmpeg-trac] #7831(avformat:new): remuxing to HLS using "hls_segment_size" creates corrupted segments

FFmpeg trac at avcodec.org
Tue Apr 9 12:43:42 EEST 2019


#7831: remuxing to HLS using "hls_segment_size" creates corrupted segments
------------------------------------+------------------------------------
             Reporter:  barsnick    |                    Owner:
                 Type:  defect      |                   Status:  new
             Priority:  normal      |                Component:  avformat
              Version:  git-master  |               Resolution:
             Keywords:  hls         |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+------------------------------------

Comment (by stevenliu):

 Need flush buffer to file when the logic into can split and no output
 fragment mp4, Try this patch please,
 https://patchwork.ffmpeg.org/patch/12658/

 {{{
 MacBook:xxx StevenLiu$ ./ffmpeg -t 60 -f lavfi -i testsrc2=s=1280x720
 -vcodec libx264 -an -hls_list_size 0 -hls_segment_size 300000 -f hls
 badmux_encode.m3u8
 ffmpeg version N-93544-g0a347ff422 Copyright (c) 2000-2019 the FFmpeg
 developers
   built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
   configuration: --enable-libass --enable-opengl --enable-libx264
 --enable-libmp3lame --enable-gpl --enable-nonfree --prefix=/usr/local
 --enable-libtesseract --enable-libspeex --enable-libfreetype --enable-
 libfontconfig --enable-libfdk-aac --enable-videotoolbox --enable-libxml2
 --enable-librsvg --enable-libvmaf --enable-version3 --disable-avx
 --disable-avx2 --disable-avx512 --disable-sse --disable-sse2 --disable-
 sse3 --disable-sse4 --disable-sse42
   libavutil      56. 26.100 / 56. 26.100
   libavcodec     58. 48.101 / 58. 48.101
   libavformat    58. 27.100 / 58. 27.100
   libavdevice    58.  7.100 / 58.  7.100
   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, lavfi, from 'testsrc2=s=1280x720':
   Duration: N/A, start: 0.000000, bitrate: N/A
     Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720
 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
 Stream mapping:
   Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
 Press [q] to stop, [?] for help
 [libx264 @ 0x7fdaa9015600] using SAR=1/1
 [libx264 @ 0x7fdaa9015600] using cpu capabilities: MMX2 SSE2Fast SSSE3
 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
 [libx264 @ 0x7fdaa9015600] profile High, level 3.1
 [libx264 @ 0x7fdaa9015600] 264 - core 133 r2334M a3ac64b - H.264/MPEG-4
 AVC codec - Copyleft 2003-2013 - 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=crf mbtree=1 crf=23.0
 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
 [hls @ 0x7fdaa9014000] Opening 'badmux_encode0.ts' for writing
 Output #0, hls, to 'badmux_encode.m3u8':
   Metadata:
     encoder         : Lavf58.27.100
     Stream #0:0: Video: h264 (libx264), yuv420p, 1280x720 [SAR 1:1 DAR
 16:9], q=-1--1, 25 fps, 90k tbn, 25 tbc
     Metadata:
       encoder         : Lavc58.48.101 libx264
     Side data:
       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
 [hls @ 0x7fdaa9014000] Opening 'badmux_encode1.ts' for writing/A
 speed=1.77x
 [hls @ 0x7fdaa9014000] Opening 'badmux_encode.m3u8.tmp' for writing
 [hls @ 0x7fdaa9014000] Opening 'badmux_encode2.ts' for writing/A
 speed=1.93x
 [hls @ 0x7fdaa9014000] Opening 'badmux_encode.m3u8.tmp' for writing
 [hls @ 0x7fdaa9014000] Opening 'badmux_encode3.ts' for writing/A
 speed=1.98x
 [hls @ 0x7fdaa9014000] Opening 'badmux_encode.m3u8.tmp' for writing
 [hls @ 0x7fdaa9014000] Opening 'badmux_encode4.ts' for writing/A
 speed=1.89x
 [hls @ 0x7fdaa9014000] Opening 'badmux_encode.m3u8.tmp' for writing
 [hls @ 0x7fdaa9014000] Opening 'badmux_encode5.ts' for writing/A
 speed=1.78x
 [hls @ 0x7fdaa9014000] Opening 'badmux_encode.m3u8.tmp' for writing
 [hls @ 0x7fdaa9014000] Opening 'badmux_encode.m3u8.tmp' for
 writingeed=1.74x
   1 avformat/hlsenc: flush packets before update split message
 frame= 1500 fps= 43 q=-1.0 Lsize=N/A time=00:00:59.92 bitrate=N/A
 speed=1.73x
 video:19424kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: unknown
 [libx264 @ 0x7fdaa9015600] frame I:6     Avg QP:21.27  size: 28996
 [libx264 @ 0x7fdaa9015600] frame P:1105  Avg QP:27.67  size: 13855
 [libx264 @ 0x7fdaa9015600] frame B:389   Avg QP:30.29  size: 11326
 [libx264 @ 0x7fdaa9015600] consecutive B-frames: 56.0% 27.5%  2.4% 14.1%
 [libx264 @ 0x7fdaa9015600] mb I  I16..4: 88.0%  2.9%  9.1%
 [libx264 @ 0x7fdaa9015600] mb P  I16..4:  3.3%  0.6%  0.3%  P16..4:  5.3%
 4.3%  2.5%  0.0%  0.0%    skip:83.7%
 [libx264 @ 0x7fdaa9015600] mb B  I16..4:  0.8%  0.6%  0.5%  B16..8: 10.0%
 2.9%  0.8%  direct: 1.2%  skip:83.2%  L0:47.8% L1:41.6% BI:10.6%
 [libx264 @ 0x7fdaa9015600] 8x8 transform intra:15.6% inter:30.0%
 [libx264 @ 0x7fdaa9015600] coded y,uvDC,uvAC intra: 15.1% 19.9% 19.2%
 inter: 4.0% 7.5% 6.2%
 [libx264 @ 0x7fdaa9015600] i16 v,h,dc,p: 91%  7%  1%  0%
 [libx264 @ 0x7fdaa9015600] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  5% 12% 67%  6%
 2%  2%  2%  4%  2%
 [libx264 @ 0x7fdaa9015600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 19% 33%  7%
 4%  4%  5%  5%  5%
 [libx264 @ 0x7fdaa9015600] i8c dc,h,v,p: 72%  8% 19%  1%
 [libx264 @ 0x7fdaa9015600] Weighted P-Frames: Y:0.0% UV:0.0%
 [libx264 @ 0x7fdaa9015600] ref P L0: 50.7%  8.8% 23.3% 17.2%
 [libx264 @ 0x7fdaa9015600] ref B L0: 73.4% 24.0%  2.6%
 [libx264 @ 0x7fdaa9015600] ref B L1: 95.2%  4.8%
 [libx264 @ 0x7fdaa9015600] kb/s:2651.95
 MacBook:xxx StevenLiu$ ffmpeg -i badmux_encode.m3u8 -f null -
 ffmpeg version N-92801-g7efe84aebd Copyright (c) 2000-2018 the FFmpeg
 developers
   built with Apple LLVM version 9.1.0 (clang-902.0.39.2)
   configuration: --enable-libass --enable-opengl --enable-libx264
 --enable-libmp3lame --enable-gpl --enable-nonfree --prefix=/usr/local
 --enable-libtesseract --enable-libspeex --enable-libfreetype --enable-
 libfontconfig --enable-libfdk-aac --enable-videotoolbox --enable-libxml2
 --enable-librsvg --enable-libvmaf --enable-version3 --disable-avx
 --disable-avx2 --disable-avx512 --disable-sse --disable-sse2 --disable-
 sse3 --disable-sse4 --disable-sse42
   libavutil      56. 25.100 / 56. 25.100
   libavcodec     58. 42.104 / 58. 42.104
   libavformat    58. 25.100 / 58. 25.100
   libavdevice    58.  6.101 / 58.  6.101
   libavfilter     7. 46.101 /  7. 46.101
   libswscale      5.  4.100 /  5.  4.100
   libswresample   3.  4.100 /  3.  4.100
   libpostproc    55.  4.100 / 55.  4.100
 [hls,applehttp @ 0x7f9f61810000] Opening 'badmux_encode0.ts' for reading
 Input #0, hls,applehttp, from 'badmux_encode.m3u8':
   Duration: 00:01:00.00, start: 1.480000, bitrate: 0 kb/s
   Program 0
     Metadata:
       variant_bitrate : 0
     Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p,
 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
     Metadata:
       variant_bitrate : 0
 Stream mapping:
   Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native))
 Press [q] to stop, [?] for help
 Output #0, null, to 'pipe:':
   Metadata:
     encoder         : Lavf58.25.100
     Stream #0:0: Video: wrapped_avframe, yuv420p, 1280x720 [SAR 1:1 DAR
 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
     Metadata:
       variant_bitrate : 0
       encoder         : Lavc58.42.104 wrapped_avframe
 [hls,applehttp @ 0x7f9f61810000] Opening 'badmux_encode1.ts' for
 reading2.6x
 [hls,applehttp @ 0x7f9f61810000] Opening 'badmux_encode2.ts' for
 reading3.9x
 [hls,applehttp @ 0x7f9f61810000] Opening 'badmux_encode3.ts' for
 reading4.8x
 [hls,applehttp @ 0x7f9f61810000] Opening 'badmux_encode4.ts' for
 reading5.5x
 [hls,applehttp @ 0x7f9f61810000] Opening 'badmux_encode5.ts' for
 reading5.7x
 frame= 1500 fps=398 q=-0.0 Lsize=N/A time=00:01:00.00 bitrate=N/A
 speed=15.9x
 video:785kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: unknown
 }}}

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


More information about the FFmpeg-trac mailing list