hartwell's Avatar
hartwell 11
41 Asked
445 Answered
61 Best
1
No one has voted on this question yet :(
1 year, 7 months ago

please explain the new pad syntax in ffmpeg

they used to use -padtop INTEGER -padbottom INTEGER but now they want you to use
-vf pad=width:hight:x:y:padcolor

http://ffmpeg.org/ffmpeg-doc.html#SEC7
10.7 pad

Add paddings to the input image, and places the original input at the given coordinates x, y.

It accepts the following parameters: width:height:x:y:color.

Follows the description of the accepted parameters.

`width, height'
Specify the size of the output image with the paddings added. If the value for width or height is 0, the corresponding input size is used for the output. The default value of width and height is 0.
`x, y'
Specify the offsets where to place the input image in the padded area with respect to the top/left border of the output image. The default value of x and y is 0.
`color'
Specify the color of the padded area, it can be the name of a color (case insensitive match) or a 0xRRGGBBAA sequence. The default value of color is "black".

i don't get it.

here's my real problem ... i am converting 4:3 video to be watched on a device with a 16:9 display and that device seems to ignore the aspect ratio parameter. so i see a widescreen image of fat(ter) people.

Solution: add black pillars on each side of the output image so the 4:3
My problem: I can't figure out the new option switch format to get ffmpeg to do what i want.

Thanks.
Tip for best answer: M$5.01
Separate topics with commas, or by pressing return. Use the delete or backspace key to edit or remove existing topics.

You can leave an optional "tip" with Mahalo's virtual currency, Mahalo Dollars. If you are asking a difficult question that might require some research, or if you'd like a wide variety of feedback, a higher tip often leads to more answers to your question.

M$

What is Your Answer?

0
0
0

2 Answers

1
brendonbarnett's Avatar
brendonbarnett | 1 year, 7 months ago
13
I'm no video pro, but this is what I think:

When using the new padding functions, you need to account both for the width of the padding AND the original image, not just the padding. So, if you choose a width that is actually smaller than your original image, it may stretch the image to fit your setting. Also, you only indicate the padding on the top and left, the right and bottom are calculated automatically as the difference of the total from your top and left settings.

For example, if you have an original image that is 480:360 and you set the total width to 520px, assuming the padding needs to be 20px on each side, but fail to indicate the padding size using the x:y options (defaulted to 0), you are essentially telling the program that you want no padding, but to increase the total width, thereby stretching the image. The same is true for the top and bottom. So, you need to indicate the new total width AND the correct padding. Assuming you don't want any top and bottom padding, the correct syntax for this example should be:

vf "pad=480:360:20:0:black"

If you are going to use padding you want -vf "pad=::::"

= Total width (image width + left and right padding)
= Total height (image height + top and bottom padding)
= This is essentially the left pad value (right pad will be determined automatically)
= This is essentially the top pad value (bottom pad will be determined automatically)
= The color of the padded region

The default is -vf "pad=0:0:0:0:black" which means use the image width and height as the totals and apply no padding.

You may also wish to use the following settings from Section 3.3 to help with the aspect ratio conversion.

`-aspect aspect'
Set aspect ratio (4:3, 16:9 or 1.3333, 1.7777).

`-croptop size (deprecated - use -vf crop=x:y:width:height instead)'
Set top crop band size (in pixels).

`-cropbottom size (deprecated - use -vf crop=x:y:width:height instead)'
Set bottom crop band size (in pixels).

`-cropleft size (deprecated - use -vf crop=x:y:width:height instead)'
Set left crop band size (in pixels).

`-cropright size (deprecated - use -vf crop=x:y:width:height instead)'
Set right crop band size (in pixels).

You can leave an optional "tip" with Mahalo's virtual currency, Mahalo Dollars. If you are asking a difficult question that might require some research, or if you'd like a wide variety of feedback, a higher tip often leads to more answers to your question.

M$
hartwell's Avatar
hartwell | 1 year, 7 months ago Report

and then... my head asploded!

brendonbarnett's Avatar
brendonbarnett | 1 year, 7 months ago Report

I didn't realize that some of my text was not inserted because I used the GT and LT symbols. Here is what should have been said:

If you are going to use padding you want -vf "pad=width:height:x:y:color"

width = Total width (image width + left and right padding)
height = Total height (image height + top and bottom padding)
x = This is essentially the left pad value (right pad will be determined automatically)
y = This is essentially the top pad value (bottom pad will be determined automatically)
color = The color of the padded region

xds's Avatar
xds | 1 year, 7 months ago Report

mine too!

Report Abuse

Post Reply Cancel
0
JGBrownYoung's Avatar
JGBrownYoung | 1 year, 6 months ago
2
I think yes

You can leave an optional "tip" with Mahalo's virtual currency, Mahalo Dollars. If you are asking a difficult question that might require some research, or if you'd like a wide variety of feedback, a higher tip often leads to more answers to your question.

M$

Report Abuse

Post Reply Cancel

Learn something new with our FREE educational apps!

Private lessons in the comfort of your own home. Get back in shape or finally pick up a guitar with our great experts guiding you the whole way!
Learn Guitar
Learn Hip Hop
Learn Pilates