Skip to main content
Added a more generic option, because the given commands will only work if the input has a lower aspect ratio.
Source Link

You have two main options to make it fit after using scale: pad or crop. Take a look at these examples and the documentation for each filter.

pad

This will pillarbox the image.

enter image description here

ffmpeg -i input -vf "scale=-1:720,pad=1280:ih:(ow-iw)/2" output

A more generic command that will work for all input file aspect ratios will use force_original_aspect_ratio=1 as an option to scale:

ffmpeg -i input -vf "scale=w=1280:h=720:force_original_aspect_ratio=1,pad=1280:720:(ow-iw)/2:(oh-ih)/2" output

crop

This will cut off the top and bottom.

enter image description here

ffmpeg -i input -vf "scale=1280:-1,crop=iw:720" output

A more generic command that will work for all input file aspect ratios will use force_original_aspect_ratio=2 as an option to scale:

ffmpeg -i input -vf "scale=w=1280:h=720:force_original_aspect_ratio=2,crop=1280:720" output

Use your player

If you don't want to bother with re-encoding, then any player worth using should allow you to do this upon playback. Example using ffplay:

ffplay -vf "scale=-1:720,pad=1280:ih:(ow-iw)/2" input

Or see "Video Effects" in VLC.

You have two main options to make it fit after using scale: pad or crop. Take a look at these examples and the documentation for each filter.

pad

This will pillarbox the image.

enter image description here

ffmpeg -i input -vf "scale=-1:720,pad=1280:ih:(ow-iw)/2" output

crop

This will cut off the top and bottom.

enter image description here

ffmpeg -i input -vf "scale=1280:-1,crop=iw:720" output

Use your player

If you don't want to bother with re-encoding, then any player worth using should allow you to do this upon playback. Example using ffplay:

ffplay -vf "scale=-1:720,pad=1280:ih:(ow-iw)/2" input

Or see "Video Effects" in VLC.

You have two main options to make it fit after using scale: pad or crop. Take a look at these examples and the documentation for each filter.

pad

This will pillarbox the image.

enter image description here

ffmpeg -i input -vf "scale=-1:720,pad=1280:ih:(ow-iw)/2" output

A more generic command that will work for all input file aspect ratios will use force_original_aspect_ratio=1 as an option to scale:

ffmpeg -i input -vf "scale=w=1280:h=720:force_original_aspect_ratio=1,pad=1280:720:(ow-iw)/2:(oh-ih)/2" output

crop

This will cut off the top and bottom.

enter image description here

ffmpeg -i input -vf "scale=1280:-1,crop=iw:720" output

A more generic command that will work for all input file aspect ratios will use force_original_aspect_ratio=2 as an option to scale:

ffmpeg -i input -vf "scale=w=1280:h=720:force_original_aspect_ratio=2,crop=1280:720" output

Use your player

If you don't want to bother with re-encoding, then any player worth using should allow you to do this upon playback. Example using ffplay:

ffplay -vf "scale=-1:720,pad=1280:ih:(ow-iw)/2" input

Or see "Video Effects" in VLC.

added 276 characters in body
Source Link
llogan
  • 60.6k
  • 17
  • 130
  • 152

You have two main options to make it fit after using scale: pad or crop. Take a look at these examples and the documentation for each filter.

pad

This will pillarbox the image.

enter image description here

ffmpeg -i input -vf "scale=-1:720,pad=1280:ih:(ow-iw)/2" output

crop

This will cut off the top and bottom.

enter image description here

ffmpeg -i input -vf "scale=1280:-1,crop=iw:720" output

Use your player

If you don't want to bother with re-encoding, then any player worth using should allow you to do this upon playback. Example using ffplay:

ffplay -vf "scale=-1:720,pad=1280:ih:(ow-iw)/2" input

Or see "Video Effects" in VLC.

You have two main options to make it fit after using scale: pad or crop. Take a look at these examples and the documentation for each filter.

pad

This will pillarbox the image.

enter image description here

ffmpeg -i input -vf "scale=-1:720,pad=1280:ih:(ow-iw)/2" output

crop

This will cut off the top and bottom.

enter image description here

ffmpeg -i input -vf "scale=1280:-1,crop=iw:720" output

You have two main options to make it fit after using scale: pad or crop. Take a look at these examples and the documentation for each filter.

pad

This will pillarbox the image.

enter image description here

ffmpeg -i input -vf "scale=-1:720,pad=1280:ih:(ow-iw)/2" output

crop

This will cut off the top and bottom.

enter image description here

ffmpeg -i input -vf "scale=1280:-1,crop=iw:720" output

Use your player

If you don't want to bother with re-encoding, then any player worth using should allow you to do this upon playback. Example using ffplay:

ffplay -vf "scale=-1:720,pad=1280:ih:(ow-iw)/2" input

Or see "Video Effects" in VLC.

Source Link
llogan
  • 60.6k
  • 17
  • 130
  • 152

You have two main options to make it fit after using scale: pad or crop. Take a look at these examples and the documentation for each filter.

pad

This will pillarbox the image.

enter image description here

ffmpeg -i input -vf "scale=-1:720,pad=1280:ih:(ow-iw)/2" output

crop

This will cut off the top and bottom.

enter image description here

ffmpeg -i input -vf "scale=1280:-1,crop=iw:720" output