[FFmpeg-trac] #1607(avformat:new): av_seek_frame() without AVSEEK_FLAG_ANY on mpg files returns success without seeking to a keyframe

FFmpeg trac at avcodec.org
Tue Aug 7 09:02:20 CEST 2012


#1607: av_seek_frame() without AVSEEK_FLAG_ANY on mpg files returns success
without seeking to a keyframe
------------------------------------+------------------------------------
             Reporter:  mbradshaw   |                    Owner:
                 Type:  defect      |                   Status:  new
             Priority:  normal      |                Component:  avformat
              Version:  git-master  |               Resolution:
             Keywords:              |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+------------------------------------

Comment (by DonMoir):

 This is best looked at by a developer. Trying to produce something using
 ffmpeg or ffplay may be difficult to visualize for you. Sometimes recovery
 is quick and is not as noticeable. If a developer will try to seek on the
 above file and look at the first packet read after the seek, most likely
 it will not be a keyframe. Sometimes you get lucky and you will land on a
 keyframe but mostly not. Since in general you do not land on keyframe
 after a seek for mpeg2video files, there will be a delay before animation
 begins. This can be a 2 second delay and just depends on the file and the
 time you attempted to seek to.

 The seek for mpeg2video files uses ff_seek_frame_binary and it's just not
 smart enough to to do keyframe seeking. Any format that is using the
 generic seek code may also have the same problem. Best thing is to add
 specialized seeking for mpeg2video like most of the other formats that
 work have.

 I put in bold some hints at the bottom of this ffplay output.

 ffplay -ss 5 mpeg2video_seek_to_non_keyframe.mpg
 ffplay version N-43206-gf857465 Copyright (c) 2003-2012 the FFmpeg
 developers
   built on Aug  4 2012 16:12:33 with gcc 4.7.1 (GCC)
   configuration: --disable-static --enable-shared --enable-gpl --enable-
 version3
  --disable-w32threads --enable-runtime-cpudetect --enable-avisynth
 --enable-bzlib
  --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-
 amrnb
  --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-
 libmp3lame
  --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-
 libschroedinger
  --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-
 aacenc
  --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-
 libx264
  --enable-libxavs --enable-libxvid --enable-zlib
   libavutil      51. 66.100 / 51. 66.100
   libavcodec     54. 49.100 / 54. 49.100
   libavformat    54. 22.100 / 54. 22.100
   libavdevice    54.  2.100 / 54.  2.100
   libavfilter     3.  5.102 /  3.  5.102
   libswscale      2.  1.100 /  2.  1.100
   libswresample   0. 15.100 /  0. 15.100
   libpostproc    52.  0.100 / 52.  0.100
 [mpeg @ 012a0520] max_analyze_duration 5000000 reached at 5024000
 Input #0, mpeg, from 'mpeg2video_seek_to_non_keyframe.mpg':

   Duration: 00:00:09.85, start: 1.320000, bitrate: 4998 kb/s
     Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p,
         720x576 [SAR 16:15 DAR 4:3], 8000 kb/s, 25 fps, 25 tbr, 90k tbn,
 50 tbc
     Stream #0:1[0x80]: Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s
 [mpeg2video @ 012ae6e0] '''warning: first frame is no keyframe'''
 [ac3 @ 012a7c20] '''frame sync error''' aq=    8KB vq=    5KB sq=    0B
 f=0/0
 Frame changed from size:0x0 to size:720x576
   25.71 A-V:  6.834 fd=   3 aq=    0KB vq=    0KB sq=    0B f=0/0   f=0/0

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1607#comment:7>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list