[FFmpeg-user] Problem with vf pad ... help please

Mark Himsley mark at mdsh.com
Sun Sep 16 15:20:12 CEST 2012


On 15/09/12 23:40, PyProg PyProg wrote:
> Hello Mark,
>
> 2012/9/15 Mark Himsley <mark at mdsh.com>:
>> You appear to be scaling to 900 x 720 then padding to 900 x 720 and
>> asking ffmpeg to add 190 pixels at the top of the picture. I don't think
>> ffmpeg is allowed to break the rules of maths.
>>
>> Do you mean something more like this?
>>
>> ffmpeg -i input.avi -aspect 16:9 -vf
>> scale=900:530,pad=900:720:0:190:0xd28080 -sameq -y output.avi
>>
>> Not that I'm saying it's going to look very good - but it's physically
>> possible.
>
> Excuse me in advance for the translation of my response (I'm french).

Your English is probably better than mine.

> In fact that's the problem, I have an original video size 768x576
 > (ratio 4/3)

Not according to ffmpeg:

Input #0, avi, from '/home/toto/blender/dronez.avi':
   Duration: 00:03:11.24, start: 0.000000, bitrate: 1536 kb/s
     Stream #0:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 720x576

Your original video is a 4:3 standard definition 720x576 file. You might 
have a video player (QuickTime, for instance) that lies slightly and 
tells you the file is 768x576 because it knows that standard definition 
pixels are not square (although Apple should scale up to 788x576, but 
that's another argument).

> and I want to add bands on each side (two bands of equal
> size to the left and right) to convert this video in 1280x720 without
> distortion (the video will keep its ratio 4/3) is simply the size of
> the stripes on each side that will transform this video 4/3 to 16/9.

I'm sure I will get flack for this - but this is the way I would scale 
that video (keeping your pink border):

-vf scale=984:720:interl=1,pad=1280:720:148:0:0xd28080

Those numbers might be unfamiliar to many, but retains the video's 
display aspect ratio to within 0.07%.

> I must be able to find a generic method (because the original videos
> are not all in 768x576) and may be changed upon arrival in 1920x1080,
> 1280x720, 960x540, or 852x480.

Then you must learn how to write a script that probes your source file 
first and calculates the scale and pad arguments for you.

> I would also do the opposite (transform 16/9 to 4/3 by adding strips
> of the same size on the top and on the bottom).
>
> I think the pad filter is the best way to do this, but how?, Can you
> put me on the way?
>
>> --
>> Mark
>
> a+
>



More information about the ffmpeg-user mailing list