[FFmpeg-user] Automatic Aspect Ratio Conversion

Stefano Sabatini stefano.sabatini-lala at poste.it
Wed Jul 27 10:42:08 CEST 2011

On date Tuesday 2011-07-26 22:56:21 +1000, Dan Flett encoded:
> -----Original Message-----
> Behalf Of Stefano Sabatini
> Subject: Re: [FFmpeg-user] Automatic Aspect Ratio Conversion
> On date Tuesday 2011-07-26 14:51:39 +1000, Dan Flett encoded:
> > However I found that if the input video is anamorphic (i.e. non-square 
> > pixel), the output is also anamorphic, and the DAR / SAR information 
> > is lost.
> Yes this is a bug which needs to be fixed.
> Currently a=in_w/in_h, which is not what the docs say.
> Possible solutions:
> 1. keep the current semantics for a, and fix the docs 2. change semantics
> for a to match the docs
> I can't say which of 1. or 2. is better, they both have problems, what do
> you suggest to do?
> And of course we'll have to add the sar/dar variables.
> ----------------------------------------
> Under the "Pad" heading, it does list:
> `dar, a'
>     input display aspect ratio, same as iw / ih 
> Did someone just change this? :)

It was me, and I realized soon it was half-broken, as "dar" is not
simply iw/ih.

> Perhaps, to be consistent with the ffmpeg/ffprobe output, sar should be par
> (or par and sar be the same).


> I've noticed that when using "scale", using -1 for width or height maintains
> the display aspect ratio, but throws away the sar, leading to possibly
> anamorphic output.  

> I find that in general, I like to start with the "scale=iw*sar:ih" to get
> everything as square pixels, then do my transformations as square pixels,
> then scale it to anamorphic at the end if I need to (and if it's IMX-D10,
> pad 32 lines to the top after that).

The problem of this approach is that it requires a completely
unnecessary scaling, a possibly CPU-intensive operation.

> I also can't find much in the way of documentation for the functions such as
> "max()" - max() itself is fairly obvious, but I'd like to know what other
> functions I can use, and how they work.  I checked out the libavfilter code
> and couldn't find them there either.

Check the "EXPRESSION EVALUATION" section in the manual (incomplete,
patches are welcome).

More information about the ffmpeg-user mailing list