[FFmpeg-trac] #5610(undetermined:new): FFmpeg Libraries Seek Wildly On Opening W64-Format Files Via VIO

FFmpeg trac at avcodec.org
Thu Jun 2 22:52:15 CEST 2016

#5610: FFmpeg Libraries Seek Wildly On Opening W64-Format Files Via VIO
             Reporter:  mocmaint     |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:  w64          |               Blocked By:
  regression                         |  Reproduced by developer:  0
             Blocking:               |
Analyzed by developer:  0            |
 I am testing the next patchset for the MOC player which adds the ability
 to feed FFmpeg's libav* libraries input via the callbacks registered using
 avio_alloc_context(). Some of those tests involve a variety of formats and

 When attempting to play a W64-format file, the application becomes
 unresponsive and GDB shows seeking patterns well outside the bounds of the
 files through repeated calls to the seek and read callbacks.

 As this is a library problem, there is no command line invocation of an
 FFmpeg utility, and those utilities do not appear to use callbacks via

 There is no console output (obviously) and no messages are issued by the
 libraries (via the logging callback).

 The sequence of library calls (omitting error checking) is:

     AVFormatContext *ic = avformat_alloc_context();
     ic->pb = avio_alloc_context(...);
     avformat_open_input(ic, ...);

 avformat_open_input() never returns.

 The problem occurs on a W64-format file of any size, but a suitable test
 file can be generated with:

     sox -b16 -c2 -r48000 -n -L test.wav synth 10 sine 440 vol 0.5

 The problem was introduced in commit 14d50c19 in FFmpeg 1.1 and still
 exists in FFmpeg 3.0.2.

 It is possible that the error return values of the seek and read callbacks
 are incorrect, but they appear undocumented and do work in all other
 formats tested and also with the W64 format prior to commit 14d50c19 and
 with LibAV 11.6. The return values used by similar code found vary.

 Full FFmpeg configure originally used is:

     CFLAGS="-O2 -fPIC" ./configure --prefix=/usr/local/stow/$(basename
 $PWD) --libdir='${prefix}/lib64' --shlibdir='${prefix}/lib64' --enable-
 shared --disable-static --disable-yasm --enable-libspeex --enable-
 libtheora --enable-libopus

 '$PWD' was '/tmp/ffmpeg-14d50c19'.

 MOC is available using:

   svn co -r2872 svn://svn.daper.net/moc/trunk

 Aggregated patch for the patchset being tested is available using:


 Apply to the SVN trunk revision 2872 using:

   zcat moc-r2872+ffmpeg_memleak-1.patch.gz | patch -p1

 The MOC FFmpeg decoder will be found in:


 Build as per instructions in README. After installing, delete all
 installed decoder plugins in 'lib{,64}/moc/decoder_plugins' *except*

 Then launch MOC as 'mocp' in the directory containing W64 files.

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

More information about the FFmpeg-trac mailing list