[Ffmpeg-devel] Help needed to add black borders on video

Thomas Parmegiani thomasp
Thu Mar 1 15:45:22 CET 2007

Hi all !

I am trying to convert a 360x240 file to a 368x240 file.
That I need to do is to add black borders (4 pixels each) on left and right

AVFrame *pDestFrame;
AVPicture *pDestPicture;

//Decode the incoming frame
 iResult = avcodec_decode_video(dec, pframe, &got_picture, pkt->data,
//Ok ! I get the frame decoded (360x240)

//Allocate dest frame
pDestPicture = (AVPicture *) (pDestFrame = avcodec_alloc_frame());
avpicture_alloc( pDestPicture , stream->m_ovc->pix_fmt, 368,
240);//Allocatee with the dest dimensions

//Now I need to fill pDestPicture with pFrame at the correct position
? How to do this ? Can anyone help me ?

//then I need to fill the padding zone with the correct color value
img_pad(FinalPicture, pDestPicture, 240, 368, enc->pix_fmt, 0, 0, 4, 4,

Is this algorythm correct ?
If yes can anyone help me to fill the blanks ?

Thanks in advance...


More information about the ffmpeg-devel mailing list