Opened 3 months ago

Closed 2 months ago

#7831 closed defect (fixed)

remuxing to HLS using "hls_segment_size" creates corrupted segments

Reported by: barsnick Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: hls
Cc: barsnick@gmx.net, blacktrash@gmx.net Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

Remuxing a perfectly decodeble input video to HLS creates a corrupted output video. Various errors are detected by ffmpeg when decoding the result.

A user reported this as a bumpy browser playback of the HLS created by ffmpeg:
http://ffmpeg.org/pipermail/ffmpeg-user/2019-April/043969.html

How to reproduce:

$ ../ffmpeg -i https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_30mb.mp4 -vcodec copy -an -hls_list_size 0 -hls_segment_size 3000000 -f hls badmux.m3u8
ffmpeg version N-93534-g208ae228fa Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (GCC)                                                                                                                                                                          
  configuration: --enable-gpl --enable-gnutls --enable-libx264 --disable-doc --disable-everything --disable-vdpau --enable-indev=lavfi --enable-muxer=null --enable-demuxer='mov,mp4,m4a,3gp,3g2,mj2,hls,mpegts' --enable-encoder='wrapped_avframe,libx264' --enable-decoder='rawvideo,h264' --enable-filter='testsrc,null,scale' --enable-muxer='mpegts,hls' --enable-protocol='file,tcp,http,tls,https' --enable-bsf=h264_mp4toannexb                                                                                                                                                                  
  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                                                                                                                                                           
Guessed Channel Layout for Input Stream #0.1 : 5.1                                                
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_30mb.mp4':
  Metadata:                                                                                                                                                                        
    major_brand     : isom                                                                                                                                                                         
    minor_version   : 512                                                   
    compatible_brands: isomiso2avc1mp41                                                                                
    creation_time   : 1970-01-01T00:00:00.000000Z                                      
    encoder         : Lavf53.24.2                                                                                                                                                                  
  Duration: 00:02:50.86, start: 0.000000, bitrate: 1474 kb/s                                                                                                                                       
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1086 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:                                                                                    
      creation_time   : 1970-01-01T00:00:00.000000Z                                                                                                                                               
      handler_name    : VideoHandler                                                            
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 5.1, 383 kb/s (default)
    Metadata:                                                               
      creation_time   : 1970-01-01T00:00:00.000000Z                                                                                                                                                
      handler_name    : SoundHandler                                                                                                                                                               
[hls @ 0x292e040] Opening 'badmux0.ts' for writing
Output #0, hls, to 'badmux.m3u8':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.27.100
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 1086 kb/s, 25 fps, 25 tbr, 90k tbn, 25 tbc (default)
    Metadata:
      creation_time   : 1970-01-01T00:00:00.000000Z
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writingtrate=N/A speed=4.97x
    Last message repeated 1 times
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writingtrate=N/A speed=12.3x
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writingtrate=N/A speed=  13x
    Last message repeated 2 times
[hls @ 0x292e040] Opening 'badmux1.ts' for writing40 bitrate=N/A speed=13.1x
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writing
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writingtrate=N/A speed=12.1x
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writingtrate=N/A speed=13.3x
    Last message repeated 2 times
[hls @ 0x292e040] Opening 'badmux2.ts' for writing32 bitrate=N/A speed=14.5x
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writing
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writingtrate=N/A speed=14.5x
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writingtrate=N/A speed=14.6x
    Last message repeated 1 times
[hls @ 0x292e040] Opening 'badmux3.ts' for writing24 bitrate=N/A speed=14.2x
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writing
    Last message repeated 1 times
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writingtrate=N/A speed=14.4x
[hls @ 0x292e040] Opening 'badmux4.ts' for writing48 bitrate=N/A speed=14.6x
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writing
    Last message repeated 1 times
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writingtrate=N/A speed=14.6x
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writingtrate=N/A speed=14.7x
    Last message repeated 3 times
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writingtrate=N/A speed=14.5x
[hls @ 0x292e040] Opening 'badmux5.ts' for writing
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writing
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writingtrate=N/A speed=14.6x
    Last message repeated 2 times
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writingtrate=N/A speed=14.4x
[hls @ 0x292e040] Opening 'badmux6.ts' for writing72 bitrate=N/A speed=14.2x
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writing
    Last message repeated 1 times
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writingtrate=N/A speed=14.1x
    Last message repeated 2 times
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writingtrate=N/A speed=13.8x
    Last message repeated 1 times
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writingtrate=N/A speed=  14x
    Last message repeated 2 times
