android mediacodec: real time decoding h264 nals

给你一囗甜甜゛ 提交于 2019-12-06 08:31:34

问题


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?


回答1:


Just because frames are encoded with zero latency setting does not mean they will be decoded with zero latency. Two seperate things. So depending on codec level (resolution, bitrate, framerate) and profile you may have to decode upto 16 frames of h264 video to get aframe out.




回答2:


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



来源:https://stackoverflow.com/questions/16323041/android-mediacodec-real-time-decoding-h264-nals

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!