[FFmpeg-user] Was: A problem with scale filter - possible solution

Alexander Bokovikov openworld at uralweb.ru
Fri Dec 9 18:49:52 CET 2011

Hi, All,

This is not a bug report, but a possible solution, so I hope it is  
legal here...

Pixel aspect ratio fix:


     if (inlink->sample_aspect_ratio.num != 1 || inlink- 
 >sample_aspect_ratio.den != 1){
         outlink->sample_aspect_ratio = av_mul_q((AVRational){outlink- 
 >h * inlink->w, outlink->w * inlink->h}, inlink->sample_aspect_ratio);
     } else
         outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;


     if (picref->video->sample_aspect_ratio.num != 1 || picref->video- 
 >sample_aspect_ratio.den != 1)
		av_reduce(&outpicref->video->sample_aspect_ratio.num, &outpicref- 
				  (int64_t)picref->video->sample_aspect_ratio.num * outlink->h *  
				  (int64_t)picref->video->sample_aspect_ratio.den * outlink->w *  
	else {
		outpicref->video->sample_aspect_ratio.num = picref->video- 
		outpicref->video->sample_aspect_ratio.den = picref->video- 

In general I'm not sure I know what you change pixel aspect ratio for,  
but it isn't worth of doing at least when the source has 1:1, isn't it?

Hope this can be fixed.

More information about the ffmpeg-user mailing list