[hls @ 0x292e040] Opening 'badmux7.ts' for writing92 bitrate=N/A speed=13.8x
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writing
    Last message repeated 1 times
[hls @ 0x292e040] Opening 'badmux.m3u8.tmp' for writingtrate=N/A speed=13.6x
frame= 4271 fps=340 q=-1.0 Lsize=N/A time=00:02:50.84 bitrate=N/A speed=13.6x
video:22650kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

(I recommend downloading the sample, the server throttles you after some attempts.)
This results in this erroneous decode:

$ ../ffmpeg -i badmux.m3u8 -f null -
ffmpeg version N-93534-g208ae228fa Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (GCC)                                   
  configuration: --enable-gpl --enable-gnutls --enable-libx264 --disable-doc --disable-everything --disable-vdpau --enable-indev=lavfi --enable-muxer=null --enable-demuxer='mov,mp4,m4a,3gp,3g2,mj
2,hls,mpegts' --enable-encoder='wrapped_avframe,libx264' --enable-decoder='rawvideo,h264' --enable-filter='testsrc,null,scale' --enable-muxer='mpegts,hls' --enable-protocol='file,tcp,http,tls,htt
ps' --enable-bsf=h264_mp4toannexb                                           
  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                   
[hls,applehttp @ 0x12cbb00] Opening 'badmux0.ts' for reading                
Input #0, hls,applehttp, from 'badmux.m3u8':
  Duration: 00:02:50.84, start: 1.400000, bitrate: 0 kb/s  
  Program 0                                                             
    Metadata:                                              
      variant_bitrate : 0                                                   
    Stream #0:0: Video: h264 (Main) ([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.27.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.48.101 wrapped_avframe                
[hls,applehttp @ 0x12cbb00] Opening 'badmux0.ts' for reading
    Last message repeated 1 times
[hls,applehttp @ 0x12cbb00] Opening 'badmux0.ts' for reading=N/A speed=26.3x
    Last message repeated 3 times
[hls,applehttp @ 0x12cbb00] Opening 'badmux1.ts' for reading
[h264 @ 0x137c740] concealing 550 DC, 550 AC, 550 MV errors in P frame=26.4x
[hls,applehttp @ 0x12cbb00] Opening 'badmux1.ts' for reading
[hls,applehttp @ 0x12cbb00] Opening 'badmux1.ts' for reading=N/A speed=  26x
    Last message repeated 2 times
[hls,applehttp @ 0x12cbb00] Opening 'badmux2.ts' for reading
badmux.m3u8: corrupt input packet in stream 0
[h264 @ 0x12df9c0] error while decoding MB 0 43, bytestream -13
[h264 @ 0x12df9c0] concealing 209 DC, 209 AC, 209 MV errors in P frame
[hls,applehttp @ 0x12cbb00] Opening 'badmux2.ts' for reading=N/A speed=28.3x
    Last message repeated 1 times
[hls,applehttp @ 0x12cbb00] Opening 'badmux2.ts' for reading=N/A speed=  28x
[hls,applehttp @ 0x12cbb00] Opening 'badmux3.ts' for reading
badmux.m3u8: corrupt input packet in stream 0
[h264 @ 0x12f1740] concealing 3282 DC, 3282 AC, 3282 MV errors in P frame
[hls,applehttp @ 0x12cbb00] Opening 'badmux3.ts' for reading
[hls,applehttp @ 0x12cbb00] Opening 'badmux3.ts' for reading=N/A speed=27.7x
[hls,applehttp @ 0x12cbb00] Opening 'badmux4.ts' for reading=N/A speed=27.6x
badmux.m3u8: corrupt input packet in stream 0
[h264 @ 0x12df9c0] concealing 2495 DC, 2495 AC, 2495 MV errors in P frame
[hls,applehttp @ 0x12cbb00] Opening 'badmux4.ts' for reading
    Last message repeated 1 times
[hls,applehttp @ 0x12cbb00] Opening 'badmux4.ts' for reading=N/A speed=  28x
    Last message repeated 4 times
