FFmpeg recipe
FFmpeg: Crop a Video to 9:16 (Vertical for Reels / Shorts)
crop=ih*9/16:ih takes the full height and crops to a 9:16 width centered horizontally. The result is ready for TikTok, Reels, and Shorts.
Command
ffmpeg -i input.mp4 -vf "crop=ih*9/16:ih" -c:v libx264 -crf 23 -c:a copy -y output_vertical.mp4Prefer no terminal?
Use the Video Crop in your browser
What each flag does
| -i | Input file. Can be a video, audio, or image. Repeat for multiple inputs. |
|---|---|
| -vf | Video filter chain. e.g. scale=1280:720, crop=, fps=30. |
| -c:v | Video codec for output. e.g. libx264, libx265, libvpx-vp9. |
| -crf | Constant Rate Factor — quality target (lower = better, larger file). 23 is visually lossless for libx264. |
| -c:a | Audio codec for output. e.g. aac, libmp3lame, copy. |
| crop=ih*9/16:ih | Crop output: width = input_height × 9/16, height = input_height. Result is 9:16 aspect. |
Notes & gotchas
- Add :((iw-ih*9/16)/2):0 to crop=W:H:X:Y to manually offset the crop horizontally.
- Resize to 1080×1920 after cropping for Reels-native resolution: -vf "crop=ih*9/16:ih,scale=1080:1920".
Check it worked
ffprobe -v error -show_entries stream=width,height -of csv=p=0 output.mp4A width to height ratio of 9:16, for example 1080 by 1920.
What to change
| The crop is fixed for the whole clip | Centre-cropping a wide shot loses whatever is at the sides. Check the subject stays inside the window for every second, not just the first frame. |
|---|---|
| Move the window | crop takes x and y after width and height. crop=ih*9/16:ih:(iw-ih*9/16)/3:0 shifts it left of centre. |
| Pad instead of crop | If nothing can be lost, scale down and pad to 9:16. You get black bars and keep the whole frame. |
If it fails
Invalid too big or non positive size for width or height.
Why: The crop rectangle extends past the edge of the source frame.
Fix: Check the source dimensions first, and keep x plus width within the frame width.
The subject is cut out of frame.
Why: The crop defaults to the centre, and the subject is not centred.
Fix: Set the x and y offsets explicitly rather than relying on the centre.