How to scale and crop a video with FFMPEG | Resize and cut

Опубликовано: 13 Апрель 2021
на канале: The FFMPEG guy
3,955
75

Today, we show you how to scale and crop a video using ffmpeg. Scaling and cropping is used to expand a video and cut it so that it fits a needed output format.

ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
EXAMPLES
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
❶ Doubling the size of an HD (1280 x 720 * 2 = 2560 x 1440) video and cutting the scaled video back to fit an HD screen resolution (1280 x 720)
→ ffmpeg -i input.mp4 -vf scale=2560:1440,crop=1280:720 output01.mp4

with:
*scale = FFMPEG video filter to resize a video
2560 = 1280 *2 = output width of the resized video
1440 = 720 *2 = output height of the resized video

The scale transformation is then followed (chained) by a crop video filter:
crop = FFMPEG video filter to cut part of a video
1280 = The cropping width (around the reference point) for the output video
720 = The cropping height (around the reference point) for the output video
Note: In this scenario (2 parameters only for the crop video filter), the reference point is the center of the input video

Note that you will always introduce noise and lose details when scaling up

❷ Doubling the size of an HD (1280 x 720 * 2 = 2560 x 1440) video and cutting the scaled video back to fit an HD screen resolution (1280 x 720) starting from position 1000,600
→ ffmpeg -i input.mp4 -vf scale=iw*2:-1,crop=1280:720:1000:600 output02.mp4

with:
*scale = FFMPEG video filter to resize a video
iw = input video width = 1280
iw * 2 = output width of the resized video = 1280 *2 = 2560
-1 = output height of the resized video = let ffmpeg automatically calculate the output height using the same width/height ratio than in the input video = 720 *2 = 1440

The scale transformation is then followed (chained) by a crop video filter:
crop = FFMPEG video filter to cut part of a video
1280 = The cropping width (around the reference point) for the output video
720 = The cropping height (around the reference point) for the output video
1000 = horizontal distance from reference point before cropping starts
600 = vertical distance from reference point before cropping starts
Note: In this scenario (4 parameters), the reference point is the upper left corner of the input video (0, 0)

Note that you will always introduce noise and lose details when scaling up
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
→ Catch up with the FFMPEG guy Channel
   • ALL THE VIDEOS FROM THE CHANNEL  
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
MUSIC
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
→ Stru Funk - Dougie Wood
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
An FFMPEG question?
Ask the FFMPEG guy
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ


Смотрите видео How to scale and crop a video with FFMPEG | Resize and cut онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь The FFMPEG guy 13 Апрель 2021, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 3,955 раз и оно понравилось 75 людям.