[hls,applehttp @ 0x12cbb00] Opening 'badmux5.ts' for reading
badmux.m3u8: corrupt input packet in stream 0
[h264 @ 0x137c740] concealing 2582 DC, 2582 AC, 2582 MV errors in P frame
[hls,applehttp @ 0x12cbb00] Opening 'badmux5.ts' for reading=N/A speed=28.2x
    Last message repeated 3 times
[hls,applehttp @ 0x12cbb00] Opening 'badmux6.ts' for reading=N/A speed=27.8x
badmux.m3u8: corrupt input packet in stream 0
[h264 @ 0x1374500] concealing 977 DC, 977 AC, 977 MV errors in P frame
[hls,applehttp @ 0x12cbb00] Opening 'badmux6.ts' for reading
    Last message repeated 4 times
[hls,applehttp @ 0x12cbb00] Opening 'badmux6.ts' for reading=N/A speed=27.8x
    Last message repeated 3 times
[hls,applehttp @ 0x12cbb00] Opening 'badmux7.ts' for reading
badmux.m3u8: corrupt input packet in stream 0
[h264 @ 0x12f1740] concealing 2096 DC, 2096 AC, 2096 MV errors in P frame
[hls,applehttp @ 0x12cbb00] Opening 'badmux7.ts' for reading=N/A speed=27.5x
frame= 4049 fps=653 q=-0.0 Lsize=N/A time=00:02:50.84 bitrate=N/A speed=27.6x
video:2119kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

If audio is included in the mux, e.g. AAC, decoding also exposes errors.

Note that decoding of individual segments is also broken.

When omitting the option -hls_segment_size, the errors do not occur.

The issue is also reproducible with testsrc input and encoding, if I remember correctly, but the segment size may need to be chosen differently.

Change History (9)

comment:1 Changed 3 months ago by barsnick

  • Cc barsnick@gmx.net added
  • Summary changed from remuxing to HLS using "hs_segment_size" creates corrupted segments to remuxing to HLS using "hls_segment_size" creates corrupted segments

comment:2 Changed 3 months ago by barsnick

I finally managed to reproduce with testsrc:

$ ../ffmpeg -t 60 -f lavfi -i testsrc -vcodec libx264 -an -hls_list_size 0 -hls_segment_size 300000 -f hls badmux_encode.m3u8

comment:3 Changed 3 months ago by blacktrash

  • Cc blacktrash@gmx.net added

comment:4 Changed 3 months ago by cehoyos

You should probably use testsrc2...

comment:5 Changed 3 months ago by stevenliu

MacBook:dash StevenLiu$ ./ffmpeg -t 60 -f lavfi -i testsrc -vcodec libx264 -an -hls_list_size 0 -hls_segment_size 300000 -f hls badmux_encode.m3u8
ffmpeg version N-93512-g8eca42e632 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
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 48.100 / 58. 48.100
  libavformat    58. 26.101 / 58. 26.101
  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 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x7fbe8c00f400] using SAR=1/1
[libx264 @ 0x7fbe8c00f400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0x7fbe8c00f400] profile High 4:4:4 Predictive, level 1.3, 4:4:4 8-bit
[libx264 @ 0x7fbe8c00f400] 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=4 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 @ 0x7fbe8c00de00] Opening 'badmux_encode0.ts' for writing
Output #0, hls, to 'badmux_encode.m3u8':
  Metadata:
    encoder         : Lavf58.26.101
    Stream #0:0: Video: h264 (libx264), yuv444p, 320x240 [SAR 1:1 DAR 4:3], q=-1--1, 25 fps, 90k tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.48.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
[hls @ 0x7fbe8c00de00] Opening 'badmux_encode.m3u8.tmp' for writing
[hls @ 0x7fbe8c00de00] Opening 'badmux_encode.m3u8.tmp' for writingeed=19.9x
[hls @ 0x7fbe8c00de00] Opening 'badmux_encode.m3u8.tmp' for writingeed=23.5x
[hls @ 0x7fbe8c00de00] Opening 'badmux_encode1.ts' for writing/A speed=24.7x
[hls @ 0x7fbe8c00de00] Opening 'badmux_encode.m3u8.tmp' for writing
    Last message repeated 1 times
