5

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?

Magnilex
  • 11,584
  • 9
  • 62
  • 84
Florian
  • 51
  • 1
  • 3
  • I've come across the same issue. My current theory is that it appears that H.264 lacks any sort of "end of frame" marker. Therefore, the decoder has to wait until it has data for the next frame to finish decoding and display the current frame. For me, it's only adding about 25ms, but that's 25 ms I'd like to get back. – Anand Mistry Aug 26 '13 at 00:46
  • I have the same issue, even with I-Frames. But I still have no solution yet. Did you succeed in rendering "real-time"? – Soccertrash Jul 05 '16 at 09:17
  • @soccertrash, Did you succeed? – Bato-Bair Tsyrenov Jul 21 '19 at 10:23

2 Answers2

0

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.

av501
  • 6,645
  • 2
  • 23
  • 34
  • 1
    Thanks for your answer, but from my tests, the frame is displayed when the decoder is feed with next one, no matter the delay between thooses two (20msec or 10 sec doesn't change), so it this is not related to the decoding time, but seems to be a limitation from the api. – Florian May 15 '13 at 16:30
0

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