[Libav-user] MPEG2 4:2:2 encoding in 4:3 sample_aspect_ratio

Alex Cohn alexcohn at netvision.net.il
Thu Mar 15 18:04:25 CET 2012


On Mar 15, 2012 12:33 PM, <francesco at bltitalia.com> wrote:
>
> Hi to all
> have anyone attempted to encode in 4:3 format ?  I can't do.  If I
> set:
>
> AVRational vform;
>
>
>  codec = avcodec_find_encoder(CODEC_ID_MPEG2VIDEO);
>  if (!codec) { Memo1->Lines->Add("Unable to find codec "); goto
> _Encod1Frame_err;}
>
>  pCodecCtx = avcodec_alloc_context3(codec);
>  if(pCodecCtx==NULL) { Memo1->Lines->Add("Unable to alloc codec
> context");goto _Encod1Frame_err;}
>  pFrame = avcodec_alloc_frame();
>  if(pFrame==NULL) { Memo1->Lines->Add("Unable to alloc frame");goto
> _Encod1Frame_err;}
>
>  vform.num = 4;
>  vform.den = 3;
>  pCodecCtx->sample_aspect_ratio = vform;

IIRC this is not the target aspect ratio,but rather how to distort the
input frame. Therefore, if you have 4:3 input, you get 16:9 output.

BR,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120315/35e4b9d3/attachment.html>


More information about the Libav-user mailing list