[hls @ 0x7fbe8c00de00] Opening 'badmux_encode.m3u8.tmp' for writingeed=25.3x
frame= 1500 fps=644 q=-1.0 Lsize=N/A time=00:00:59.92 bitrate=N/A speed=25.7x
video:267kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0x7fbe8c00f400] frame I:6     Avg QP:20.34  size:  3299
[libx264 @ 0x7fbe8c00f400] frame P:453   Avg QP:14.64  size:   444
[libx264 @ 0x7fbe8c00f400] frame B:1041  Avg QP:14.17  size:    50
[libx264 @ 0x7fbe8c00f400] consecutive B-frames:  7.3%  0.1%  0.8% 91.7%
[libx264 @ 0x7fbe8c00f400] mb I  I16..4: 48.4% 21.8% 29.8%
[libx264 @ 0x7fbe8c00f400] mb P  I16..4:  1.8%  1.5%  0.8%  P16..4:  7.3%  3.7%  2.5%  0.0%  0.0%    skip:82.3%
[libx264 @ 0x7fbe8c00f400] mb B  I16..4:  0.2%  0.1%  0.0%  B16..8:  4.1%  0.1%  0.0%  direct: 0.1%  skip:95.5%  L0:49.0% L1:46.6% BI: 4.3%
[libx264 @ 0x7fbe8c00f400] 8x8 transform intra:33.9% inter:40.5%
[libx264 @ 0x7fbe8c00f400] coded y,u,v intra: 10.0% 10.5% 9.0% inter: 0.8% 0.8% 0.7%
[libx264 @ 0x7fbe8c00f400] i16 v,h,dc,p: 52% 29%  3% 16%
[libx264 @ 0x7fbe8c00f400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 65%  4% 31%  0%  0%  0%  0%  0%  0%
[libx264 @ 0x7fbe8c00f400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 56% 11%  1%  1%  1%  0%  1%  0%
[libx264 @ 0x7fbe8c00f400] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7fbe8c00f400] ref P L0: 68.8%  6.7% 20.2%  4.3%
[libx264 @ 0x7fbe8c00f400] ref B L0: 58.5% 37.2%  4.3%
[libx264 @ 0x7fbe8c00f400] ref B L1: 97.1%  2.9%
[libx264 @ 0x7fbe8c00f400] kb/s:36.43
MacBook:dash StevenLiu$ ./ffmpeg -i badmux_encode.m3u8 -f null -
ffmpeg version N-93512-g8eca42e632 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
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 48.100 / 58. 48.100
  libavformat    58. 26.101 / 58. 26.101
  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
[hls,applehttp @ 0x7fe90d00aa00] 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 4:4:4 Predictive) ([27][0][0][0] / 0x001B), yuv444p, 320x240 [SAR 1:1 DAR 4:3], 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.26.101
    Stream #0:0: Video: wrapped_avframe, yuv444p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      variant_bitrate : 0
      encoder         : Lavc58.48.100 wrapped_avframe
[hls,applehttp @ 0x7fe90d00aa00] Opening 'badmux_encode0.ts' for reading
    Last message repeated 2 times
[hls,applehttp @ 0x7fe90d00aa00] Opening 'badmux_encode1.ts' for reading
    Last message repeated 1 times
frame= 1323 fps=0.0 q=-0.0 Lsize=N/A time=00:01:00.00 bitrate=N/A speed= 204x
video:693kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
MacBook:dash StevenLiu$

comment:6 Changed 3 months ago by stevenliu

MacBook:dash StevenLiu$ ./ffmpeg -t 60 -f lavfi -i testsrc=s=1280x720 -vcodec libx264 -an -hls_list_size 0 -hls_segment_size 300000 -f hls badmux_encode.m3u8
ffmpeg version N-93512-g8eca42e632 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
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 48.100 / 58. 48.100
  libavformat    58. 26.101 / 58. 26.101
  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 'testsrc=s=1280x720':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 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 @ 0x7fb55600ca00] using SAR=1/1
[libx264 @ 0x7fb55600ca00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0x7fb55600ca00] profile High 4:4:4 Predictive, level 3.1, 4:4:4 8-bit
[libx264 @ 0x7fb55600ca00] 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=4 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 @ 0x7fb55600ae00] Opening 'badmux_encode0.ts' for writing
Output #0, hls, to 'badmux_encode.m3u8':
  Metadata:
    encoder         : Lavf58.26.101
    Stream #0:0: Video: h264 (libx264), yuv444p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 90k tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.48.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
