I am trying the padding option using ffmpeg, but I am getting an error.

I am following this tutorial. Here's the error:

ffmpeg version git-2013-11-13-129af66 Copyright (c) 2000-2013 the FFmpeg developers
built on Nov 13 2013 16:40:26 with gcc 4.4.3 (GCC)
configuration: --arch=arm --target-os=linux --enable-cross-compile --cross-prefix=/Users/sunitha/Downloads/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi- --prefix=../build --sysroot=/Users/sunitha/Downloads/android-ndk/platforms/android-9/arch-arm --extra-cflags=' -I/Users/sunitha/Downloads/android-ndk/platforms/android-9/arch-arm/usr/include -I/Users/sunitha/Downloads/full_ffmpeg/ffmpeg-android/libmp3lame/include -DANDROID -marm -march=armv6 ' --extra-ldflags=' -L/Users/sunitha/Downloads/android-ndk/platforms/android-9/arch-arm/usr/lib -L/Users/sunitha/Downloads/full_ffmpeg/ffmpeg-android/libmp3lame/lib' --disable-debug --enable-libmp3lame --disable-ffplay --disable-ffprobe --disable-ffserver --enable-avfilter --enable-decoders --enable-demuxers --enable-encoders --enable-filters --enable-indevs --enable-network --enable-parsers --enable-protocols --enable-swscale --enable-gpl --enable-nonfree
libavutil      52. 39.100 / 52. 39.100  
libavcodec     55. 18.102 / 55. 18.102  
libavformat    55. 12.102 / 55. 12.102  
libavdevice    55.  3.100 / 55.  3.100  
libavfilter     3. 80.100 /  3. 80.100  
libswscale      2.  3.100 /  2.  3.100  
libswresample   0. 17.102 /  0. 17.102  
libpostproc    52.  3.100 / 52.  3.100
Unrecognized option 'padtop 120'.
Error splitting the argument list: Option not found

Try it this way instead:

 ffmpeg -i input.avi -vf "pad=width=640:height=480:x=0:y=120:color=black" output.avi  

The video filter syntax is the new way to use padding. Here the video output width and height are 640x480 and the image is placed 120 pixels from top, 0 pixels from left. To work out your exact dimensions, just apply the same principles.

See the pad video filter documentation for more details.

  • Rajib i might be a stupid question, but i need to add also for portrait video so how can i do it. Is it works for only landscape. I tried it for portrait but not happening properly. – Gururaj Dec 19 '13 at 13:10
  • @Gururaj You should post the exact dimensions of the "portrait" video, the exact dimensions of the output ("frame") video. I'm not sure, but I think you can add it to your main question itself by editing. – Rajib Dec 19 '13 at 14:51
  • Rajib i have a portrait video of dimension 400*800 i want to add padding to make this as a square video. What command I should pass?. Please provide sample command for this particular dimension video. – Gururaj Dec 20 '13 at 6:55
  • @Gururaj only a guess but I think the vf parameter for you (assuming you want it horizontally centered with black padding on the sides) would be: -vf "pad=width=800:height=800:x=200:y=0:color=black" (y=200 because that's the extra 400 px padding / 2) – r_alex_hall Aug 28 '19 at 0:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.