A similar thing happens when i say the image is nv12. I even tried nv21. Is 
there a way to tell the image format from the AVFrame data? 

 Also, AVCodecContext.pix_fmt = AV_PIX_FMT_YUV420P thats going into 
avcodec_decode_video2. Is there some reason why the AVFrame data that coming 
out is not the same pix_fmt?

Sent from my iPhone

> On Jun 2, 2016, at 20:53, William Cheung <[email protected]> wrote:
> 
> 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 <[email protected]> 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
>> [email protected]
>> https://lists.libav.org/mailman/listinfo/libav-api
> _______________________________________________
> libav-api mailing list
> [email protected]
> https://lists.libav.org/mailman/listinfo/libav-api
_______________________________________________
libav-api mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-api

Reply via email to