[hls @ 0x7fb55600ae00] Opening 'badmux_encode.m3u8.tmp' for writingeed=1.99x
[hls @ 0x7fb55600ae00] Opening 'badmux_encode1.ts' for writing/A speed=2.03x
[hls @ 0x7fb55600ae00] Opening 'badmux_encode.m3u8.tmp' for writing
[hls @ 0x7fb55600ae00] Opening 'badmux_encode.m3u8.tmp' for writingeed=2.11x
[hls @ 0x7fb55600ae00] Opening 'badmux_encode2.ts' for writing/A speed=2.13x
[hls @ 0x7fb55600ae00] Opening 'badmux_encode.m3u8.tmp' for writing
[hls @ 0x7fb55600ae00] Opening 'badmux_encode.m3u8.tmp' for writingeed=2.16x
[hls @ 0x7fb55600ae00] Opening 'badmux_encode.m3u8.tmp' for writingeed=2.17x
frame= 1500 fps= 55 q=-1.0 Lsize=N/A time=00:00:59.92 bitrate=N/A speed= 2.2x
video:905kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0x7fb55600ca00] frame I:6     Avg QP:15.82  size:  7870
[libx264 @ 0x7fb55600ca00] frame P:1494  Avg QP:15.88  size:   588
[libx264 @ 0x7fb55600ca00] mb I  I16..4: 67.9% 27.6%  4.5%
[libx264 @ 0x7fb55600ca00] mb P  I16..4:  2.7%  0.4%  0.0%  P16..4:  4.5%  0.3%  0.0%  0.0%  0.0%    skip:92.0%
[libx264 @ 0x7fb55600ca00] 8x8 transform intra:14.5% inter:79.9%
[libx264 @ 0x7fb55600ca00] coded y,u,v intra: 1.0% 0.8% 0.9% inter: 0.1% 0.2% 0.1%
[libx264 @ 0x7fb55600ca00] i16 v,h,dc,p: 76% 18%  0%  5%
[libx264 @ 0x7fb55600ca00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 70%  9% 20%  0%  0%  0%  0%  0%  0%
[libx264 @ 0x7fb55600ca00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 49% 32%  1%  0%  1%  0%  1%  1%
[libx264 @ 0x7fb55600ca00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7fb55600ca00] ref P L0: 60.1%  1.2% 28.4% 10.3%
[libx264 @ 0x7fb55600ca00] kb/s:123.53
MacBook:dash StevenLiu$ ./ffmpeg -i badmux_encode.m3u8 -f null -
ffmpeg version N-93512-g8eca42e632 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
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 48.100 / 58. 48.100
  libavformat    58. 26.101 / 58. 26.101
  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
[hls,applehttp @ 0x7fde85000000] 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 4:4:4 Predictive) ([27][0][0][0] / 0x001B), yuv444p, 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.26.101
    Stream #0:0: Video: wrapped_avframe, yuv444p, 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.48.100 wrapped_avframe
[hls,applehttp @ 0x7fde85000000] Opening 'badmux_encode0.ts' for reading
[hls,applehttp @ 0x7fde85000000] Opening 'badmux_encode1.ts' for reading5.5x
[h264 @ 0x7fde85811800] error while decoding MB 75 33, bytestream -5
[h264 @ 0x7fde85811800] concealing 934 DC, 934 AC, 934 MV errors in P frame
[hls,applehttp @ 0x7fde85000000] Opening 'badmux_encode1.ts' for reading
[hls,applehttp @ 0x7fde85000000] Opening 'badmux_encode2.ts' for reading
[h264 @ 0x7fde8580e800] concealing 865 DC, 865 AC, 865 MV errors in P frame
[hls,applehttp @ 0x7fde85000000] Opening 'badmux_encode2.ts' for reading 40x
frame= 1158 fps=683 q=-0.0 Lsize=N/A time=00:01:00.00 bitrate=N/A speed=35.4x
video:606kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
MacBook:dash StevenLiu$

reproduced.

comment:7 Changed 3 months ago by stevenliu

bug from commit: db9e87dd8c1ce11d37edc16f9380ee8dee68891b

let me think how to fix.

comment:8 Changed 3 months ago 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

comment:9 Changed 2 months ago by stevenliu

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.