[FFmpeg-devel] [patch] pixel vs aspect ratio behaviour

vmrsss vmrsss
Wed May 28 05:07:10 CEST 2008


On 28 May 2008, at 00:35, Michael Niedermayer wrote:
> On Sat, May 24, 2008 at 02:01:53AM +0100, vmrsss wrote:
>> Hello.
>>
>> 	I think ffmpeg could be improved re the subject. Currently ffmpeg
>> preserves (display) *aspect* ratio when resampling, and this is  
>> indeed
>> extremely reasonable. However, it does so also when cropping and/or
>> padding, and this is the wrong behaviour: cropping and padding should
>> preserve the *pixel* ratio, and not the *aspect*. Because by cropping
>> (padding) one typically wants to chop away (extend) parts of the  
>> frame, not
>> to change shapes in it (exactly as when scaling one typically wants  
>> to
>> change the frame size, not shapes).
>>
>> (Incidentally: the current incarnation of avfilter always preserves  
>> the
>> pixel aspect ratio, also in the case of scale=....)
>
> Code which will be replaced by avfilter will be rejected unless its  
> a security
> fix.

Clearly one wouldn't embark in any major enterprise concerning code  
destined to go, but would an elementary bug-fix exercise like this not  
be useful even if avfilter is not farther away than just a few months?  
In any case, it is likely that avfilter will work in terms of a PAR  
rather than aspect ratio, so something like

-        video_enc->sample_aspect_ratio =  
av_d2q(frame_aspect_ratio*video_enc->heig
ht/video_enc->width, 255);
+        video_enc->sample_aspect_ratio = av_d2q(par, 255);

will probably happen anyway.




More information about the ffmpeg-devel mailing list