<p dir="ltr">On Nov 24, 2013 2:39 AM, "sirvo" <<a href="mailto:sylviojalves@gmail.com">sylviojalves@gmail.com</a>> wrote:<br>
><br>
> Hello,<br>
><br>
> I've managed to play 1080p@60fps h264 files by feeding Android's MediaCodec<br>
> inputbuffer with video packets from FFmpeg's av_read_frame(). The output is<br>
> rendered automatically to the surface by the<br>
> decoder.releaseOutputBuffer(buffer_index, true);<br>
><br>
> However, it is possible to notice that the video is not smooth enough (some<br>
> frames are not being decoded). Looking out to the functions<br>
> dequeueInputBuffer and dequeueOutputBuffer, I've been getting this:<br>
><br>
> dequeueInputBuffer: Get available inputbuffer index to insert new video<br>
> packet to be decoded.<br>
> All the time is returns a value greater or equal to 0. OK for me!<br>
><br>
> dequeueOutputBuffer: Get available decoded packet index to further being<br>
> released to the surface.<br>
> It's been returning positive and negative values, like 15, -1, 11, -1, -1,<br>
> 16, 10, -1 (...);<br>
> The positive values means that the packet was decoded successfully. The<br>
> negative means error. It also means that the negative packets are not being<br>
> released to the surface because it was not decoded. Even increasing the<br>
> timeout does not returns a positive value.<br>
><br>
> I've have checked the video packets extracted from FFmpeg's.<br>
> Each packet, all of them, have at least the PPS.<br>
> In an interval of 5~10 packets, the SPS also comes into it.<br>
> These SSP/PPS are shown in AnnexB format, it means that they come like (0x00<br>
> 0x00 0x00 0x01)<br>
><br>
> Is there anything I've being missing?<br>
> Any tips?<br>
><br>
> (The architecture (FFmpeg + MediaCodec) is needed for now. No other way<br>
> available).<br>
><br>
> Thanks!</p>
<p dir="ltr">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.</p>
<p dir="ltr">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`.</p>
<p dir="ltr">BR,<br>
Alex Cohn</p>