How to convert a horizontal video to vertical 9:16 for Shorts: three ways compared
A YouTube Short is 9:16, so a 16:9 clip doesn't fit: a vertical slice of it keeps under a third of the width. What's left is a choice. Cut to the middle, show the whole frame over a blurred copy of itself, or move the slice along with the subject. This guide follows one real run in which Claude Code made all three from the same clip with ffmpeg and compared them. Each step shows the command, what it printed, and what the filters do.
Published:
Shorts size: 9:16, 1080 × 1920
A YouTube Short is vertical: 9:16, which at full HD is 1080 × 1920 pixels. Google's ad specs list 1080 × 1920 as the recommended HD size for 9:16 and recommend 9:16 for Shorts. What YouTube's help says counts as a Short:
- Square or vertical. A video in either shape can be a Short.
- Up to 3 minutes. Square and vertical videos up to 3 minutes long, uploaded on or after October 15, 2024, are categorized as Shorts.
- Up to 1080p. That's the highest resolution YouTube takes for a Short.
- A 16:9 video stays long-form. YouTube's advice for a video you don't want classified as a Short is a wider ratio such as 16:9.
What we're making
The starting point is “Volkswagen T2” from Wikimedia Commons, released under CC0, so it can be used without credit. In 9.55 seconds of 1920 × 1080 video with no sound, a white van appears far down a concrete road at the right and drives toward the camera, leaving the frame at the bottom left after about 7 seconds.
A 9:16 slice of a 1080-pixel-tall frame is 608 pixels wide, under a third of the picture, and the van crosses nearly all of it. The guide on making Shorts with Claude Code, with the Shibuya Crossing clip, picked one fixed slice; that works when what matters stays in place. Here it doesn't, so the goal is three versions to compare: a center crop, the whole frame over a blurred background, and a crop that follows the van. The last one is at the top of the page, next to the clip it started from.
Every command, output and frame below comes from that run. All three versions stop at 7 seconds; step 5 shows why.
What you need
A Mac with Homebrew, Claude Code signed in with your own account, and an empty folder to work in. Here's what each part does:
- Claude Code: the agent. It writes and runs the commands, reads what the tracker found, and looks at frames from each version.
- ffmpeg: converts video. Cropping, scaling, blurring, layering and putting videos side by side are all ffmpeg filters. ffprobe, which comes with it, reads what's in a file.
- uv: runs a Python script with the packages it needs in an environment of its own, so nothing is installed into your system's Python. It's free under the MIT or Apache 2.0 license.
- OpenCV: a computer vision library, free under the Apache 2.0 license. Its CSRT tracker follows a box from frame to frame. uv downloads it the first time the script runs.
- python3, for the second script, comes with Apple's Command Line Tools, which Homebrew needs anyway.
Step 1: Install ffmpeg and uv, get the clip
Homebrew installs both:
brew install ffmpeg uvCommons serves the original as an 8.2 MB WebM file:
curl -L -o van.webm "https://upload.wikimedia.org/wikipedia/commons/2/2e/Volkswagen_T2.webm"ffprobe shows what's in it: VP8 video at 1920 × 1080, 24000/1001 frames a second (about 23.976), 9.55 seconds long. There's no audio stream, so none of the commands below has audio options.
ffprobe -v error -show_entries stream=codec_name,width,height,r_frame_rate:format=duration -of compact=p=0 van.webmcodec_name=vp8|width=1920|height=1080|r_frame_rate=24000/1001 duration=9.551000
Step 2: Brief Claude Code
Open Claude Code in the folder. The brief names the three versions and how to check them, and leaves the commands to Claude Code:
Claude Code
van.webm is a 16:9 clip of a van driving toward the camera. Make three 1080 × 1920 versions for Shorts with ffmpeg: - center.mp4: a center crop - blur.mp4: the whole frame over a blurred copy of itself - follow.mp4: a crop that follows the van. Track it with OpenCV and run the script with uv - Make all three the same length and check frames from each - Put them side by side and tell me which works for this clip
The three take different amounts of work. The center crop is one filter, and the blurred background is a small filter graph. The following crop needs to know where the van is in every frame, which is what the tracker is for.
Step 3: Center crop
One ffmpeg command crops, scales and encodes:
ffmpeg -i van.webm -t 7 -vf "crop=ih*9/16:ih,scale=1080:1920" -c:v libx264 -crf 20 -pix_fmt yuv420p center.mp4crop=ih*9/16:ih keeps the full height and a width of 9/16 of it, 608 pixels. Without an x and a y, crop centers the slice, (1920 − 608) / 2 = 656 pixels from the left. scale=1080:1920 enlarges it to Shorts size. -t 7 keeps the first 7 seconds, -crf 20 sets the quality and -pix_fmt yuv420p keeps the H.264 file playable everywhere. It took 1.3 seconds. Here's where that slice falls on four frames of the clip:

The van starts outside the slice and only drives into it at about 5 seconds. Until then, the center crop shows an empty road and water. After that, the van is cut off at the slice's right edge:

