Opened 2 years ago
Closed 23 months ago
#9483 closed defect (duplicate)
HLS muxer: inital fmp4 segment has non-zero duration even if `hls_init_time` is set to zero
Reported by: | kebl | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | unspecified | Keywords: | hls ffmpeg |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
The HLS muxer supports fragmented mp4, which by default produces an initial segment called init.mp4
. With ffmpeg from the Arch repo (version n4.4
) the command below produces an initial segment 6.08 seconds long, but with static builds of ffmpeg 4.4.1
and 4.2.2
the initial segment has no duration. hls_init_time
is set to zero so the inital segment should have no duration.
The effect the non-zero duration has is concatenating segments doesn't work properly anymore. For example with a no-duration initial segment, $ cat init.mp4 out2.m4s out3.m4s | ffplay -
will play the segments starting from out2.m4s
(12 seconds in from the input video). But with a non-zero duration it'll play the first six seconds of the input video, freeze-frame for six seconds, then play out2.m4s
. (It looks like the initial segment has the same video content as the 0th segment because $ cat init.mp4 | ffplay -
behaves identically to $ cat init.mp4 out0.m4s | ffplay -
.
% ffmpeg -i in.webm -g 24 -sc_threshold 0 -f hls -hls_init_time 0 -hls_time 6 -hls_segment_type fmp4 out.m3u8
in.webm
is https://upload.wikimedia.org/wikipedia/commons/e/e7/Slow_motion_drop.webm.
Initial segment produced by Arch ffmpeg (Duration: 00:00:06.08
):
% ffprobe init.mp4 ffprobe version n4.4 Copyright (c) 2007-2021 the FFmpeg developers built with gcc 11.1.0 (GCC) configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3 libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdevice 58. 13.100 / 58. 13.100 libavfilter 7.110.100 / 7.110.100 libswscale 5. 9.100 / 5. 9.100 libswresample 3. 9.100 / 3. 9.100 libpostproc 55. 9.100 / 55. 9.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'init.mp4': Metadata: major_brand : iso5 minor_version : 512 compatible_brands: iso5iso6mp41 encoder : Lavf58.76.100 Duration: 00:00:06.08, start: 0.166341, bitrate: 381 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 378 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0]
Initial segment produced by ffmpeg 4.4.1-static
(Duration: N/A
):
ffprobe version n4.4 Copyright (c) 2007-2021 the FFmpeg developers built with gcc 11.1.0 (GCC) configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3 libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdevice 58. 13.100 / 58. 13.100 libavfilter 7.110.100 / 7.110.100 libswscale 5. 9.100 / 5. 9.100 libswresample 3. 9.100 / 3. 9.100 libpostproc 55. 9.100 / 55. 9.100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x560481b4f240] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1280x720): unspecified pixel format Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'init.mp4': Metadata: major_brand : iso5 minor_version : 512 compatible_brands: iso5iso6mp41 encoder : Lavf58.76.100 Duration: N/A, bitrate: N/A Stream #0:0(und): Video: h264 (avc1 / 0x31637661), none, 1280x720, SAR 1:1 DAR 16:9, 12288 tbr, 12288 tbn, 24576 tbc (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0]
Lets close this one as duplicate instead. #9484