How to turn one long video into several Shorts with Claude Code
A long interview usually holds several moments that make sense on their own, each the length of a Short. Finding them means going through all of it, and cutting them well means starting and ending each in a pause and keeping the speaker in a 9:16 frame through every change of shot. This guide follows one real run in which Claude Code turned a 10-minute interview into three Shorts with Whisper and ffmpeg, then compared them. Each step shows the command, what it printed, and what the tools do.
Published:
What we're making
The starting point is “Interview on extreme weather with physical geographer Hannah Cloke” by the Royal Society, on Wikimedia Commons. In 10 minutes 26 seconds of 1920 × 1080 video, Roma Agrawal talks with Hannah Cloke, a professor of hydrology at the University of Reading, about floods, heat and how to talk about risk. It cuts between close-ups of Hannah Cloke and wide shots of the two of them in armchairs, each from more than one camera.
It's released under CC BY 3.0, which lets you cut, crop and repost it as long as you credit the Royal Society, link the license, say that you changed it, and don't suggest the Royal Society endorses what you made. This page credits it in the sources at the bottom. When you post a Short, put a line like this in its description: The Royal Society, CC BY 3.0, via Wikimedia Commons; cut and cropped.
A Short has to make sense without the 10 minutes around it. So the goal is three passages that each stand on their own, each under a minute, cut at pauses and reframed to 1080 × 1920 with the slice moved to the speaker at each change of shot, and then a comparison to pick which to post. One of them, heat.mp4, is at the top of the page, next to the stretch of the interview it came from.
Every command, output and frame below comes from that run. Nothing in it is specific to this interview: a podcast or a talk works the same way.
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 reads the transcript, picks the passages, writes and runs the commands, and looks at frames to decide where to crop.
- Whisper: OpenAI's speech recognition model, free and open source under the MIT license. It runs on your computer, so the audio isn't uploaded anywhere. Its default model, turbo, is a 1.51 GB download the first time.
- ffmpeg: converts video, and Homebrew installs it with Whisper. Three of its filters do the finding and moving here: silencedetect lists the pauses, scdet lists the changes of shot, and sendcmd moves the crop at given times. ffprobe, which comes with it, reads what's in a file.
- python3, for three short scripts that need only its standard library, comes with Apple's Command Line Tools, which Homebrew needs anyway.
Step 1: Install Whisper and get the interview
Homebrew's openai-whisper formula installs Whisper with everything it needs, including ffmpeg to read the audio and PyTorch to run the model. PyTorch is the big part, at 533.6 MB:
brew install openai-whisperCommons serves the original as an 85.5 MB WebM file:
curl -L -o interview.webm "https://upload.wikimedia.org/wikipedia/commons/9/99/Interview_on_extreme_weather_with_physical_geographer_Hannah_Cloke_%E2%80%93_The_Royal_Society.webm"ffprobe shows what's in it: VP9 video at 1920 × 1080 and 25 frames a second, stereo Opus audio at 48 kHz, and 626 seconds in all. At 25 frames a second, one frame lasts 0.04 seconds, which matters in step 6.
ffprobe -v error -show_entries stream=codec_name,width,height,r_frame_rate,sample_rate,channels:format=duration,size -of compact=p=0 interview.webmcodec_name=vp9|width=1920|height=1080|r_frame_rate=25/1 codec_name=opus|sample_rate=48000|channels=2|r_frame_rate=0/0 duration=626.017000|size=85493260
Step 2: Brief Claude Code
Open Claude Code in the folder. The brief says what makes a good passage and how to check the cuts, and leaves the choice of passages and the commands to Claude Code:
Claude Code
interview.webm is a 10-minute interview. Make three Shorts from it: - Transcribe it with Whisper, with word times - Pick three passages that make sense on their own, each under a minute - Start and end each one in a pause, never mid-word - 1080 × 1920, with the crop moved to the speaker at every change of shot - Transcribe each Short again to check its first and last words, then tell me how they differ so I can pick one
The brief doesn't name the passages. Picking them is reading, and a 10-minute transcript is about 2,000 words, which Claude Code reads in one go. What it can't get from text is where a word really ends or where the camera cuts, so the steps after the picking measure both.
Step 3: Transcribe the interview
Whisper takes the WebM file as it is. --language en skips detecting the language, --word_timestamps True records when each word is said, which the next step cuts by, and --output_dir puts the files in a folder of their own:
whisper interview.webm --language en --word_timestamps True --output_dir subs[00:00.640 --> 00:05.940] Now last year the UK recorded its highest ever temperature of 40.3 degrees celsius [00:05.940 --> 00:11.680] and on the news recently we've seen devastating floods, droughts and wildfires worldwide. [00:12.240 --> 00:18.460] My next guest is Hannah Cloak, a specialist in extreme weather and professor of hydrology
It took 5 minutes 40 seconds for 10 minutes 26 seconds of audio, not counting the model's first download. While it works, Whisper prints each segment with its time; the lines above are the first three. On a Mac it runs on the CPU and warns that FP16 isn't supported there, so it uses FP32 instead, which only means slower math.
It writes five files: .txt, .srt, .vtt, .tsv and .json. The .json one has every word with its start and end, 2,065 words in 109 segments. Whisper spelled the guest's name Cloak, which doesn't matter for cutting: none of the three passages says it.
Step 4: Pick three passages
Claude Code read interview.txt and picked three answers that make their point without the question before them:
- likely: floods, heat waves and fires have always happened, so climate change doesn't cause any one of them; it makes them more likely, which is why it needs taking seriously. It starts partway into the answer, on a claim.
- music-box: Roma Agrawal asks whether there's something Hannah Cloke would be devastated to lose in a flood. She explains why that question tells people more about flood risk than rainfall or river levels do, and answers it: her grandmother's music box.
- heat: last summer's 40-degree heat in the UK, in which thousands of people died, and why heat is a silent killer that picks the vulnerable.
It wrote them down as the words each passage starts and ends with, which are easier to check against the transcript than times:
cat picks.tsvlikely it's always flooded take it seriously music-box is there something that you would be devastated being at flood risk heat last summer we saw so intricately linked
snap.py turns those words into times. It finds them in Whisper's word list, starts 0.2 seconds before the first word and ends 0.4 seconds after the last, but never takes in the word before or after:
# Find where each clip starts and ends in whisper's word timestamps.# usage: snap.py TRANSCRIPT.json picks.tsv > clips.tsv# picks.tsv: name <tab> the clip's first words <tab> its last wordsimport csvimport jsonimport reimport sysPAD_IN, PAD_OUT = 0.2, 0.4 # seconds of room before the first word and after the lastdef key(text): return re.sub(r"[^a-z0-9]", "", text.lower())words = [w for s in json.load(open(sys.argv[1]))["segments"] for w in s["words"]]keys = [key(w["word"]) for w in words]def find(phrase, after=0): want = [key(t) for t in phrase.split()] for i in range(after, len(keys) - len(want) + 1): if keys[i : i + len(want)] == want: return i, i + len(want) - 1 sys.exit(f"not in the transcript: {phrase}")print("name\tstart\tend\tseconds")for name, first_words, last_words in csv.reader(open(sys.argv[2]), delimiter="\t"): first, _ = find(first_words) _, last = find(last_words, first) start = words[first]["start"] - PAD_IN if first > 0: start = max(start, words[first - 1]["end"]) # don't take in the word before end = words[last]["end"] + PAD_OUT if last + 1 < len(words): end = min(end, words[last + 1]["start"]) # or the word after print(f"{name}\t{start:.2f}\t{end:.2f}\t{end - start:.2f}")python3 snap.py subs/interview.json picks.tsv > clips.tsvcat clips.tsvname start end seconds likely 125.44 170.78 45.34 music-box 496.20 535.70 39.50 heat 575.14 611.26 36.12
All three are under a minute: 45.3, 39.5 and 36.1 seconds. But likely starts at 125.44, exactly where Whisper says the word before it, “because”, ends. The 0.2 seconds of room ran into that word, so the script stopped there. Whisper's word times are estimates, and an edge right on one is too close to trust.
Step 5: Check the edges against the pauses
Claude Code cut a first version at those times and ran Whisper on it. likely's transcript began with “as it's always flooded”: the end of “because” was still in it. So it measured the pauses in the audio itself:
ffmpeg -nostdin -hide_banner -i interview.webm -vn -af silencedetect=n=-40dB:d=0.15 -f null - 2> silence.logsilencedetect reports every stretch quieter than −40 dB (n) that lasts at least 0.15 seconds (d), short enough to catch the breaths between phrases. -vn skips the video, so it took 0.88 seconds, and it found 110 pauses. edges.py reads the log and shows the pause nearest each edge:
# Show the pause nearest each clip edge, from ffmpeg's silencedetect log.# usage: edges.py clips.tsv silence.logimport csvimport reimport sysREACH = 1.0 # look this many seconds either side of an edgelog = open(sys.argv[2]).read()starts = [float(t) for t in re.findall(r"silence_start: ([\d.]+)", log)]ends = [float(t) for t in re.findall(r"silence_end: ([\d.]+)", log)]pauses = list(zip(starts, ends))for clip in csv.DictReader(open(sys.argv[1]), delimiter="\t"): for side in ("start", "end"): edge = float(clip[side]) near = [p for p in pauses if p[0] - REACH < edge < p[1] + REACH] if not near: print(f"{clip['name']}\t{side} {edge:.2f}\tno pause within {REACH:.0f} s") continue a, b = min(near, key=lambda p: min(abs(edge - p[0]), abs(edge - p[1]))) where = "inside" if a <= edge <= b else "before" if edge < a else "after" print(f"{clip['name']}\t{side} {edge:.2f}\tpause {a:.2f}-{b:.2f} ({where})")python3 edges.py clips.tsv silence.loglikely start 125.44 pause 125.88-126.15 (before) likely end 170.78 pause 170.69-171.23 (inside) music-box start 496.20 no pause within 1 s music-box end 535.70 pause 535.76-536.11 (before) heat start 575.14 no pause within 1 s heat end 611.26 pause 611.29-611.83 (before)
Three edges sit just before a pause: likely's start and the ends of music-box and heat. There, Whisper's word times and the audio disagree. Whisper says Roma Agrawal's “thank you” after heat starts at 611.26, but the audio is quiet until 611.83. Claude Code moved those three edges to about the middle of their pauses:
cat clips.tsvname start end seconds likely 126.00 170.78 44.78 music-box 496.20 535.90 39.70 heat 575.14 611.50 36.36
Run again, edges.py puts four of the six edges inside a pause. The other two are starts with no pause within a second: Roma Agrawal runs straight on with “and is there something”, and Hannah Cloke with “I mean last summer”. Those stay on the word boundary Whisper gives, and step 8 comes back to them.
Step 6: Find the shots and where to crop
The interview cuts between cameras, so one slice won't do. In a close-up, Hannah Cloke is near the middle; in a wide shot, she's at the right and Roma Agrawal at the left. ffmpeg's scdet filter finds the cuts by scoring how much each frame differs from the one before:
ffmpeg -hide_banner -i interview.webm -vf "scdet=threshold=10" -an -f null - > scdet.log 2>&1grep -o "lavfi.scd.time: [0-9.]*" scdet.log | awk '{print $2}' > cuts.txtxargs -n 9 < cuts.txt32.04 40.16 65.92 76.04 111.24 123.2 147.4 171.68 181.24 187.32 195.52 215.72 222.92 248.2 266 271.96 281.32 286.08 295.36 310.88 315.32 331.36 345.44 356.88 367.6 404.8 414.52 427.84 439.6 444.08 446.88 452.16 482.96 492.24 494.8 503.28 535.04 539.36 545.08 556.76 569.2 594.88 606.32 615.4 620.36
threshold=10 counts a frame as a cut when its score is over 10 out of 100, the filter's default. It took 16.8 seconds and found 45 cuts in the 10 minutes. grep and awk pull the times out of the log, and xargs prints them nine to a line.
Each passage spans two or three shots. Claude Code took one frame from each shot, drew lines on it every 200 pixels, and read off where to put the slice: 608 pixels wide, which is 9/16 of the 1080-pixel height rounded to an even number. It wrote them to shots.tsv, with the cut where each shot starts and the slice's left edge:
cat shots.tsvclip cut x likely 123.2 896 likely 147.4 1076 music-box 494.8 236 music-box 503.28 920 music-box 535.04 1106 heat 569.2 876 heat 594.88 1106 heat 606.32 906

