[FFmpeg-user] Add white padding with filter_complex

Lou lou at lrcd.com
Wed Apr 10 02:06:13 CEST 2013

On Tue, 9 Apr 2013 17:09:10 -0600
Fernando Irías Escher <fernandoiriase at gmail.com> wrote:

> I'm using this command to generate a white padding for a grid:
> *
> *
> *ffmpeg -i 1.mp4   -filter_complex "[0:0]pad=iw*2:ih*2::0:0:0xFFFFFF" -c:v
> libx264 -preset:v veryfast -threads 0 -s 640:360        -map 0:a -c:a
> libfaac -b:a 96k grid.mp4*

I don't quite understand what you're trying to do with -s 640:360. I
think your pad will result in 1280x960. If you want that to be half that
size it will be 640x480: the same size as your input. Forcing 640x360
will vertically squish your video. Also, you can avoid using -s outside
of your filterchain so you have more control over when the scale is

-vf "pad=iw*2:ih*2:0:0:0xFFFFFF,scale=iw/2:-1"

If you still want 640x360 you can crop instead of forcing the size with
scale. This example will crop from the bottom (default will "center"
the crop):

-vf "pad=iw*2:ih*2:0:0:0xFFFFFF,scale=iw/2:-1,crop=iw:360:0:0"

Since you only have one input and one output, resulting in a simple
filtergraph [1], you can use -vf instead of -filter_complex. I'm not
sure if using -filter_complex for a simple filtergraph will cause any
issues (I don't think it would, but feel free to correct me).

[1] http://ffmpeg.org/ffmpeg.html#Simple-filtergraphs

More information about the ffmpeg-user mailing list