[Libav-user] Using Mediacodec to decode video packets from FFmpeg's av_read_frame

sirvo sylviojalves at gmail.com
Sat Nov 23 16:22:47 CET 2013


I've managed to play 1080p at 60fps h264 files by feeding Android's MediaCodec
inputbuffer with video packets from FFmpeg's av_read_frame(). The output is
rendered automatically to the surface by the
decoder.releaseOutputBuffer(buffer_index, true);

However, it is possible to notice that the video is not smooth enough (some
frames are not being decoded). Looking out to the functions
dequeueInputBuffer and dequeueOutputBuffer, I've been getting this:

dequeueInputBuffer: Get available inputbuffer index to insert new video
packet to be decoded.
All the time is returns a value greater or equal to 0. OK for me!

dequeueOutputBuffer: Get available decoded packet index to further being
released to the surface.
It's been returning positive and negative values, like 15, -1, 11, -1, -1,
16, 10, -1 (...);
The positive values means that the packet was decoded successfully. The
negative means error. It also means that the negative packets are not being
released to the surface because it was not decoded. Even increasing the
timeout does not returns a positive value.

I've have checked the video packets extracted from FFmpeg's.
Each packet, all of them, have at least the PPS.
In an interval of 5~10 packets, the SPS also comes into it.
These SSP/PPS are shown in AnnexB format, it means that they come like (0x00
0x00 0x00 0x01)

Is there anything I've being missing? 
Any tips?

(The architecture (FFmpeg + MediaCodec) is needed for now. No other way


View this message in context: http://libav-users.943685.n4.nabble.com/Using-Mediacodec-to-decode-video-packets-from-FFmpeg-s-av-read-frame-tp4658878.html
Sent from the libav-users mailing list archive at Nabble.com.

More information about the Libav-user mailing list