sendcmd counts time from the start of each Short, not of the interview. crops.py does that subtraction and writes a file of commands per Short:
# Write a sendcmd file for each clip that moves the 9:16 slice at every shot change.# usage: crops.py clips.tsv shots.tsv (writes NAME.cmd for each clip)# shots.tsv: clip <tab> the scene cut where a shot starts <tab> the slice's left edge thereimport csvimport sysHALF_FRAME = 0.02 # at 25 fps: the slice moves on the cut frame itselfclips = {c["name"]: float(c["start"]) for c in csv.DictReader(open(sys.argv[1]), delimiter="\t")}lines = {name: [] for name in clips}for shot in csv.DictReader(open(sys.argv[2]), delimiter="\t"): # sendcmd counts from the clip's first frame, not from the long video's at = max(0.0, float(shot["cut"]) - clips[shot["clip"]] - HALF_FRAME) lines[shot["clip"]].append(f"{at:.2f} crop x {shot['x']};")for name, commands in lines.items(): with open(f"{name}.cmd", "w") as f: f.write("\n".join(commands) + "\n")python3 crops.py clips.tsv shots.tsvcat music-box.cmd0.00 crop x 236; 7.06 crop x 920; 38.82 crop x 1106;
music-box starts on Roma Agrawal in the wide shot, at x 236. 7.08 seconds in, the camera cuts to Hannah Cloke's close-up and the slice moves to 920, and 38.84 seconds in the wide shot comes back with the slice on her side, at 1106. crops.py takes 0.02 seconds, half a frame, off each time so the move lands on the first frame of the new shot and not a frame late. A shot that started before the Short, like the first one here, starts at 0.
Step 7: Cut the three Shorts
One loop cuts all three. It reads clips.tsv a line at a time and runs ffmpeg once per Short:
tail -n +2 clips.tsv | while IFS=$'\t' read -r name start end seconds; do fade=$(echo "$seconds - 0.15" | bc) ffmpeg -nostdin -hide_banner -loglevel error -y -ss "$start" -t "$seconds" -i interview.webm \ -vf "sendcmd=f=$name.cmd,crop=608:1080:0:0,scale=1080:1920" \ -af "afade=t=in:d=0.05,afade=t=out:st=$fade:d=0.15" \ -c:v libx264 -crf 20 -pix_fmt yuv420p -c:a aac -b:a 160k "$name.mp4"donetail -n +2 skips the header line. -ss and -t before -i jump to the start and keep that many seconds. In -vf, sendcmd reads the Short's .cmd file and sends crop a new x at each time in it; crop=608:1080:0:0 sets the slice's size, and scale=1080:1920 enlarges it to Shorts size. -af fades the sound in over 0.05 seconds and out over the last 0.15, so the cuts don't click. bc, a calculator that comes with macOS, works out when the fade out starts. -crf 20 sets the quality, and the sound becomes AAC at 160 kbit/s, the usual codec for MP4. All three took 17.2 seconds.
Here's music-box.mp4 frame by frame around its first change of shot:

