Skip to content

Instantly share code, notes, and snippets.

@joe-oli
Created March 23, 2025 03:05
Show Gist options
  • Save joe-oli/6b5eb0328b185cc7ec7ed3526950e048 to your computer and use it in GitHub Desktop.
Save joe-oli/6b5eb0328b185cc7ec7ed3526950e048 to your computer and use it in GitHub Desktop.
video resolutions, ffmpeg notes
# Version 1: Full WxH specification
ffmpeg -i input.mp4 -vf scale=640:360 output_640x360.mp4

# Version 2: Width only, adjust height automatically
ffmpeg -i input.mp4 -vf scale=640:-1 output_640xauto.mp4

# Version 3: Height only, adjust width automatically
ffmpeg -i input.mp4 -vf scale=-1:360 output_auto_x360.mp4

Explanation:

  • ffmpeg -i input.mp4: This specifies the input video file. Replace input.mp4 with the actual path to your video.
  • -vf scale=...: This applies the scale video filter, which resizes the video.
  • 640:360: This sets the output resolution to 640 pixels wide and 360 pixels high.
  • 640:-1: This sets the output width to 640 pixels and tells FFmpeg to automatically calculate the height to maintain the original aspect ratio.
  • -1:360: This sets the output height to 360 pixels and tells FFmpeg to automatically calculate the width to maintain the original aspect ratio.
  • output_*.mp4: This specifies the output filename. You can change this to whatever you want.

Important Notes:

  • FFmpeg needs to be installed on your system for these commands to work.
  • These commands assume your input video has a valid aspect ratio that FFmpeg can use to correctly calculate the missing dimension when using -1.
  • If you need to change the output container from .mp4, simply change the file extension.

Common video resolutions, in the 16:9 ratio:

  1. 3840x2160 (240) (4K UHD)
  2. 2560x1440 (160) (1440p)
  3. 1920x1080 (120) (1080p)
  4. 1280x720 (80) (720p)
  5. 960x540 (60)
  6. 880x495 (55) 6'. 854x480 (53.375) Not exactly 16:9
  7. 640x360 (40)
  8. 480x270 (30) 8'. 426x240 (26.625) Not exactly 16:9
  9. 400x225 (25)
  10. 320x180 (20)
  11. 256x144 (16)
  12. 160x90 (10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment