[FFmpeg-trac] #271(undetermined:new): regression with seeking in avi

FFmpeg trac at avcodec.org
Tue Jun 7 21:54:37 CEST 2011


#271: regression with seeking in avi
--------------------------+--------------------------
 Reporter:  ami_stuff     |        Type:  defect
   Status:  new           |    Priority:  normal
Component:  undetermined  |     Version:  unspecified
 Keywords:                |  Blocked By:
 Blocking:                |  Reproduced:  0
 Analyzed:  0             |
--------------------------+--------------------------
 http://www.datafilehost.com/download-39b73242.html

 seeking with ffplay in attached file doesn't work correctly, seems like a
 regression because of this patch:

 {{{
 avidec: correct frame_offset for seeking
 Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

 >
 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=187528441ab936c102b8e72f38925cc10fc14abc
 ---

  libavformat/avidec.c |   18 +++++++++++++++++-
  1 files changed, 17 insertions(+), 1 deletions(-)

 diff --git a/libavformat/avidec.c b/libavformat/avidec.c
 index 98b3be6..7e97b7b 100644
 --- a/libavformat/avidec.c
 +++ b/libavformat/avidec.c
 @@ -1303,7 +1303,7 @@ static int avi_read_seek(AVFormatContext *s, int
 stream_index, int64_t timestamp
  {
      AVIContext *avi = s->priv_data;
      AVStream *st;
 -    int i, index;
 +    int i, index, j;
      int64_t pos, pos_min;
      AVIStream *ast;

 @@ -1367,6 +1367,22 @@ static int avi_read_seek(AVFormatContext *s, int
 stream_index, int64_t timestamp
              index=0;
          ast2->seek_pos= st2->index_entries[index].pos;
          pos_min= FFMIN(pos_min,ast2->seek_pos);
 +    }
 +    for(i = 0; i < s->nb_streams; i++) {
 +        AVStream *st2 = s->streams[i];
 +        AVIStream *ast2 = st2->priv_data;
 +
 +        if (ast2->sub_ctx || st2->nb_index_entries <= 0)
 +            continue;
 +
 +        index = av_index_search_timestamp(
 +                st2,
 +                av_rescale_q(timestamp, st->time_base, st2->time_base) *
 FFMAX(ast2->sample_size, 1),
 +                flags | AVSEEK_FLAG_BACKWARD);
 +        if(index<0)
 +            index=0;
 +        while(index>0 && st2->index_entries[index-1].pos >= pos_min)
 +            index--;
          ast2->frame_offset = st2->index_entries[index].timestamp;
      }
 }}}



 {{{
 C:\>ffmpeg -i reszort.avi
 ffmpeg version git-N-30558-ge844abc, Copyright (c) 2000-2011 the FFmpeg
 develope
 rs
   built on Jun  5 2011 08:19:16 with gcc 4.5.3
   configuration: --enable-gpl --enable-version3 --enable-memalign-hack
 --enable-
 runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r
 --enable-libo
 pencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-
 libgsm --
 enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-
 libschroedinger
  --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx
 --enabl
 e-libx264 --enable-libxavs --enable-libxvid --enable-zlib --disable-
 outdev=sdl -
 -pkg-config=pkg-config
   libavutil    51.  4. 0 / 51.  4. 0
   libavcodec   53.  6. 1 / 53.  6. 1
   libavformat  53.  2. 0 / 53.  2. 0
   libavdevice  53.  1. 1 / 53.  1. 1
   libavfilter   2. 12. 0 /  2. 12. 0
   libswscale    0. 14. 1 /  0. 14. 1
   libpostproc  51.  2. 0 / 51.  2. 0
 Input #0, avi, from 'reszort.avi':
   Metadata:
     creation_time   : 2003-09-04 21:58:30
   Duration: 00:00:38.03, start: 0.000000, bitrate: 824 kb/s
     Stream #0.0: Video: msmpeg4v1, yuv420p, 192x144, 14.98 fps, 14.98 tbr,
 14.98
  tbn, 14.98 tbc
     Stream #0.1: Audio: pcm_s16le, 22050 Hz, 1 channels, s16, 352 kb/s
 At least one output file must be specified
 }}}

 {{{
 C:\>ffmpeg -i reszort.avi
 ffmpeg version git-N-30558-ge844abc, Copyright (c) 2000-2011 the FFmpeg
 develope
 rs
   built on Jun  5 2011 08:19:16 with gcc 4.5.3
   configuration: --enable-gpl --enable-version3 --enable-memalign-hack
 --enable-
 runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r
 --enable-libo
 pencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-
 libgsm --
 enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-
 libschroedinger
  --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx
 --enabl
 e-libx264 --enable-libxavs --enable-libxvid --enable-zlib --disable-
 outdev=sdl -
 -pkg-config=pkg-config
   libavutil    51.  4. 0 / 51.  4. 0
   libavcodec   53.  6. 1 / 53.  6. 1
   libavformat  53.  2. 0 / 53.  2. 0
   libavdevice  53.  1. 1 / 53.  1. 1
   libavfilter   2. 12. 0 /  2. 12. 0
   libswscale    0. 14. 1 /  0. 14. 1
   libpostproc  51.  2. 0 / 51.  2. 0
 Input #0, avi, from 'reszort.avi':
   Metadata:
     creation_time   : 2003-09-04 21:58:30
   Duration: 00:00:38.03, start: 0.000000, bitrate: 824 kb/s
     Stream #0.0: Video: msmpeg4v1, yuv420p, 192x144, 14.98 fps, 14.98 tbr,
 14.98
  tbn, 14.98 tbc
     Stream #0.1: Audio: pcm_s16le, 22050 Hz, 1 channels, s16, 352 kb/s
 At least one output file must be specified
 }}}

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


More information about the FFmpeg-trac mailing list