The slice moves on the same frame as the shot. A frame late, the first frame of the close-up would show the slice still at x 236, a flicker you'd catch on a phone.
Step 8: Check each Short
ffprobe checks that each file is 1080 × 1920 and as long as clips.tsv says:
for f in likely music-box heat; do ffprobe -v error -show_entries stream=codec_name,width,height,nb_frames:format=duration -of compact=p=0 $f.mp4donecodec_name=h264|width=1080|height=1920|nb_frames=1120 codec_name=aac|nb_frames=2101 duration=44.800000 codec_name=h264|width=1080|height=1920|nb_frames=993 codec_name=aac|nb_frames=1862 duration=39.720000 codec_name=h264|width=1080|height=1920|nb_frames=909 codec_name=aac|nb_frames=1706 duration=36.400000
1,120 frames in 44.8 seconds is 25 frames a second, as in the interview, and the other two match too. Then Whisper again, on the three Shorts, with --max_line_width 32 and --max_line_count 2 to split the cues into lines of at most 32 characters, two lines to a cue. sed -n 4p prints each one's first line of text, and tail -n 3 the end of its last cue:
whisper likely.mp4 music-box.mp4 heat.mp4 --language en --word_timestamps True \ --max_line_width 32 --max_line_count 2 --output_dir checkfor f in likely music-box heat; do sed -n 4p check/$f.vtt; tail -n 3 check/$f.vtt; doneIt's always flooded. So it's that we need to take it seriously. Is there something that you me that's the real meaning of being at flood risk. Last summer, we saw absolutely and health are so intricately linked.
It took 87 seconds. Each Short starts and ends on the words picked in step 4, and likely no longer starts with “as”. The two transcripts don't match word for word: on the Short, Whisper wrote “for my childhood” where the long transcript has “from”, and it leaves out fillers such as “um”. These files are the captions on this page's videos.
A transcript can't prove an edge is clean, though. Claude Code gave Whisper 1.6 seconds of audio starting at 575.46, where Whisper's own times say “last” has already ended, and it still wrote “Last”. Either the word runs later than its time or Whisper filled it in, and a transcript can't tell which. Claude Code can't hear at all, so the last check is yours: play the first second of each Short, above all music-box and heat, the two that start with no pause.
Watch each one through, too. The slice moves only when the shot changes, and the speaker can change within a shot. In music-box, Whisper puts the start of Hannah Cloke's answer about 5.5 seconds in, but the camera cuts to her at 7.08, so for about a second and a half you hear her while the slice shows Roma Agrawal. The wide shot has both of them in it; the 9:16 slice keeps one. A change of speaker like that needs a move of its own: add a line for it to shots.tsv, and crops.py handles it with the rest.
Step 9: Compare the three
heat.mp4 is at the top of the page, and the other two are below. They differ in how they open and in who's on screen:
- likely, 44.8 seconds, 2 shots: an argument. It opens partway into a thought, on “It's always flooded”, and ends on “we need to take it seriously”.
- music-box, 39.7 seconds, 3 shots: a question and a personal story. It's the only one where both people appear, and it ends on its point, “the real meaning of being at flood risk”.
- heat, 36.4 seconds, 3 shots: it opens on an event, last summer's 40-degree heat, and ends on climate and health being “so intricately linked”.
Where it gets hard
Three of the six edges were a fraction of a second off, and only one of them showed up in a transcript. Two have no pause to cut in, and the check that settles them is listening. Every passage needed its shots found and a slice chosen for each, and music-box still has a second and a half where the picture shows the wrong person. With more videos, finding those moments and saying what's wrong with each 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
- Wikimedia Commons: Interview on extreme weather with physical geographer Hannah Cloke – The Royal Society (CC BY 3.0)
- Creative Commons: Attribution 3.0 Unported (CC BY 3.0)
- OpenAI Whisper (MIT license)
- Homebrew: openai-whisper
- Claude Code overview
- ffprobe documentation
- FFmpeg filters: silencedetect, scdet, sendcmd, crop, scale and afade
- YouTube Help: Upload YouTube Shorts
- YouTube Help: Understand three-minute YouTube Shorts
Questions
Transcribe it with word times, pick passages from the transcript that make sense on their own, and cut each one at a pause into 1080 × 1920 with the crop on the speaker. In this guide Whisper transcribes, Claude Code picks the passages and writes the commands, and ffmpeg finds the pauses and changes of shot and does the cutting.
Up to 3 minutes. YouTube categorizes square and vertical videos up to 3 minutes long, uploaded on or after October 15, 2024, as Shorts. The three here are 36 to 45 seconds.
Close, but not exact. Here three of six edges sat just before a real pause, and one of them kept the end of the word before it. Check the edges against the pauses ffmpeg's silencedetect finds, and listen to the first second of each Short.
Only if you have the rights to it or its license allows edits. This guide uses a CC BY 3.0 video, which allows cutting and reposting with credit, a link to the license and a note that it was changed. A license with ND, no derivatives, doesn't allow sharing edited versions.
Under 8 minutes of processing in this run: 5 minutes 40 seconds for Whisper to transcribe 10 minutes 26 seconds, under 20 seconds to find the pauses and shots, 17 seconds to cut and 87 seconds to check. Claude Code's reading and picking come on top of that.