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

FFmpeg trac at avcodec.org
Sun Jul 16 04:00:13 EEST 2017

#5811: live_start_index option doesn't work.
             Reporter:  smalukav    |                    Owner:
                 Type:  defect      |                   Status:  closed
             Priority:  critical    |                Component:  avformat
              Version:  git-master  |               Resolution:  worksforme
             Keywords:  hls.c       |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
Changes (by Gunnat):

 * keywords:  hls => hls.c
 * priority:  normal => critical


 just fixed the funny live_start_index bug.
 At least fix for the server and stream I am interested in.
 Turns out like this in my case

 - pls->start_seq_no,    whatever segment is streamed "now" from stream
 - pls->n_segments,      the max OLD segments the server keeps available,
 - c->live_start_index,  where ffmpeg puts the command argument I give it,

 Note, pls->n_segments is given as a positive number although it is kindo
 negative, how much cmaller one can make the segmentcounter.

 THat is, a funny thing, shld i use PLUS 1400 or MINUS 1400?

 Note, when asking for old, smaller number segments!

 (seems the existing code did the same thought-bug in both cases?? always
 did nothing?)

 So I made it accept both but always GO BACKWARDS (earlier), both in time
 and segments
   /* index If this is a LIVE stream, start live_start_index segments from
          * start or end */

         printf("\n start_seq_no %d n_segments %d live_start_index %d
 \n",pls->start_seq_no,pls->n_segments,c->live_start_index) ;

         if (c->live_start_index < 0) /* user gives neg number, 5th grade
 -/+ math*/
              /*  take max of two negative numbers, hehe*/
              /*             93abcd                     -  1438(4 hours
 back), -1400*/
             seq_gunnar = pls->start_seq_no + FFMAX((- pls->n_segments),
         else  /*  user gives pos number, kindo simpler, just subtract the
              /*                                       1400
 1438   */
             seq_gunnar = pls->start_seq_no - FFMIN(c->live_start_index,

         printf("\n start_seq_no %d n_segments %d live_start_index %d
 %d\n",pls->start_seq_no,pls->n_segments,c->live_start_index,seq_gunnar) ;

         return seq_gunnar;


 bottom line, the negative of a cpl of negative or not negative numbers is

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

More information about the FFmpeg-trac mailing list