[libav-api] Problems with mpeg4 video decoding using Libav 10

Ondřej Perutka perutka.ondrej at gmail.com
Thu Apr 17 14:01:15 CEST 2014


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:

https://github.com/operutka/jlibav/blob/master/jlibav/src/main/java/org/libav/video/VideoFrameDecoder.java
https://github.com/operutka/jlibav/blob/master/jlibav/src/main/java/org/libav/avcodec/CodecContextWrapper55.java

The interesting methods are:
constructor of the VideoFrameDecoder
VideoFrameDecoder.processPacket()
CodecContextWrapper55.decodeVideoFrame()

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:

1) get the codec context from AVStream
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
behaviour.


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.)
> >
> > 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
> _______________________________________________
> libav-api mailing list
> libav-api at libav.org
> https://lists.libav.org/mailman/listinfo/libav-api


More information about the libav-api mailing list