[FFmpeg-user] Command line option to convert to square pixels?

Robert Krüger krueger at lesspain.de
Fri Nov 18 21:56:48 CET 2011


On Nov 18, 2011, at 18:06 , Jamie Tufnell wrote:

> How can I convert to square pixels IF necessary, AND maintain height
> based the input file's display aspect ratio?
> 
> I want to force the width of the output file, but set height based on
> the input file's display aspect ratio and convert to square pixels if
> necessary.
> 
> Right now I use -vf "scale=640:-1" and I want to extend that to
> convert to square pixels as well.
> 
> e.g. the same command line option would have the following effects:
> 
> (no square pixel conversion necessary)
> in: 1440x810 PAR 1:1 DAR 16:9   => out: 640x360 PAR 1:1 DAR 16:9
> in: 1440x1080 PAR 1:1 DAR 4:3   => out: 640x480 PAR 1:1 DAR 4:3
> 
> (convert to square pixels)
> in: 1440x1080 PAR 4:3 DAR 16:9  => out: 640x360 PAR 1:1 DAR 16:9
> 
> Is there a way to do this?
> 

have you tried using an expression in the scale filter that uses the sar constant (http://ffmpeg.org/ffmpeg.html#scale) to compute width correctly and then use the setsar filter with a value of 1:1 to force square pixels? 

I would guess that should do the job.





More information about the ffmpeg-user mailing list