View Full Version : mencoder question: Crop and Add Borders
JoeBG
9th November 2007, 17:52
Hi,
I fighting in the moment with the possibilities to crop a video and the finally add the borders.
I understood the part with the crop but did not find very much about the Add Borders part. It seem sto be easy in ffmpeg with "pad Top" but how is this working with mencoder?
The only thing I found was
-expand=w:h
But I did not get the usage. I understood to use the original size of the video (e. g. 720.576). Is this correct?
nm
9th November 2007, 18:37
The expand filter is exactly what you need to use. For example to crop a 320x240 area from the center of the frame and then add 32-pixel borders to left and right, and 64-pixel borders to top and bottom, you could use this filter chain:-vf crop=320:240,expand=-64:-128:32:64
The manual page (http://www.mplayerhq.hu/DOCS/man/en/mplayer.1.html) defines all these parameters quite clearly, if you take the time to read and understand it. Use MPlayer to test the filter chain on your source video before encoding with MEncoder.
Why exactly do you want to add borders?
JoeBG
10th November 2007, 09:02
The expand filter is exactly what you need to use. For example to crop a 320x240 area from the center of the frame and then add 32-pixel borders to left and right, and 64-pixel borders to top and bottom, you could use this filter chain:-vf crop=320:240,expand=-64:-128:32:64
The manual page (http://www.mplayerhq.hu/DOCS/man/en/mplayer.1.html) defines all these parameters quite clearly, if you take the time to read and understand it. Use MPlayer to test the filter chain on your source video before encoding with MEncoder.
Why exactly do you want to add borders?
I just want to do it like in Avisynth. When I crop, I have to add borders. Is this different here from Avisynth?
nm
10th November 2007, 13:58
You don't need to add borders unless you want to have them in the resulting video. Usually that is a bad idea because encoding them will take relatively large amounts of bitrate when compared to an encode of same quality without black borders. If the reason for adding borders is to get a specific output resolution after cropping (mod-16 or something like PAL 720x576), you would be much better off by scaling the video to the target resolution, for example: -vf crop=696:564,scale=720:576 (and perhaps use the -sws parameter to select a suitable scaler, such as lanczos).
The only cases I can think of where borders make sense would be DVD-compatible encoding when the aspect ratio is not 4:3 or 16:9 (letterboxing), or using a black space below the video for hard subtitles.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.