Broken Theora support (libavcodec)

Hi guys,

while writing this application ( http://qpsnr.youlink.org/ ) I noticed that Theora video streams are broken with current version of libavcodec library.
I opened a bug here: https://bugs.launchpad.net/ubuntu/+s...eg/+bug/522812
Apparently I have the same issue even on fresh virtualized environments.
To reproduce the issue, do the following:
1) Download http://launchpadlibrarian.net/393584...dec_sample.cpp
2) Install sudo apt-get install g++ libavcodec-dev libavformat-dev libswscale-dev
3) Compile g++ ./avcodec_sample.cpp -o av_test -O2 -g -pthread -lavformat -lavcodec -lswscale
4) Download a reference OGV http://web.mit.edu/xiphmont/Public/t...rix-300-AQ.ogv
5) Execute ./av_test ./matrix-300-AQ.ogv
Now, you should have in your directory 10 corrupted ppm images (that should be the first 10 frames of the ogv file). If instead you run ./av_test any_other_video_type you should get the first 10 frames of the video file. It does work for all other formats but for Theora streams.

Re: Broken Theora support (libavcodec)

5) Execute ./av_test ./matrix-300-AQ.ogv
Now, you should have in your directory 10 corrupted ppm images (that should be the first 10 frames of the ogv file).

This command should yield the same result:

Code:

ffmpeg -vframes 10 -i matrix-300-AQ.ogv frame%d.ppm

As you have seen in your bug report, people may tend to dispute the validity of your code rather than the validity of libavcodec. If you can showcase the bug with a standard tool such as ffmpeg, it will be easier to convince reviewers that the bug is in fact in the library rather than in your code.

Re: Broken Theora support (libavcodec)

Originally Posted by VertexPusher

This command should yield the same result:

Code:

ffmpeg -vframes 10 -i matrix-300-AQ.ogv frame%d.ppm

As you have seen in your bug report, people may tend to dispute the validity of your code rather than the validity of libavcodec. If you can showcase the bug with a standard tool such as ffmpeg, it will be easier to convince reviewers that the bug is in fact in the library rather than in your code.

I see, but the point is that my code is what is recommended by the libavcodec API, plus is short and compact. And, most of all, I'm sure that with my code I'm using libavcodec dynamically plus it works 100% with all other video streams (mpeg, mpeg2, mpeg4,wmv,flv,...).

Actually, it's very simple code, just for the purpose to show the bug.
Clearly it takes less than 5 minutes to spot any bug there.
Naturally if there's an error in API usage, please do tell me.

Re: Broken Theora support (libavcodec)

UPDATE:

without recompiling the test executable, but recompiling the shared objects (libav*.so) from the latest cut of ffmpeg svn source code, it does work.
Basically, once recompiled all the libav*.so.* libraries, just put them in the path of the test executable andexport LD_LIBRARY_PATH=`pwd`
Magically the executable will now properly decode Theora video streams!
If changing the libraries (again without touching the executable) makes it work, am I wrong saying that the libav*.so.* libraries used in Ubuntu are broken?
Honestly this is prof that against the default libav*.so.* theora streams can't be decoded with libavcodec.
I'll post this on the bug report as well, hopefully this time it will be taken into account.

note that there are already a lot of other open issues with avcodecs
theora decoder.

So, as seen as that file ( http://web.mit.edu/xiphmont/Public/t...rix-300-AQ.ogv ) is not broken (according to Theora devs that file is made against the finalized Theora video stream format) libavcodec and the other ffmpeg libraries (I suppose) are broken in current Ubuntu packages.
Or better, it doesn't support the finalized Theora format...
Why are you able to playback that file with other players? Because probably those players are statically linked against an updated version of libavcodec...

As I wrote over there, when are we going to support the finalized format of Theora through libavcodec in Ubuntu?

Should the fact that Theora is the open source format should catch special attention of maintainers?

Re: Broken Theora support (libavcodec)

The ffmpeg ver. in karmic and lucid cannot decode video encoded with the new theora - libtheora-1.1.X (has nothing to extra or not

This has been discussed on launchpad previously for karmic and there is no intention of using a newer ffmpeg version for either karmic or lucid.

( The 0.5 vs. 0.6 arg. is a bit of a mystery, the version used now is 0.5+svn20090706, there is actually no great reason why +svnXXXXXXXX can't be moved forward - while the benefit of doing that may be minimal to gstreamer apps/plugins it would be seen in vlc, mplayer, and some other apps, both in repo and ppa versions.

What you may wish to try is to build the karmic/lucid ffmpeg source off of the newer libtheora-1.1, and see if it makes a difference, don't know here as I don't use the repo supplied ffmpeg or the shared libs, (odds are it won't

(I always replace the shared once per install with newer deb packages, ffmpeg itself is updated quite often