[FFmpeg-trac] #8037(avformat:open): Incorrect HLS segment duration after 64350th frame with -hls_init_time

FFmpeg trac at avcodec.org
Fri Jul 26 05:37:59 EEST 2019


#8037: Incorrect HLS segment duration after 64350th frame with -hls_init_time
-------------------------------------+-------------------------------------
             Reporter:  DusanBrejka  |                    Owner:  stevenliu
                 Type:  defect       |                   Status:  open
             Priority:  normal       |                Component:  avformat
              Version:  git-master   |               Resolution:
             Keywords:  hls mpegts   |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------

Comment (by stevenliu):

 Replying to [comment:3 DusanBrejka]:
 > Hey Steven, unfortunately the problem still persists with this patch,
 outcome is the same.


 {{{
 [root at onvideo x264]# ./ffmpeg -v quiet -report   -f lavfi -i
 testsrc=size=5x5:rate=30:duration=2200   -g 30 -f hls -hls_time 4
 -hls_init_time 1 -start_number 540   -hls_segment_filename "hls/%03d.ts"
 -t 2160 "hls/master.m3u8"
 [root at onvideo x264]# cat hls/master.m3u8
 #EXTM3U
 #EXT-X-VERSION:3
 #EXT-X-TARGETDURATION:4
 #EXT-X-MEDIA-SEQUENCE:1080
 #EXTINF:4.000000,
 1080.ts
 #EXTINF:4.000000,
 1081.ts
 #EXTINF:4.000000,
 1082.ts
 #EXTINF:4.000000,
 1083.ts
 #EXTINF:3.000000,
 1084.ts
 #EXT-X-ENDLIST
 [root at onvideo x264]# git diff
 diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
 index 2ade672..51310fb 100644
 --- a/libavformat/hlsenc.c
 +++ b/libavformat/hlsenc.c
 @@ -2301,8 +2301,8 @@ static int hls_write_packet(AVFormatContext *s,
 AVPacket *pkt)

      if (vs->sequence - vs->nb_entries > hls->start_sequence &&
 hls->init_time > 0) {
          /* reset end_pts, hls->recording_time at end of the init hls list
 */
 -        int init_list_dur = hls->init_time * vs->nb_entries *
 AV_TIME_BASE;
 -        int after_init_list_dur = (vs->sequence - hls->start_sequence -
 vs->nb_entries ) * (hls->time * AV_TIME_BASE);
 +        int64_t init_list_dur = hls->init_time * vs->nb_entries *
 AV_TIME_BASE;
 +        int64_t after_init_list_dur = (vs->sequence - hls->start_sequence
 - vs->nb_entries ) * (hls->time * AV_TIME_BASE);
          hls->recording_time = hls->time * AV_TIME_BASE;
          end_pts = init_list_dur + after_init_list_dur ;
      }
 [root at onvideo x264]# git branch
 * master
 [root at onvideo x264]# ./ffmpeg
 ffmpeg version N-94387-g923d5c4 Copyright (c) 2000-2019 the FFmpeg
 developers
   built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-36)
   configuration: --enable-libx264 --enable-gpl
   libavutil      56. 32.100 / 56. 32.100
   libavcodec     58. 55.100 / 58. 55.100
   libavformat    58. 30.100 / 58. 30.100
   libavdevice    58.  9.100 / 58.  9.100
   libavfilter     7. 58.100 /  7. 58.100
   libswscale      5.  6.100 /  5.  6.100
   libswresample   3.  6.100 /  3.  6.100
   libpostproc    55.  6.100 / 55.  6.100
 Hyper fast Audio and Video encoder
 usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options]
 outfile}...

 Use -h to get full help or, even better, run 'man ffmpeg'
 [root at onvideo x264]#
 }}}

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


More information about the FFmpeg-trac mailing list