The Shibuya guide compared four slices of one frame and kept the one at 450 pixels for the whole clip. The van moves across the whole width, so no fixed slice holds it from start to end.
Step 4: Blurred background
The second version keeps the whole frame. It sits in the middle of the vertical frame at full width, and a blurred, enlarged copy of the same video fills the space above and below it:
ffmpeg -i van.webm -t 7 -filter_complex \ "[0:v]split[a][b];[a]scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920,gblur=sigma=40[bg];[b]scale=1080:-2[fg];[bg][fg]overlay=(W-w)/2:(H-h)/2" \ -c:v libx264 -crf 20 -pix_fmt yuv420p blur.mp4-filter_complex takes a graph of filters, with names in brackets for what passes between them. split makes two copies of the video, [a] and [b]. [a] is scaled until it covers 1080 × 1920 (force_original_aspect_ratio=increase), cropped to exactly that, and blurred with gblur, a Gaussian blur, where sigma=40 sets how strong. That's the background, [bg]. [b] is scaled to 1080 wide with its shape kept, which makes it 1080 × 608 (-2 picks a height divisible by 2). overlay puts it in the middle of the background. It took 1.5 seconds.
Claude Code first used boxblur, which averages a square of pixels, and its frames looked blocky. gblur's blur is smooth:

Nothing is cut off, but the picture fills 608 of the 1920 rows, under a third of the screen, so the van is small on a phone. Google does the same with ads: its Shorts ad specs say horizontal assets serve in a vertical Short with blurred tops and bottoms.
Step 5: A crop that follows the van
To follow the van, the crop has to know where it is in every frame. A tracker does that: given a box around something in the first frame, it finds the same thing in each frame after. Claude Code looked at an enlarged crop of the first frame, read the van's box as 115 × 90 pixels at x 1645, y 588, and wrote track.py with OpenCV's CSRT tracker:
# Follow one box through a video and print where it is in every frame.# usage: track.py VIDEO X Y W H > track.csv (X Y W H: the subject's box in frame 1)import sysimport cv2video = sys.argv[1]box = tuple(int(v) for v in sys.argv[2:6])cap = cv2.VideoCapture(video)ok, frame = cap.read()tracker = cv2.TrackerCSRT_create()tracker.init(frame, box)print("frame,time,found,x,y,w,h")n = 0while ok: found, (x, y, w, h) = (True, box) if n == 0 else tracker.update(frame) seconds = cap.get(cv2.CAP_PROP_POS_MSEC) / 1000 print(f"{n},{seconds:.3f},{int(found)},{x},{y},{w},{h}") n += 1 ok, frame = cap.read()uv run --with opencv-contrib-python makes an environment with OpenCV's Python package and runs the script in it. The first run downloaded OpenCV (53.1 MiB) and NumPy (5.2 MiB) and took about 18 seconds; later runs took about 3.5:
uv run --with opencv-contrib-python python track.py van.webm 1645 588 115 90 > track.csvtrack.csv has one row per frame. Some of them:
sed -n '1,2p;50p;98p;146p;170p;177,179p' track.csvframe,time,found,x,y,w,h 0,0.000,1,1645,588,115,90 48,2.002,1,1575,609,152,119 96,4.004,1,1385,622,239,187 144,6.006,1,884,714,342,267 168,7.007,1,213,895,316,247 175,7.299,1,-87,903,303,237 176,7.341,0,0,0,0,0 177,7.382,1,5,-119,303,237
The box grows as the van comes closer, from 115 pixels wide to 342 at 6 seconds. At 7.3 seconds x goes negative as the van leaves the frame, and at 7.34 found turns 0: the tracker lost it. One frame later it reports found again, but at y −119, above the top of the frame, and to the end of the clip its box sits in the sky. found only means the tracker found something, not that it's the van. So all three versions stop at 7 seconds, while the tracker still has it.
The boxes also jump a little from frame to frame, and a crop that followed them exactly would shake. path.py, which needs only Python's standard library, turns them into a smooth path:
# Turn tracked boxes into a smooth crop path for ffmpeg's sendcmd filter.# usage: path.py track.csv SECONDS > crop.cmdimport csvimport sysSOURCE_W, CROP_W = 1920, 608 # a 9:16 slice of a 1080-pixel-tall frameHALF = 6 # average each frame with 6 before and 6 after it, about half a second in allrows = list(csv.DictReader(open(sys.argv[1])))keep = [r for r in rows if float(r["time"]) < float(sys.argv[2])]# The average near the end also reads a few frames past it, so the slice doesn't lag behind.centers = [float(r["x"]) + float(r["w"]) / 2 for r in rows[: len(keep) + HALF]]for i, row in enumerate(keep): near = centers[max(0, i - HALF) : i + HALF + 1] left = sum(near) / len(near) - CROP_W / 2 left = min(max(left, 0), SOURCE_W - CROP_W) # keep the slice inside the frame print(f"{row['time']} crop x {round(left)};")For each frame it averages the box's center with 6 frames before and 6 after, about half a second, and centers the 608-pixel slice on that, kept between 0 and 1312 so it never leaves the frame. Near the 7-second cut it also reads frames past it. Without them, the last averages would hold only earlier frames and the slice would lag behind the van. It writes one line per frame, in the form ffmpeg's sendcmd filter reads:
python3 path.py track.csv 7 > crop.cmdsed -n '1p;73p;97p;121p;145p;168p' crop.cmd0.000 crop x 1312; 3.003 crop x 1298; 4.004 crop x 1201; 5.005 crop x 1035; 6.006 crop x 746; 6.965 crop x 94;
sendcmd reads crop.cmd and, at each time in it, sends the crop filter a new x. crop accepts that as a command while the video plays, so the slice moves. crop=608:1080:1312:0 sets the size and the position it starts at:
ffmpeg -i van.webm -t 7 -vf "sendcmd=f=crop.cmd,crop=608:1080:1312:0,scale=1080:1920" -c:v libx264 -crf 20 -pix_fmt yuv420p follow.mp4It took 1.3 seconds. Here's the moving slice on the same four frames, with the tracker's box:

