[FFmpeg-user] Automatically scaling videos and adding padding

Fabian Lesniak fabian at lesniak-it.de
Mon Jun 13 11:03:00 CEST 2011


Am Montag, 13. Juni 2011, 10:07:50 schrieb Francesco Turco:
> > Why don't calculate with other tool? "bash" or "bc"? Ffmpeg is a video
> > processing tool, calculating shouldn't its main function, I think.
> 
> Yes, I could do as you suggest, but that way I have to manually tell the
> bash script the resolution of the source video. FFmpeg, instead, is able
> to determine it automatically, and provides the iw/ih variables which
> are very handy.
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user

I wrote some bigger bash script to convert mpeg tv-recordings: This is what I 
did to get the resolution out of ffmpeg:

ffmpeg -i file.avi 2>&1 | grep 'Video:' | awk -F ', ' '{printf $3}' | sed -e 
's/\[PAR//g' -e 's/x/:/g' | awk '{printf $1 " " $2}'

This gives me the following format:
resolutionx:resolutiony parx:pary
This is because normally, you also need the PAR to calculate a new PAR 1:1 
resolution.


More information about the ffmpeg-user mailing list