[FFmpeg-trac] #7798(undetermined:new): hls muxer often generates segments shorter than -hls_time

FFmpeg trac at avcodec.org
Sat Mar 16 10:08:57 EET 2019


#7798: hls muxer often generates segments shorter than -hls_time
-------------------------------------+-------------------------------------
             Reporter:  JoshuaWalsh  |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:  git-
  undetermined                       |  master
             Keywords:  hls          |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:
 I'm using ffmpeg to take realtime video data from stdin and convert it
 into an HLS live stream. The documentation says that segments will be cut
 on the next keyframe after hls_time has passed, so effectively hls_time
 should be a minimum duration for segments. However in practice, I often
 see segments shorter than hls_time.

 How to reproduce:

 This is the command line I'm currently using:

 {{{
 % ffmpeg -nostdin -i pipe:0 -map i:0x1ff -map i:0x289 -f hls
 -hls_init_time 8 -hls_time 30 -hls_list_size 5 -hls_allow_cache 0 -vf
 yadif -codec libx264 -preset veryfast -tune zerolatency -x264-params
 keyint=100:min-keyint=100 -acodec libfdk_aac -b:a 128k
 ../output/index.m3u8
 ffmpeg version N-93335-ga8c5ae4 Copyright (c) 2000-2019 the FFmpeg
 developers
 built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
 configuration: --enable-gpl --enable-libass --enable-libfreetype --enable-
 libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis
 --enable-libx264 --enable-nonfree --arch=x86_64 --cpu=znver1
 libavutil      56. 26.100 / 56. 26.100
 libavcodec     58. 47.103 / 58. 47.103
 libavformat    58. 26.101 / 58. 26.101
 libavdevice    58.  6.101 / 58.  6.101
 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
 }}}

 Note that this command accepts realtime video input on stdin, if you're
 trying to reproduce it maybe try something like
 {{{
 % ffmpeg -re -i longtestvideo.mp4 -framerate 25 -f mpegts - | ffmpeg
 -nostdin -i pipe:0 -map i:0x1ff -map i:0x289 -f hls -hls_init_time 8
 -hls_time 30 -hls_list_size 5 -hls_allow_cache 0 -vf yadif -codec libx264
 -preset veryfast -tune zerolatency -x264-params keyint=100:min-keyint=100
 -acodec libfdk_aac -b:a 128k ../output/index.m3u8
 }}}

 When I look at the generated index*.ts files, (after index5.ts, because
 index0-5 use hls_init_time instead of hls_time) the durations are between
 21 and 34 seconds.

 Also with
 {{{
 % ffmpeg -nostdin -i pipe:0 -map i:0x1ff -vf yadif -codec libx264 -preset
 veryfast -tune zerolatency -map i:0x289 -acodec libfdk_aac -b:a 128k
 -hls_init_time 5 -hls_time 5 -hls_list_size 5 -hls_allow_cache 0
 ../output/index.m3u8
 }}}
 the segment duration is sometimes less than 2 seconds.

 I have also reproduced this bug on 3.4.4-0ubuntu0.18.04.1 and n4.1.1.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/7798>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list