[Libav-user] Right pixel column is repeated in the left

Alex Cohn alexcohn at netvision.net.il
Wed Nov 2 17:11:08 CET 2011

On Wed, Nov 2, 2011 at 17:43, Drabner <drabner at zoobe.com> wrote:
> I did that:
> //--------------------------------------------
> ofstream testFile;
> testFile.open(filepath(each frame another file));

Methinks you're missing ios_base::binary as second parameter for open()

> testFile.write((char*)ptr->picture->data[0], ptr->picture->linesize[0]);

The second parameter should be ptr->picture->linesize[0]*ptr->picture->height

> testFile.write((char*)ptr->picture->data[1], ptr->picture->linesize[1]);

The second parameter should be ptr->picture->linesize[1]*ptr->picture->height/2

> testFile.write((char*)ptr->picture->data[2], ptr->picture->linesize[2]);

The second parameter should be ptr->picture->linesize[2]*ptr->picture->height/2

> testFile.close();
> //--------------------------------------------
> But when opening it with irfanView, it asks for size, etc.
> I give the correct size, and 24BPP (with checked YUV 4:2:0), and Planar as
> an option. This should be correct for PIX_FMT_YUV420P and the way I'm
> writing the file, shouldn't it?

The procedure is correct.

> And all I get are completely grey pictures. Each frame the same.
> But even if I play around with other BPP settings, no YUV, etc. I get no
> picture that would make sense to me.

Please try again.


More information about the Libav-user mailing list