libavformat doesn't handle containers with > 20 streams

Bug #301723 reported by Jan Rüegg
2
Affects Status Importance Assigned to Milestone
FFmpeg
Incomplete
Unknown
ffmpeg (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Binary package hint: ffmpeg

When I do a

ffmpeg -i /home/jan/The\ Matrix\ -\ HD\ 720p\ x264.mkv

I get a segmentation fault and ffmpeg crashes (the terminal output is attached). The file is about 8.3 gb in size, maybe that's the cause?

I'm using ffmpeg 3:0.svn20080206-12ubuntu3, together with ubuntu 8.10 on a 64-bit system.

Revision history for this message
Jan Rüegg (rggjan) wrote :
Revision history for this message
Reinhard Tartler (siretart) wrote :

I'm sorry, but the console output is not helpful at all for diagnosing this problem. Please see http://ffmpeg.org/bugreports.html for guidelines how to submit useful bug reports.

also consider compiling ffmpeg from svn and report your results.

Changed in ffmpeg:
status: New → Incomplete
Revision history for this message
Jan Rüegg (rggjan) wrote :

Ok, I compiled now from SVN with the default options ("./configure" without arguments).

I get:
jan@MacBuntu:~/linux/ffmpeg$ ffmpeg -i /media/Synology/The\ Matrix\ -\ HD\ 720p\ x264.mkv
FFmpeg version SVN-r15935, Copyright (c) 2000-2008 Fabrice Bellard, et al.
  configuration:
  libavutil 49.12. 0 / 49.12. 0
  libavcodec 52. 3. 0 / 52. 3. 0
  libavformat 52.23. 1 / 52.23. 1
  libavdevice 52. 1. 0 / 52. 1. 0
  built on Nov 25 2008 17:23:31, gcc: 4.3.2
/media/Synology/The Matrix - HD 720p x264.mkv: memory allocation error occurred

Cutting down the file into a smaller as described on the link makes the recognition work, so I cannot provide a sample file:

jan@MacBuntu:~$ dd if=/media/Synology/The\ Matrix\ -\ HD\ 720p\ x264.mkv of=/home/jan/Desktop/sample-file.mkv bs=1024 count=10000
10000+0 records in
10000+0 records out
10240000 bytes (10 MB) copied, 4.33087 s, 2.4 MB/s
jan@MacBuntu:~$ file -i /home/jan/Desktop/sample-file.mkv
/home/jan/Desktop/sample-file.mkv: application/octet-stream

But that means, it must be the big size of the file, that causes the problem (ffmpeg -i on all the other files in my media library worked).

Now the desired gdb ffmpeg_g output:

jan@MacBuntu:~/linux/ffmpeg$ gdb ffmpeg_g
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu"...
(gdb) r -i '/media/Synology/The Matrix - HD 720p x264.mkv'
Starting program: /home/jan/linux/ffmpeg/ffmpeg_g -i '/media/Synology/The Matrix - HD 720p x264.mkv'
FFmpeg version SVN-r15935, Copyright (c) 2000-2008 Fabrice Bellard, et al.
  configuration:
  libavutil 49.12. 0 / 49.12. 0
  libavcodec 52. 3. 0 / 52. 3. 0
  libavformat 52.23. 1 / 52.23. 1
  libavdevice 52. 1. 0 / 52. 1. 0
  built on Nov 25 2008 17:23:31, gcc: 4.3.2
/media/Synology/The Matrix - HD 720p x264.mkv: memory allocation error occurred

Program exited with code 01.
(gdb) bt
No stack.
(gdb) disass $pc-32 $pc+32
No registers.
(gdb) info all-registers
The program has no registers now.

(Didn't seem to work very well though, as the registers are all empty... Maybe a 64-bit problem?)

---

If you need any more information, please tell me!

Changed in ffmpeg:
status: Incomplete → New
Revision history for this message
Reinhard Tartler (siretart) wrote :

that is pretty surprising. Your initial report contained a segmentation fault, while your last comment indicates an out of memory situation. That is, well, confusing at best, I'd say.

Revision history for this message
Jan Rüegg (rggjan) wrote :

Hmm... is it possible that thesegfault bug was somehow 'fixed' in the SVN, and instead e new bug with this memory allocation error was introduced?

Should I compile the old version directly from SVN to see if it makes some difference with what compile flags for example the ubuntu deb was compiled?

Revision history for this message
Reinhard Tartler (siretart) wrote : Re: [Bug 301723] Re: ffmpeg -i crashes with segmentation fault

Jan Rüegg <email address hidden> writes:

> Hmm... is it possible that thesegfault bug was somehow 'fixed' in the
> SVN, and instead e new bug with this memory allocation error was
> introduced?

That's pretty well possible.

> Should I compile the old version directly from SVN to see if it makes
> some difference with what compile flags for example the ubuntu deb was
> compiled?

That would indeed be interesting. To get the source from the ubuntu
package:

apt-get build-dep ffmpeg-debian
apt-get source ffmpeg-debian
cd ffmpeg-debian*
make -f debian/rules build-stamp-shared

then you should have ffmpeg_g in the subdirectory 'debian-shared' and
can continue with the bug reporting guidelines from the ffmpeg.org
website.

To learn the version and the configure flags used in the ubuntu version
of ffmpeg issue 'ffmpeg --version' on the ubuntu ffmpeg binary.

--
Gruesse/greetings,
Reinhard Tartler, KeyID 945348A4

Revision history for this message
Jan Rüegg (rggjan) wrote : Re: ffmpeg -i crashes with segmentation fault

Trying

apt-get build-dep ffmpeg-debian
apt-get source ffmpeg-debian
cd ffmpeg-debian*
make -f debian/rules build-stamp-shared

I got "make -f debian/rules build-stamp-shared
Building FFmpeg for flavors: static shared
DEB_BUILD_OPTIONS are:
Using as CFLAGS:
make: *** No rule to make target `build-stamp-shared'. Stop."

Instead, I tried:
make -f debian/rules build-stamp

what gave me then much more output when debugging with gdb (see attachement)

'ffmpeg --version' on the ubuntu ffmpeg binary gives me:
FFmpeg version r11872+debian_3:0.svn20080206-12ubuntu3, Copyright (c) 2000-2008 Fabrice Bellard, et al.
  configuration: --enable-gpl --enable-pp --enable-swscaler --enable-x11grab --prefix=/usr --enable-libgsm --enable-libtheora --enable-libvorbis --enable-pthreads --disable-strip --enable-libfaad --enable-libfaadbin --enable-liba52 --enable-liba52bin --enable-libdc1394 --enable-shared --disable-static
  libavutil version: 49.6.0
  libavcodec version: 51.50.0
  libavformat version: 52.7.0
  libavdevice version: 52.0.0
  built on Oct 3 2008 22:41:23, gcc: 4.3.2
ffmpeg: missing argument for option '--version'

Anything else I can do?

Revision history for this message
Steve Ungerer (public-ungerer) wrote :

Encountered a similar issue today that was corrected with information from ffmpeg issue 963: https://roundup.ffmpeg.org/roundup/ffmpeg/issue963

The input mkv I was working with had > 20 streams; changing MAX_STREAMS to 64 in libavformat/avformat.h in a recent checkout and rebuilding corrected the issue.

Revision history for this message
Reinhard Tartler (siretart) wrote :

The problem with changing MAX_STREAMS is that this breaks binary compatibility of libavformat, which means we cannot do this change in ubuntu. This needs solving upstream.

Changed in ffmpeg (Ubuntu):
status: New → Triaged
importance: Undecided → Low
summary: - ffmpeg -i crashes with segmentation fault
+ libavformat doesn't handle containers with > 20 streams
Changed in ffmpeg:
status: Unknown → Confirmed
Changed in ffmpeg:
status: Confirmed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ffmpeg - 4:0.6~svn20100505-1ubuntu1

---------------
ffmpeg (4:0.6~svn20100505-1ubuntu1) maverick; urgency=low

  * merge from debian/experimental. remaining changes:
    - don't disable encoders
    - don't build against libfaad, libdirac and libopenjpeg (all in universe)

ffmpeg (4:0.6~svn20100505-1) experimental; urgency=low

  * update to new upstream. Closes: #569727
    - fixes various segfaults and other minor feature improvements
      Closes: #374931, #522449, #501891, #559712, #420231, #369127, #538082,
              #298095, #294422, #561553, #525385, #495274, #420230
      LP: #305286, #457106, #529200, #301723, #305315, #336479, #420230,
          #412063, #428912, #432181, #440591, #453732, #453732, #453732,
      #514259, #515243, #521472, #530186, #530186, #197842, #483317,
     #483317, #539407, #280098, #331255, #566107, #569823, #570305,
     #573190
  * Fixup lintian overrides for new upstream snapshot
  * Bump Standards-Version to 3.8.4
  * Many upstream changes, see upstream Changelog for details
 -- Reinhard Tartler <email address hidden> Wed, 26 May 2010 00:01:17 +0200

Changed in ffmpeg (Ubuntu):
status: Triaged → Fix Released
Changed in ffmpeg:
status: Incomplete → Confirmed
Changed in ffmpeg:
status: Confirmed → Incomplete
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.