Opened 6 years ago
Last modified 6 years ago
#7085 new defect
MP4 HLS produce wrong m3u8 with the _init in the first segment with wrong duration
Reported by: | loki5100 | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | hls |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
When I try to do MP4 HLS segment with the instruction below
ffmpeg.exe -i "http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4" -loglevel verbose -c:a aac -b:a 128k -c:v hevc -b:v 4977k -maxrate 4977k -bufsize 7466k -x265-params "keyint=60:min-keyint=60:open-gop=0:scenecut=0" -r 483570000/16117951 -t 30 -sn -movflags faststart -preset ultrafast -pix_fmt yuv420p -hls_time 4 -hls_segment_type fmp4 -hls_list_size 0 -hls_flags single_file -hls_fmp4_init_filename C:\temp\ffmpeg\b bb_init.mp4 C:\temp\ffmpeg\bbb.m3u8 ffmpeg version N-90313-gb173e03536 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7.3.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libblur ay --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enab le-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --en able-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enabl e-libspeex --enable-libxvid --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enabl e-avisynth libavutil 56. 9.100 / 56. 9.100 libavcodec 58. 14.100 / 58. 14.100 libavformat 58. 10.100 / 58. 10.100 libavdevice 58. 2.100 / 58. 2.100 libavfilter 7. 13.100 / 7. 13.100 libswscale 5. 0.102 / 5. 0.102 libswresample 3. 0.101 / 3. 0.101 libpostproc 55. 0.100 / 55. 0.100 [h264 @ 00000088ea170dc0] Reinit context to 1920x1088, pix_fmt: yuv420p Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4': Metadata: major_brand : isom minor_version : 1 compatible_brands: isomavc1 creation_time : 2013-12-16T17:44:39.000000Z title : Big Buck Bunny, Sunflower version artist : Blender Foundation 2008, Janus Bager Kristensen 2013 comment : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net genre : Animation composer : Sacha Goedegebure Duration: 00:10:34.53, start: 0.000000, bitrate: 3481 kb/s Stream #0:0(und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 2998 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc (default) Metadata: creation_time : 2013-12-16T17:44:39.000000Z handler_name : GPAC ISO Video Handler Stream #0:1(und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, s16p, 160 kb/s (default) Metadata: creation_time : 2013-12-16T17:44:42.000000Z handler_name : GPAC ISO Audio Handler Stream #0:2(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 320 kb/s (default) Metadata: creation_time : 2013-12-16T17:44:42.000000Z handler_name : GPAC ISO Audio Handler Side data: audio service type: main Matched encoder 'libx265' for codec 'hevc'. Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265)) Stream #0:2 -> #0:1 (ac3 (native) -> aac (native)) Press [q] to stop, [?] for help [h264 @ 00000088ea990a80] Reinit context to 1920x1088, pix_fmt: yuv420p [graph 0 input from stream 0:0 @ 00000088ea1a3b80] w:1920 h:1080 pixfmt:yuv420p tb:1/30000 fr:30/1 sar:1/1 sws_param:flags=2 x265 [info]: HEVC encoder version 2.7+8-613d9f443769 x265 [info]: build info [Windows][GCC 7.3.0][64 bit] 8bit+10bit x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 x265 [info]: Main profile, Level-4 (Main tier) x265 [info]: Thread pool created using 8 threads x265 [info]: Slices : 1 x265 [info]: frame threads / pool features : 3 / wpp(34 rows) x265 [info]: Coding QT: max CU size, min CU size : 32 / 16 x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra x265 [info]: ME / range / subpel / merge : dia / 57 / 0 / 2 x265 [info]: Keyframe min / max / scenecut / bias: 60 / 60 / 0 / 5.00 x265 [info]: Lookahead / bframes / badapt : 5 / 3 / 0 x265 [info]: b-pyramid / weightp / weightb : 1 / 0 / 0 x265 [info]: References / ref-limit cu / depth : 1 / off / off x265 [info]: AQ: mode / str / qg-size / cu-tree : 1 / 0.0 / 32 / 1 x265 [info]: Rate Control / qCompress : ABR-4977 kbps / 0.60 x265 [info]: tools: rd=2 psy-rd=2.00 early-skip rskip tmvp fast-intra x265 [info]: tools: strong-intra-smoothing lslices=6 deblock *** 2 dup! [graph_1_in_0_2 @ 00000088ea98e740] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x60f [aac @ 00000088eac224c0] Using a PCE to encode channel layout [hls @ 00000088ea22d800] Opening 'C:\temp\ffmpeg\bbb_init.mp4' for writing Output #0, hls, to 'C:\temp\ffmpeg\bbb.m3u8': Metadata: major_brand : isom minor_version : 1 compatible_brands: isomavc1 composer : Sacha Goedegebure title : Big Buck Bunny, Sunflower version artist : Blender Foundation 2008, Janus Bager Kristensen 2013 comment : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net genre : Animation encoder : Lavf58.10.100 Stream #0:0(und): Video: hevc (libx265), 1 reference frame, yuv420p(progressive, left), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 4977 kb/s, 30 fps, 998795.00 t bn, 30 tbc (default) Metadata: creation_time : 2013-12-16T17:44:39.000000Z handler_name : GPAC ISO Video Handler encoder : Lavc58.14.100 libx265 Stream #0:1(und): Audio: aac (LC), 48000 Hz, 5.1(side), fltp, delay 1024, 128 kb/s (default) Metadata: creation_time : 2013-12-16T17:44:42.000000Z handler_name : GPAC ISO Audio Handler encoder : Lavc58.14.100 aac Side data: audio service type: main [hls @ 00000088ea22d800] Opening 'C:\temp\ffmpeg\bbb.m4s' for writing2 drop=0 speed=2.24x [hls @ 00000088ea22d800] Opening 'C:\temp\ffmpeg\bbb.m3u8.tmp' for writing EXT-X-MEDIA-SEQUENCE:0 [hls @ 00000088ea22d800] Opening 'C:\temp\ffmpeg\bbb.m4s' for writing2 drop=0 speed=1.85x [hls @ 00000088ea22d800] Opening 'C:\temp\ffmpeg\bbb.m3u8.tmp' for writing EXT-X-MEDIA-SEQUENCE:0 [hls @ 00000088ea22d800] Opening 'C:\temp\ffmpeg\bbb.m4s' for writing2 drop=0 speed= 1.8x [hls @ 00000088ea22d800] Opening 'C:\temp\ffmpeg\bbb.m3u8.tmp' for writing EXT-X-MEDIA-SEQUENCE:0 [hls @ 00000088ea22d800] Opening 'C:\temp\ffmpeg\bbb.m4s' for writing2 drop=0 speed=1.76x [hls @ 00000088ea22d800] Opening 'C:\temp\ffmpeg\bbb.m3u8.tmp' for writing EXT-X-MEDIA-SEQUENCE:0 [hls @ 00000088ea22d800] Opening 'C:\temp\ffmpeg\bbb.m4s' for writing2 drop=0 speed=1.77x [hls @ 00000088ea22d800] Opening 'C:\temp\ffmpeg\bbb.m3u8.tmp' for writing EXT-X-MEDIA-SEQUENCE:0 [hls @ 00000088ea22d800] Opening 'C:\temp\ffmpeg\bbb.m4s' for writing2 drop=0 speed=1.85x [hls @ 00000088ea22d800] Opening 'C:\temp\ffmpeg\bbb.m3u8.tmp' for writing EXT-X-MEDIA-SEQUENCE:0 No more output streams to write to, finishing.:29.26 bitrate=N/A dup=2 drop=0 speed=1.89x [hls @ 00000088ea22d800] Opening 'C:\temp\ffmpeg\bbb.m4s' for writing [hls @ 00000088ea22d800] Opening 'C:\temp\ffmpeg\bbb.m3u8.tmp' for writing EXT-X-MEDIA-SEQUENCE:0 [hls @ 00000088ea22d800] Opening 'C:\temp\ffmpeg\bbb.m4s' for writing [hls @ 00000088ea22d800] Opening 'C:\temp\ffmpeg\bbb.m3u8.tmp' for writing EXT-X-MEDIA-SEQUENCE:0 frame= 901 fps= 56 q=-0.0 Lsize=N/A time=00:00:30.01 bitrate=N/A dup=2 drop=0 speed=1.86x video:23439kB audio:470kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: unknown Input file #0 (http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4): Input stream #0:0 (video): 910 packets read (11573775 bytes); 901 frames decoded; Input stream #0:1 (audio): 21 packets read (10080 bytes); Input stream #0:2 (audio): 946 packets read (1210880 bytes); 946 frames decoded (1453056 samples); Total: 1877 packets (12794735 bytes) demuxed Output file #0 (C:\temp\ffmpeg\bbb.m3u8): Output stream #0:0 (video): 901 frames encoded; 901 packets muxed (24001991 bytes); Output stream #0:1 (audio): 1407 frames encoded (1440000 samples); 1408 packets muxed (481577 bytes); Total: 2309 packets (24483568 bytes) muxed x265 [info]: frame I: 16, Avg QP:19.38 kb/s: 54461.61 x265 [info]: frame P: 227, Avg QP:20.80 kb/s: 15128.22 x265 [info]: frame B: 658, Avg QP:23.70 kb/s: 2210.48 x265 [info]: consecutive B-frames: 7.4% 0.8% 5.3% 86.4% encoded 901 frames in 16.13s (55.87 fps), 6392.88 kb/s, Avg QP:22.90 [aac @ 00000088eac224c0] Qavg: 134.647
Change History (6)
comment:1 by , 6 years ago
follow-up: 5 comment:4 by , 6 years ago
in last git hls and fmp4 segment type don't work. in 3.4.2 it's was working (at least we can play the video) but very badly (this bug was also in 3.4.2)
below all the bug i found connected to fmp4 segment type
in 3.4.2: https://trac.ffmpeg.org/ticket/6888 - HLS segmenter doesn't cut .m4s files at its expected duration - (corrected in last git)
in last git: https://trac.ffmpeg.org/ticket/7022#ticket - ffmpeg with -hls_flags single_file return incorrect byterange in playlist
in last git: https://trac.ffmpeg.org/ticket/7023#ticket - mediastreamvalidator failed with "Error injecting segment data"
With 3.4.2: https://trac.ffmpeg.org/ticket/7024 - I receive "Can't deal with multiple sample timings per sample buffer" from mediaStreamValidator
in last git: https://trac.ffmpeg.org/ticket/7085 - MP4 HLS produce wrong m3u8 with the _init in the first segment with wrong duration
comment:5 by , 6 years ago
Replying to loki5100:
in last git hls and fmp4 segment type don't work. in 3.4.2 it's was working (at least we can play the video) but very badly (this bug was also in 3.4.2)
The patchset have not apply yet, i need more case to test, don't worry.
below all the bug i found connected to fmp4 segment type
in 3.4.2: https://trac.ffmpeg.org/ticket/6888 - HLS segmenter doesn't cut .m4s files at its expected duration - (corrected in last git)
in last git: https://trac.ffmpeg.org/ticket/7022#ticket - ffmpeg with -hls_flags single_file return incorrect byterange in playlist
in last git: https://trac.ffmpeg.org/ticket/7023#ticket - mediastreamvalidator failed with "Error injecting segment data"
With 3.4.2: https://trac.ffmpeg.org/ticket/7024 - I receive "Can't deal with multiple sample timings per sample buffer" from mediaStreamValidator
in last git: https://trac.ffmpeg.org/ticket/7085 - MP4 HLS produce wrong m3u8 with the _init in the first segment with wrong duration
then the resulting m3u8 is wrong because it's add the init.mp4 segment in the first segment like below :
and it's must be :
and after we discover that we miss 5.999610 (this is the duration that was set for the first segment that was the _init)