If you convert 16:9 YouTube tutorials, screen recordings, or podcasts into 9:16 vertical Shorts/Reels/TikToks, opening a heavy NLE just to stack a blurred background behind a centered clip is massive overkill.
You can automate the entire pipeline — blurred 9:16 backdrop, sharp centered 16:9 foreground, broadcast -14 LUFS loudness normalization, and iOS/TikTok-safe yuv420p H.264 encoding — with a single FFmpeg filter_complex and a tiny Python batch wrapper.
1. The One-Line FFmpeg Filter Complex
Here is the production command that converts any 16:9 MP4 into a crisp 1080x1920 vertical clip with zero stretching and zero black bars:
ffmpeg -y -i input.mp4 \
-filter_complex "\
[0:v]scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920,boxblur=24:4,eq=brightness=-0.08:saturation=1.15[bg]; \
[0:v]scale=1080:-2:force_original_aspect_ratio=decrease[fg]; \
[bg][fg]overlay=(W-w)/2:(H-h)/2,setsar=1[v]" \
-map "[v]" -map 0:a? \
-af "loudnorm=I=-14:TP=-1.5:LRA=11" \
-c:v libx264 -preset medium -crf 18 -pix_fmt yuv420p \
-c:a aac -b:a 192k -movflags +faststart \
output_9x16.mp4
Why Every Single Flag Matters (Bugs This Avoids)
-
scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920Scales the background proportionally until it fills the entire1080x1920vertical canvas, then center-crops cleanly so there is zero aspect-ratio distortion. -
boxblur=24:4,eq=brightness=-0.08:saturation=1.15Heavy blur (luma_radius=24,4passes) plus a subtle-0.08darkening makes the sharp foreground video pop immediately without competing visually. -
scale=1080:-2The-2(instead of-1) guarantees the computed height is divisible by 2 — preventing the classiclibx264: height not divisible by 2crash on odd-resolution screen captures. -
-pix_fmt yuv420p+-movflags +faststartWithoutyuv420p, QuickTime and mobile social apps often render a black video track (especially when the source is 10-bit or 4:4:4 OBS output).+faststartmoves themoovatom to the front for instant mobile playback. -
-af "loudnorm=I=-14:TP=-1.5:LRA=11"Matches YouTube Shorts / Reels / TikTok loudness normalization (-14 LUFS,-1.5 dBTPtrue peak ceiling) so your clip doesn't get crushed or sound whisper-quiet next to other videos.
2. Batch-Convert an Entire Folder in 25 Lines of Python
Drop this script next to a folder of clips (clips_in/) and run python batch_reframe.py:
import subprocess
from pathlib import Path
IN_DIR = Path("clips_in")
OUT_DIR = Path("clips_9x16")
OUT_DIR.mkdir(exist_ok=True)
FILTER = (
"[0:v]scale=1080:1920:force_original_aspect_ratio=increase,"
"crop=1080:1920,boxblur=24:4,eq=brightness=-0.08:saturation=1.15[bg];"
"[0:v]scale=1080:-2:force_original_aspect_ratio=decrease[fg];"
"[bg][fg]overlay=(W-w)/2:(H-h)/2,setsar=1[v]"
)
for src in sorted(IN_DIR.glob("*.mp4")):
dst = OUT_DIR / f"{src.stem}_9x16.mp4"
cmd = [
"ffmpeg", "-y", "-i", str(src),
"-filter_complex", FILTER,
"-map", "[v]", "-map", "0:a?",
"-af", "loudnorm=I=-14:TP=-1.5:LRA=11",
"-c:v", "libx264", "-preset", "medium", "-crf", "18",
"-pix_fmt", "yuv420p", "-c:a", "aac", "-b:a", "192k",
"-movflags", "+faststart", str(dst),
]
print(f"Reframing {src.name} -> {dst.name}")
subprocess.run(cmd, check=True)
3. Bonus: Hardware Acceleration on NVIDIA GPUs
If you batch-process dozens of 4K clips on an NVIDIA card, swap -c:v libx264 -preset medium -crf 18 for NVENC:
-c:v h264_nvenc -preset p6 -rc vbr -cq 19 -pix_fmt yuv420p
On a mid-range RTX card, a 60-second 1080p clip renders in ~2.5 seconds instead of ~18 seconds on CPU.
Want the Turnkey Offline Starter Bundle?
Everything above is free to copy and tweak! If you want a ready-to-run ZIP containing the complete batch reframer script (with auto aspect-ratio detection & split-screen mode), 12 copy-paste FFmpeg creator recipes, plus our 20KB zero-dependency Offline HTML PDF Invoice Generator, you can grab the Offline Dev & Creator Starter Code Kit ($2.99 one-time, zero subscriptions) here:
👉 Offline Dev & Creator Starter Code Kit ($2.99 on Payhip)
What FFmpeg filter chains do you keep in your personal cheat sheet? Drop your favorite one-liner below!
Top comments (5)
Explaining why each flag is there—especially scale=1080:-2 to prevent libx264 failures on odd-height screen captures, yuv420p for QuickTime and mobile compatibility on 10-bit OBS sources, and +faststart for immediate streaming playback—turns a one-liner into a genuinely reusable production recipe.
One small optimization when batching dozens of clips with loudnorm: single-pass dynamic normalization works well for quick turnarounds, while a two-pass loudnorm measurement avoids pumping artifacts on quiet talking-head segments. Adding setsar=1 right after the overlay also eliminates subtle aspect-ratio quirks on social upload pipelines.
Spot-on catch on single-pass vs. two-pass
loudnorm! On talking-head clips with long silent breaths or dramatic pauses, single-pass dynamic mode definitely pumps the room tone right back up between sentences.For production batch runs, doing a quick measurement pass with
print_format=jsonand feedingmeasured_I / measured_LRA / measured_TP / measured_threshintolinear=truecompletely eliminates that pumping:And huge +1 on
setsar=1right afteroverlay— non-square SAR from screen capture tools or older cameras has bitten me on Shorts uploads before too. Appreciate you adding that for anyone copying the batch pipeline!Sharing that exact two-pass loudnorm snippet with print_format=json and linear=true is super helpful—seeing measured_I, measured_LRA, measured_TP, and measured_thresh wired directly into pass two saves anyone automating talking-head batches from guessing the parameter names. Glad setsar=1 resonated too; non-square SAR from mixed capture tools is one of those bugs you only catch after an upload looks subtly squished.
Your point about talking-head pumping actually inspired me to write up the full zero-dependency Python wrapper (
two_pass_loudnorm.py) that parses FFmpeg's Pass-1 JSON output automatically and locks Pass 2 intolinear=true(including theoffsetand-ar 48000sample-rate gotcha): dev.to/apexaistudio/two-pass-loudn...Thanks again for kicking off such a solid thread!
Nice—turning that into a zero-dependency two-pass Python wrapper that auto-parses Pass-1 JSON and includes the -ar 48000 fix saves a lot of silent headaches. That 192 kHz internal upsampling quirk in FFmpeg's loudnorm filter catches almost everyone until file sizes spike or mobile players reject the audio stream.