android mediacodec:实时解码h264 nals [英] android mediacodec: real time decoding h264 nals

查看:684
本文介绍了android mediacodec:实时解码h264 nals的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用android低级媒体api实时解码h264 nals.
每个nal包含一个完整的帧,因此我希望在输入我的nal并调用dequeueOutputBuffer之后,它将立即"(当然,有一点点延迟)显示我的帧,但不会.我看到第一个帧,出队列仅在向解码器提供第二个帧后才返回第一个缓冲区,此时应渲染第二个帧.帧使用x264的零延迟预设进行编码,因此没有b帧等.

I'm trying to decode h264 nals in real time with android low level media api.
Each nal contains one full frame, so i expect that after feeding input with my nal and calling dequeueOutputBuffer it would "immediatly" (with the litle delay of course) display my frame but it doesn't. I see the first frame and the dequeue returns the first buffer only afer feeding the decoder with the second one which at this time should render the second frame. Frames are encoded with zerolatency preset of x264 so no b-frame etc...

我想也许有一种方法可以设置编码器,使其在得到帧后立即渲染,但是我找不到关于它的任何好的文档/说明. 有什么建议吗?

I guess that there might be a way to set the encoder to render the frame immediatly after it got it but i couldn't find any good documentation/explanations on that. Any suggestion?

推荐答案

只有在解码了预帧之后才能解码p帧

a p-frame can be decoded only after the pre-frame was decoded

这篇关于android mediacodec:实时解码h264 nals的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