[FFmpeg-trac] #5811(avformat:new): live_start_index option doesn't work.

FFmpeg trac at avcodec.org
Tue Aug 30 01:35:17 EEST 2016


#5811: live_start_index option doesn't work.
----------------------------------+--------------------------------------
             Reporter:  smalukav  |                     Type:  defect
               Status:  new       |                 Priority:  normal
            Component:  avformat  |                  Version:  git-master
             Keywords:            |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |
----------------------------------+--------------------------------------
 This bug occurs when you try to copy live hls stream from start. ffmpeg
 has an option to set the segment number where it must start reading.
 {{{
 ffmpeg -h full
 -live_start_index  <int>        .D...... segment index to start live
 streams at (negative values are from the end) (from INT_MIN to INT_MAX)
 (default -3)
 }}}
 But this option is totally broken, and ffmpeg always starts at the third
 last segment.

 This happens because function select_cur_seq_no in hls.c uses
 c->live_start_index before ffmpeg sets its value to the specified by user.

 Let's look to the call stack:
 avformat_open_input --> s->iformat->read_header(s) --> hls_read_header -->
 pls->cur_seq_no = select_cur_seq_no(c, pls); --> select_cur_seq_no (here
 options was readed from HLSContext struct).

 Because all options changes should occur after avformat_open_input call,
 there's no way to change this option value.

 Looks like somebody tried to fix it and made AVFMT_FLAG_PRIV_OPT flag,
 which would eliminate s->iformat->read_header call in avformat_open_input.
 But as of today this flag isn't work (and it is unlikely will be worked in
 the future).

 How to reproduce:
 {{{
 ffmpeg -re -i some_video.mp4 -c copy -hls_time 10 -hls_list_size 0
 hls_stream/stream.m3u8 &
 sleep 100
 ffmpeg -i hls_stream/stream.m3u8 -live_start_index 0 new_video.mp4
 }}}

 Despite -live_start_index 0 option, ffmpeg dropped the first few segments.

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


More information about the FFmpeg-trac mailing list