For the first 3 seconds the slice stays at 1312, against the right edge. At the start, the van's center is 218 pixels from that edge, less than half a slice, so it sits right of the slice's middle. Then the slice moves left with the van, about 1,200 pixels in 4 seconds:

At 6.5 seconds the van is wider than the slice, so only its front fits. No 9:16 crop of this clip can do better there: up close, the van is wider than 608 pixels.
Step 6: Compare them side by side
hstack puts videos of the same height next to each other, so one 3240 × 1920 file plays all three at once. It took 3.6 seconds and made 11.9 MB:
ffmpeg -i center.mp4 -i blur.mp4 -i follow.mp4 -filter_complex hstack=inputs=3 -c:v libx264 -crf 20 -pix_fmt yuv420p compare.mp4Then one check that every file has the size and length it should: 1080 × 1920, or 3240 × 1920 for the comparison, with 168 frames and 7.007 seconds each:
for f in center blur follow compare; do ffprobe -v error -select_streams v:0 -show_entries stream=width,height,nb_frames:format=duration -of csv=p=0 $f.mp4done1080,1920,168 7.007000 1080,1920,168 7.007000 1080,1920,168 7.007000 3240,1920,168 7.007000
Which one to use
For this clip, the crop that follows the van. It has the van from the first second, while the center crop shows an empty road for 5 seconds and the blurred version shows the van small. Other clips suit the other two:
- Center crop, or a fixed slice like the Shibuya one: when what matters stays in one place. It's one filter and the quickest to make.
- Blurred background: when the whole frame matters and it's fine for it to be small, such as a wide shot whose layout is the point.
- A crop that follows the subject: when one subject moves across the frame, as the van does here.
Where it gets hard
The tracker started from one look at the first frame, and it went wrong without saying so: at 7.3 seconds it lost the van and moved to the sky while still reporting found. Reading the rows and the frames caught it. A real video has many shots, and each needs its own choice of crop, its own box and its own check. With more videos, finding the moment and saying what's wrong with it is most of the work.
Cutfac is a Mac app we make for that part. It runs Claude Code or Codex for each video, lets you select a range or draw a box on the frame and say what to change, and keeps versions side by side to compare and pick from. You can do everything in this guide without it.
Free tools for this
Sources
- YouTube Help: Upload YouTube Shorts
- YouTube Help: Understand three-minute YouTube Shorts
- YouTube Help: Get started creating YouTube Shorts
- Google Ads Help: Demand Gen campaign creative: Asset specifications and guidelines
- Google Ads Help: YouTube Shorts ads: Asset specs and best practices
- Wikimedia Commons: Volkswagen T2 (CC0)
- Claude Code overview
- ffprobe documentation
- FFmpeg filters: crop, scale, gblur, overlay, sendcmd and hstack
- uv: Running scripts
- uv (MIT or Apache 2.0 license)
- opencv-contrib-python on PyPI (Apache 2.0 license)
Questions
9:16 vertical, which at full HD is 1080 × 1920 pixels. YouTube categorizes square and vertical videos up to 3 minutes long as Shorts, and takes them at up to 1080p.
No. YouTube categorizes square and vertical videos as Shorts, and suggests a wider ratio such as 16:9 for videos you don't want classified as Shorts. To post a horizontal clip as a Short, make it 9:16 first, as in this guide.
Crop to a fixed slice when what matters stays in one place, use a blurred background when the whole frame has to show, and use a crop that follows the subject when one subject moves across the frame. Making all three and watching them side by side takes a few seconds with ffmpeg.
Some. A 9:16 slice of 1080p footage is 608 pixels wide, so scaling it to 1080 softens it. From 4K footage the slice is 1215 pixels wide, enough for 1080 × 1920. The blurred background keeps every pixel but shows the picture at under a third of the screen's height.
Check the found column and look for jumps, like the y here going from 903 to −119 in two frames. Then either stop the video before that point, as this guide did, or start the tracker again from a new box drawn on the frame where it went wrong.