[libav-api] H264 Decoding

William Cheung cheung.waiho at gmail.com
Fri Jun 3 02:53:01 CEST 2016

This is a image format issue. What you are using to view is expecting a
NV12 image, but you giving a I420.

NV12 is formatted like this -> YYYYYYY UV UV UV UV
I420 is formatted like this -> YYYYYYYY UUUU VVVV

This is why you are seeing the image duplicated twice across the X and Y
axis and all the colours messed up.

You can swap the UV plane bytes around to turn I420 to NV12.

On 2 June 2016 at 06:22, Kiara Forman <kiaraforman at icloud.com> wrote:

> I am trying to decode h264 raw data. Currently i am getting a nal packet
> from the encoder and placing the size and data in the AVPacket structure.
> Then calling avcodec_decode_video2 with the AVPacket. The decoded image is
> green and purple and two halves of the same image. During my debugging i
> can tell that the decoded AVFrame data is incorrect. So i am assuming its a
> decoder issue.
> Any suggestions on how to fix this?
> _______________________________________________
> libav-api mailing list
> libav-api at libav.org
> https://lists.libav.org/mailman/listinfo/libav-api

More information about the libav-api mailing list