FFmpeg 9:16 Vertical Video Cropping & Lossless Trimming Cheatsheet
The canonical FFmpeg command to cut and center-crop any 16:9 horizontal video into a platform-compliant 1080×1920 (9:16) vertical clip is `ffmpeg -ss START -i input.mp4 -t DUR -vf "crop=ih*9/16:ih,scale=1080:1920:flags=lanczos" -c:v libx264 -crf 18 -pix_fmt yuv420p -c:a aac -b:a 192k -movflags +faststart out.mp4`.
Step-by-Step Execution Pipeline
1. Fast Input Seeking (`-ss` Before `-i`)
Placing `-ss HH:MM:SS` before `-i input.mp4` uses keyframe fast seeking instead of decoding every frame from 00:00:00 — jumping straight to minute 55 of a 2-hour 4K master in milliseconds.
2. Exact Aspect-Ratio Math (`crop=ih*9/16:ih`)
Using `ih*9/16:ih` computes exact vertical width dynamically from input height (`607.5px` on 1080p, `1215px` on 2160p) and centers automatically. Shift left or right by adding explicit `x` coordinates: `crop=ih*9/16:ih:x=200:y=0`.
3. Compatibility Flags That Prevent Black Screens on iOS/Android
Always include `-pix_fmt yuv420p` (converting 10-bit or 4:2:2 camera footage to universal 8-bit 4:2:0) and `-movflags +faststart` (moving the MP4 moov atom to file start for instant web/mobile streaming playback).
4. Lossless Pre-Trim (`-c copy`) for Zero Quality Loss
When removing dead air or isolating a 3-minute chapter before importing into Resolve, CapCut, or OpusClip, `-c copy` copies raw H.264/AAC bitstreams without re-encoding — completing in <1 second with zero generational loss.
5. Automated Batch Generation via ClipSmartAI Cutlist Planner
Instead of hand-typing timestamps for 12 clips, enter all markers once in the ClipSmartAI homepage studio to generate a complete shell-safe `bash` script with sanitized filenames and optional `-14 LUFS` loudness.
Reference Local Command / Template
# 1) 9:16 Center Crop + Lanczos Scale + Web Faststart ffmpeg -y -ss 00:08:15 -i "input.mp4" -t 45 \ -vf "crop=ih*9/16:ih,scale=1080:1920:flags=lanczos" \ -c:v libx264 -preset medium -crf 18 -pix_fmt yuv420p \ -c:a aac -b:a 192k -movflags +faststart "clip-9x16.mp4" # 2) Blurred Background Pad (keeps full 16:9 slide/screen intact inside 9:16) ffmpeg -y -ss 00:08:15 -i "slides.mp4" -t 45 \ -filter_complex "[0:v]scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920,boxblur=25:5[bg];\ [0:v]scale=1080:-2[fg];[bg][fg]overlay=(W-w)/2:(H-h)/2" \ -c:v libx264 -crf 18 -pix_fmt yuv420p -c:a aac -b:a 192k -movflags +faststart "clip-slides-9x16.mp4"
Recommended Stack
Relevant Comparisons
Workflow Questions & Technical Details
Why does `-pix_fmt yuv420p` matter in FFmpeg social video exports?
Modern mirrorless cameras and screen recorders often output 10-bit or 4:2:2 pixel formats that play fine in VLC but fail or show green/black frames on iOS, QuickTime, and social uploaders. `-pix_fmt yuv420p` ensures universal playback.
What CRF value should I use with libx264 for YouTube Shorts and TikTok?
CRF 18 gives visually transparent master quality for 1080×1920 social uploads without bloated uncompressed file sizes. Use CRF 20 if targeting strict mobile upload size limits.
How do I shift the 9:16 crop box off-center for a two-person couch interview?
Specify the X offset explicitly in pixels: `crop=ih*9/16:ih:X:0`, where `X=0` frames the far-left speaker and `X=iw-(ih*9/16)` frames the far-right speaker.
Does ClipSmartAI upload my video files when generating FFmpeg commands?
No. ClipSmartAI runs 100% locally in your browser and never uploads video bytes — it outputs exact copy-paste shell commands you run on your own machine.