libavcodec doesn't decode Theora

Bug #522812 reported by Emanem on 2010-02-16
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
ffmpeg (Ubuntu)
Undecided
Unassigned

Bug Description

Binary package hint: ffmpeg

The current version of libavcodec is old (doesn't export the function avcodec_decode_video2) and bugged; it can't decode any Theora video stream.
Simply use the avcodec API to try to read a frame with the function avcodec_decode_video from a Theora stream and the content you get is scrambled.
Testing the same code against a newer version of libavcodec (from the FFmpeg website) is ok, Theora streams work (plus the avcodec_decode_video2 is being exported as well).

Reinhard Tartler (siretart) wrote :

this bug as such is invalid, as I have theora material on my laptop that plays just fine with ubuntu's ffplay.

as for avcodec_decode_video2, yes, it was added by this commit:

------------------------------------------------------------------------
r18351 | rbultje | 2009-04-07 17:59:50 +0200 (Di, 07. Apr 2009) | 9 Zeilen

Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
AVPacket argument rather than a const uint8_t *buf + int buf_size. This allows
passing of packet-specific flags from demuxer to decoder, such as the keyframe
flag, which appears necessary to playback corePNG P-frames.

Patch by Thilo Borgmann thilo.borgmann googlemail com, see also the thread
"Google Summer of Code participation" on the mailinglist.
-----------------------------------------------------------------------

it will be included in ffmpeg 0.6, but lucid will got with ffmpeg 0.5.

as ffplay does work just fine, I'm marking this bug as invalid for ubuntu. It might be valid for upstream, though. Please discuss it there, this issue should be fixed there (e.g. in the 0.5 release branch) anyways.

Changed in ffmpeg (Ubuntu):
status: New → Invalid
Emanem (emaentra) wrote :

Hi, the bug is confirmed by other users as well: http://ubuntuforums.org/showpost.php?p=8836993&postcount=57 .
The problem is present for sure when you load libavcodec as a dynamic library. For some reason this version of libavcodec.so is not able to decode Theora video.
If you want I can attach a piece of code that will show you that every other format is being decoded but Theora.

Cheers,

On Mi, Feb 17, 2010 at 09:28:36 (CET), Emanem wrote:
yes, code examples would help to further examine this issue, but please
consider doing so on the upstream mailing lists and propose a fix for
inclusion into the 0.5 branches.

lucid will not be updated to current trunk. Lucid+1 has chances to get
updated to a 0.6 release branch once that is created.

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

Emanem (emaentra) wrote :

Ok, what is the upstream mailing list?
Thanks again,

Emanem (emaentra) wrote :

I already sent them a mail.
Now, what do I have to do to convince you of this issue in current Ubuntu distribution?
Post the source code (so you can compile and verify yourself) would be ok?
Cheers,

Reinhard Tartler (siretart) wrote :

attaching a clean example could help to understand the issue, but
without a seeing what exact changes you request, I cannot promise
anything.

Emanem (emaentra) wrote :

I've attached a simple source that, given the name of a video file, will print the first 10 frames (as ppm).
To compile you'll need the following packages installed:
libavcodec-dev
Compile with:
g++ ./avcodec_sample.cpp -o av_sample -g -pthread -lavcodec -lavformat -lswscale

example use:
./av_sample ./my.video.ogv

On Ubuntu 9.10 x86-64 all video streams (vob,mov,mpg,mpg3,mpg4,wmv,...) are ok but not if Theora coded.

Reinhard Tartler (siretart) wrote :

for the theora sample I have on my laptop, I get this output:

siretart@faui44a:/tmp $ ffprobe /srv/media/ubuntu-uploads.ogv
ffprobe /srv/media/ubuntu-uploads.ogv
FFprobe version SVN-r20090707, Copyright (c) 2007-2009 Stefano Sabatini
  libavutil 49.15. 0 / 49.15. 0
  libavcodec 52.20. 0 / 52.20. 0
  libavformat 52.31. 0 / 52.31. 0
  built on Jan 19 2010 21:59:04, gcc: 4.4.3 20100116 (prerelease)
[theora @ 0x8412270]7 bits left in packet 82
Input #0, ogg, from '/srv/media/ubuntu-uploads.ogv':
  Duration: 00:04:56.33, start: 0.000000, bitrate: 5477 kb/s
    Stream #0.0: Invalid Codec type -1
    Stream #0.1: Video: theora, yuv420p, 1024x768, PAR 1:1 DAR 4:3, 24 tbr, 24 tbn, 24 tbc
Unsupported codec (id=0) for input stream 0
[theora @ 0x8412270]7 bits left in packet 82

moreover, 10 non-garbled ppm files gets created for me.

perhaps either I or you have a funky theora file to test. Perhaps you
get better results by using the 'libtheora' codec instead of the
'theora' one?

In any case, this is not the right forum to discuss such
questions. Please try on the libav-user mailing list.

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

Emanem (emaentra) wrote :

Hi Reinhard,

I'm sorry to post again but this issue is affecting Ubuntu 9.10 32 bit as well.
On a clean virtual machine (so no strange things/configuration happening on it) I just did the following:
sudo apt-get install g++ libavcodec-dev libavformat-dev libswscale-dev
Then I compiled the test app:
g++ ./avcodec_sample.cpp -o av_test -O2 -g -pthread -lavformat -lavcodec -lswscale
And I used against this reference:
http://web.mit.edu/xiphmont/Public/theora/matrix-300-AQ.ogv
(this is an ogv file created by Theora devs)
./av_test ./matrix-300-AQ.ogv

Again, I had same results as before, corrupted ppm.
Please bear in mind that I've done this with a clean Ubuntu 9.10 32bit host.

Regards,

Emanem (emaentra) wrote :

Update:

without recompiling the test executable (so it gets compiled against the default Ubuntu libraries/shared objects), but using the latest shared objects compiled from svn ffmpeg code cut, theora decoding does work.
Again I hope this is not only sufficient but you can consider it as definitive proof of what is happening:
with:
default libav*.so.* from Ubuntu ==> doesn't work
latest svn cut libav*.so.* from ffmpeg website ==> does work
Again I didn't recompile the executable, just changed the shared objects.

Regards,

Reinhard Tartler (siretart) wrote :

On Fr, Feb 19, 2010 at 10:10:42 (CET), Emanem wrote:

> And I used against this reference:
> http://web.mit.edu/xiphmont/Public/theora/matrix-300-AQ.ogv

this file is broken even with current trunk of ffmpeg, so updating
ffmpeg would not help anyways.

please report it upstream using these guidelines:
http://ffmpeg.org/bugreports.html

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

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

Emanem (emaentra) wrote :

Ah-ah, so basically you're saying that the current Theora decoder (exposed via libavcodec.so) in Ubuntu is broken because it doesn't support the finalized Theora video stream?

That file is not broken, according to Theora devs this file is done against the finalized Theora format (and I guess they know what they're talking about).
Again, I'm not saying that in Ubuntu you can't playback that file, just you can't with libavcodec that is shipping.
So I would guess that a lot of other players that use libavcodec are statically linked to an updated version.

I've already reported to ffmpeg. Actually is not an issue because this has already been fixed.

My question is, when will Ubuntu update libavcodec (and all other utility libraries that ship with it)?

On a side note, if all other video software would be dynamically linked to libavcodec maybe we would see this issue more frequently.

Cheers,

Reinhard Tartler (siretart) wrote :

On Fr, Feb 19, 2010 at 15:58:35 (CET), Emanem wrote:

> Ah-ah, so basically you're saying that the current Theora decoder
> (exposed via libavcodec.so) in Ubuntu is broken because it doesn't
> support the finalized Theora video stream?

libavcodec.so exposes 2 decoders for theora. An internal one and a
wrapper for libtheora. I assume that libtheora is able to playback that
particular file.

> That file is not broken, according to Theora devs this file is done
> against the finalized Theora format (and I guess they know what
> they're talking about).

I didn't claim it broken

> Again, I'm not saying that in Ubuntu you can't playback that file,
> just you can't with libavcodec that is shipping.

I'd rather argue that libavcodec picks the internal decoder by default,
which fails to playback that file. What is so special about this file,
and why do other theora files work? I can only guess that it uses a
colorspace format that libswscale or libavcodec doesn't handle correctly.

> So I would guess that a lot of other players that use libavcodec are
> statically linked to an updated version.

we avoid statically linked players in ubuntu.

> I've already reported to ffmpeg. Actually is not an issue because this
> has already been fixed.

references please, which roundup issue are you talking about? I can
reproduce the problem with your file with current trunk, and I haven't
read you on libav-user mailing list either.

> My question is, when will Ubuntu update libavcodec (and all other
> utility libraries that ship with it)?

as soon as good fix is known

> On a side note, if all other video software would be dynamically linked
> to libavcodec maybe we would see this issue more frequently.

This issue has nothing to do with static vs. dynamic linking.

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

Emanem (emaentra) wrote :

Hi, about this file, it has been encoded with latest libtheora (1.1).
Regarding avcodec, do you know how can I tell it to use libtheora instead of the internal?
Because looking into the sources I can only see one codec id defined:
http://cekirdek.pardus.org.tr/~ismail/ffmpeg-docs/avcodec_8h.html#0c33394cb3458990f80b53c83ebe25f4fff92be4067be53735b52f09dd415612
And apparently it's only one available that I can choose.
How can I choose the external?
Regarding the email to ffmpeg list, I've sent one a couple of days ago. If they didn't bother to answer, honestly, is not my fault.
Add the fact that the most recent release of ffmpeg libraries don't have any issues, I'm assuming they consider it a non issue.

Cheers,

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers