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

francesco at bltitalia.com francesco at bltitalia.com
Fri Mar 16 08:42:56 CET 2012


At 19.04 15/03/2012 +0200, you wrote:
>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
>
>
>
>__________ Informazioni da ESET NOD32 Antivirus, versione del database
delle firme digitali 6953 (20120309) __________
>
>Il messaggio è stato controllato da ESET NOD32 Antivirus.
>
>www.nod32.it
>
><p>On Mar 15, 2012 12:33 PM, <<a
href="mailto:francesco at bltitalia.com">francesco at bltitalia.com</a>> wrote:<br>
>><br>
>> Hi to all<br>
>> have anyone attempted to encode in 4:3 format ?  I can't do.  If I<br>
>> set:<br>
>><br>
>> AVRational vform;<br>
>><br>
>><br>
>>  codec = avcodec_find_encoder(CODEC_ID_MPEG2VIDEO);<br>
>>  if (!codec) { Memo1->Lines->Add("Unable to find codec
"); goto<br>
>> _Encod1Frame_err;}<br>
>><br>
>>  pCodecCtx = avcodec_alloc_context3(codec);<br>
>>  if(pCodecCtx==NULL) { Memo1->Lines->Add("Unable to alloc
codec<br>
>> context");goto _Encod1Frame_err;}<br>
>>  pFrame = avcodec_alloc_frame();<br>
>>  if(pFrame==NULL) { Memo1->Lines->Add("Unable to alloc
frame");goto<br>
>> _Encod1Frame_err;}<br>
>><br>
>>  vform.num = 4;<br>
>>  vform.den = 3;<br>
>>  pCodecCtx->sample_aspect_ratio = vform;</p>
><p>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.</p>
><p>BR,<br>
>Alex<br>
></p>
>_______________________________________________
>Libav-user mailing list
>Libav-user at ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/libav-user
>
>
>
>__________ Informazioni da ESET NOD32 Antivirus, versione del database
delle firme digitali 6953 (20120309) __________
>
>Il messaggio è stato controllato da ESET NOD32 Antivirus.
>
>www.nod32.it
>
>

Ok, thanks for the answer.  So If I have well understood, in this case I sould
insert 1:1 that means no frame distortion.  With this settings if I start
from a 4:3 frame (720x576) I obtain the same frame form in output.  Right ?



More information about the Libav-user mailing list