0

I am using libstagefright to decode a 1020p video having baseline high and level 31 on android.

On emulator the video decoding fails, and i assume the reason is that softavc does not support high baseline according to the code here

But I tested this code on a real device which uses the OMX.MTK.VIDEO.DECODER.AVC decoder. And according to this link, this decoder supports high baseline decoding with level 31.

But the video result is garbled.

Does anyone have any insight, why this is so? And what could be the possible solution?

Daniyal Yasin
  • 142
  • 1
  • 14

2 Answers2

3

There could be 3 reasons for garbled output

  1. The decoder employs a stride which you haven't factored into your calculations. Recommended Solution: Please check OMXcomponent's port parameters and look for stride and make suitable modifications.

  2. I presume you are decoding 1080, please consider 1088 for calculations instead of 1080. This can be confirmed if your output has clear luma, but jumbled chroma. Does 720p play fine for you?

  3. If it's neither of the above 2 conditions are true, then the decoder may be outputting a tiled output. Please check with the vendor's specifications. If this is true, you will need to convert from the tiled format to a more common format like NV12.

EDIT: I think tiling is your problem. Please check this github commit which is related to your problem and has a solution for color conversion.

Ganesh
  • 5,880
  • 2
  • 36
  • 54
  • After much research I have found that maybe the actual problem is that I am using a mpegts stream and it does not have sps and pps set in extradata. Hence libstagefright.cpp of ffmpeg can not decode it. – Daniyal Yasin Aug 27 '15 at 11:16
  • 1
    On more research I have found that your assessment was right. My problem is indeed with the color format. – Daniyal Yasin Aug 29 '15 at 10:06
0

I presume you are taking about videos with a resolution of 1920 x 1080. It is recommended to align decoded buffer width and height to the nearest multiple of 128 and 32 respectively to avoid garbled output.

ALIGN(decoded_buffer_width, 128)
ALIGN(decoded_buffer_height, 32)

So you must be using 1920 x 1088 for your calculations