[libav-api] Problems with mpeg4 video decoding using Libav 10
nfxjfg at googlemail.com
Thu Apr 17 19:15:23 CEST 2014
On Thu, 17 Apr 2014 15:01:15 +0300
Ondřej Perutka <perutka.ondrej at gmail.com> wrote:
> It's a bit difficult to put here some code because the application I'm
> working on is a Java wrapper for Libav. Here is a class responsible for the
> decoder initialization and a wrapper of codec context for libavcodec 55.x.x:
> The interesting methods are:
> constructor of the VideoFrameDecoder
> It's a bit messy because I've been trying to keep compatibility with all
> versions of Libav since 0.7. But the initialization is pretty simple, it
> consist of the following steps:
Keeping compatibility with something as old as 0.7 will be pretty hard.
I find myself struggling even with ffmpeg 2.1 to Libav 10 compatibility
(ffmpeg 2.1 is like Libav 10 but half a year older).
In particular, there are extremely tricky aspects with AVFrame
management, since this changed a lot. Maybe double-check these to be
sure it's used correctly.
> 1) get the codec context from AVStream
In theory, you must create a new codec context, instead of using the
AVStream one. I'm not sure how to create this new context correctly;
maybe by using that copy_context function or whatever it was.
> 2) find AVCodec according to the codec ID (using avcodec_find_decoder())
> 3) call avcodec_open2()
> I'm working on a sample application written in C to reproduce this
> 2014-04-17 10:24 GMT+03:00 Luca Barbato <lu_zero at gentoo.org>:
> > On 16/04/14 19:00, Ondřej Perutka wrote:
> > > I saved input packets passed to the decoder into a file for all these
> > > cases. There were absolutely no differences between these files. (Note:
> > All
> > > packets had proper 8 byte zero padding in the end of the buffer.)
The padding is 16 bytes, AFAIK.
> > > I found out that setting thread_count in codec context to 1 solves the
> > > problem. But there are no problems with avplay using multiple threads.
> > > There are also no problems with previous versions of Libav So is there
> > > something I should know about thread locking?
> > Possibly, is hard to guess w/out seeing the code.
> > > I use Libav 10 from tarball and avcodec_decode_video2() for decoding.
> > How do you initialize the decoder?
> > lu
More information about the libav-api