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

Alex Cohn alexcohn at netvision.net.il
Sun Nov 24 06:27:04 CET 2013


On Nov 24, 2013 2:39 AM, "sirvo" <sylviojalves at gmail.com> wrote:
>
> Hello,
>
> 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
> available).
>
> Thanks!

The first thing yo check in such situation is if the stock video player
(which uses the same hw decoder internally) can play this h264 video better.

This may involve using ffmpeg on a PC to remux (without transcoding) the
file into some format that the player recognizes, e.g. mp4, with `vc vopy`.

BR,
Alex Cohn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20131124/7fa871cc/attachment.html>


More information about the Libav-user mailing list