[FFmpeg-user] Crop, Scale, Pad without distortion

Carl Eugen Hoyos ceffmpeg at gmail.com
Mon Jan 27 00:46:38 EET 2020


Am So., 26. Jan. 2020 um 23:38 Uhr schrieb Hans Carlson <forbyta at gmx.com>:

>    Input #0, mpeg, from 'TEMP-original.vob':
>      Duration: 01:24:52.03, start: 0.287267, bitrate: 5841 kb/s
>        Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, top first), 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
>        Stream #0:1[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 224 kb/s
>
> The actual video part (not including black bars) is (704:416:2:82)
> according to cropdetect.
>
> I'd like to end up with a video that's cropped to 704:416:2:82, scaled to
> 720x-1, padded to 720x480 with black bars only on the top/bottom, and a
> DAR of 16:9 instead of 4:3. Not necessarily in that order... I'm not sure
> of the "correct" filter order.

The order as written by you is correct (any other order can lead to worse
output).

[...]

> This is compressed horizontally (via ffplay) compared to original
>
>    $ ffmpeg -i TEMP-original.vob -codec:v mpeg2video -b:v 16384k -bufsize 4096k -maxrate 30000k -codec:a copy -vf crop=704:416:2:82,scale=720:-1,pad=720:480:0:27 -t 60 -f vob TEMP-crop-scale-pad.mpg

You have to force an aspect ratio to get the output you want, use
the setsar / setdar filter.

Carl Eugen


More information about the ffmpeg-user mailing list