# 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. Replaceinput.mp4
with the actual path to your video.-vf scale=...
: This applies thescale
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.