[Ffmpeg-devel] Re:208x104 image after avcodec_decode_video

QuickTime ffmpeg
Sat May 21 11:30:41 CEST 2005


Dear:
> 
> HELP
> 
> after the calling of avcodec_decode_video i obtain an AVFrame picture where
> linesize[0] is 208 and linesize[1] is 104
> i should obtain a 176x144
> i'm using a carphone.mpg (encoded with mpeg1video)
IMO,the picture is padded with 16 pixel at each edge for ME/MC,
so the linesize[0] = (176+16+16),i.e. 208
linesize[1] = (88+8+8)=104,

> why does it happen? what could i do?

You dont need do anything!,just directly call img_convert(.......)
or see the following codes:
void ffmpeg_dump_yuv(char *filename,AVPicture *pic,int width,int height)
{
   FILE *fp =0;
   int i,j,shift;
   uint8_t *yuv_factor;

   fp = fopen(filename,"wb");
   if(fp) {
       for(i = 0; i < 3; i++) {
           shift = (i == 0 ? 0:1);
           yuv_factor = pic->data[i];
           for(j = 0; j < (height>>shift); j++) {
               fwrite(yuv_factor,(width>>shift),1,fp);
               yuv_factor += pic->linesize[i];
           }
       }
       fclose(fp);
   }
}

}
> 
> the code is the same used by apiexample.c
> 
> thanks 4 your attention
> 
> paolo





More information about the ffmpeg-devel mailing list