Tabba
#ai#video#social

How to build your own AI agent to edit video, photos and carousels

Not an app: Claude Code, three scripts and the rules of your style. Here's how I edit my reels, with subtitles that follow the voice word by word.

Simone Tabellini · updated 2 Dec 2026 · 18 min read

On 10 November 2026 I was in Turin for an event, and by the end of the day I had dozens of clips: corridors full of people, rehearsals on stage, spoken pieces in Italian and in English. I wanted to make a vlog out of them. The problem: a vlog edited by hand takes me hours, and for my personal brand I have an hour a day, if I'm being generous.

Two days later I had a two-and-a-half-minute draft, vertical, with subtitles in the style of my reels, the opening title and the cover. I didn't edit it, and no app did either: an agent I built myself with Claude Code did.

This guide shows how it's made, piece by piece, so you can build your own. I'll also tell you what doesn't work yet: carousels, for example, are the piece I'm building right now. If you have CapCut, the agent can also prepare a draft for you to polish by hand. And at the end you'll find how we brought it to play2match, where the agent became a content director with eight AI models working on real footage.

01

What I mean by a media agent

When I say agent I don't mean an app with a magic button. I mean three things working together:

  • Claude Code, the AI that works in the folders on your Mac: it reads the clips, writes and runs the scripts, looks at the result.
  • Three Python scripts that do the heavy lifting: transcribing, drawing the graphics, editing. Claude wrote them, I keep them.
  • The rules of my style, written once in a memory the agent rereads every time: what the subtitles look like, what the cover looks like, which words don't get said.

The difference from an editing app is that the app does what its designers decided. The agent does what you decided, and when it gets something wrong you fix the rule, not the video.

02

The tools: almost all free

ToolWhat it's forCost
ffmpegCuts, resizes, joins and encodes video and audio. It's the Swiss Army knife of videoFree
whisper.cppTranscribes speech and gives the timing of every word, on the Mac, without sending anything outFree
Python with PillowDraws subtitles, titles and covers as imagesFree
MontserratThe subtitle font, heavy and geometricFree, on Google Fonts
Claude CodeWrites the scripts, runs them, checks the result, fixes thingsClaude subscription

The clips stay where they are: in my case in a Google Drive folder synced to the Mac. The script reads them from there, in the original 4K files, without copying them, and the intermediate files go into a working folder that gets deleted when the edit is done. My hard drive is grateful.

03

Style first, code second

The first round of subtitles was correct and anonymous: white text on a semi-transparent black box, like in a thousand other videos. I rejected it. They didn't look like my videos.

So we did what should have been done first: look at my reels on Instagram and write down the rules. Here they are, exactly as the agent reads them:

  • Subtitles in capitals, in a very heavy geometric sans (Montserrat ExtraBold), white with a black outline and a soft shadow.
  • Two lines at most, three to five words, halfway up the screen. The words appear one at a time, as they're spoken.
  • The opening title is white, in the same font, on a red box, one band per line. The same title becomes the cover.
  • The cover: me in the foreground, the title in the red box, an inset with a white border linked to the title by an arrow. Whoever is in the inset looks at the camera.
  • Everything inside the 3:4 crop, because that's what you see in the profile grid.

04

The pipeline in three scripts

The edit is split into three scripts, each with a single job. You run them from the terminal, but usually Claude runs them.

  1. 1

    allinea.py: who says what, and when. For every spoken piece it extracts the audio with ffmpeg, passes it to whisper.cpp in the right language (Italian or English) and saves the timing of every word to a file. It only gets run again if the cuts change.

  2. 2

    grafica.py: subtitles, title, cover. It draws every state of the subtitles as a transparent image: the page of words, with only the ones already spoken. It splits sentences into balanced pages over two lines, draws the red title box and puts the cover together with the inset and the arrow.

  3. 3

    monta.py: the running order becomes a video. It reads the running order (each shot with its clip, start, end, type of audio and an optional zoom), cuts and normalises each piece, joins them, overlays the graphics, mixes the voice and exports.

The running order is a list even I can read: one line per shot, with the part of the story, the clip, the start, the end and the words spoken. Changing a cut means changing two numbers and running it again.

python3 monta.py               # draft with the placeholder voice
python3 monta.py --vo voce/    # version with my voice
python3 monta.py --copertine   # redoes the covers only

Shots that are already done don't get redone: if you change a line, the script only re-edits that one. So a fix doesn't force you to start from scratch.

05

Subtitles that are really in sync

The thing that gives a home-made video away straight off: subtitles that arrive a moment before or a moment after the voice. There are three tricks here.

  • Whisper with DTW alignment. Normal transcription gives approximate timings. With whisper.cpp's DTW option every word gets its own timing, precise enough to make it appear when you say it.
  • Shots that last a whole number of frames. At 30 frames per second, a shot of 3.71 seconds doesn't exist: it would be 111.3 frames. If you don't round it, ffmpeg does, and over the whole video the subtitles drift.
  • Audio exactly as long as the video. Every shot was losing a few hundredths of a second of audio, and over the whole edit the voice ended up ahead of the text on screen. Now the audio of every piece starts from zero and lasts exactly as long as the piece.

To get started you need whisper.cpp installed and a Whisper model, a file you download once. The command the script runs, for every spoken piece, is this:

whisper-cli -m modello.bin -f pezzo.wav -l it -dtw large.v3.turbo -ojf

06

Audio: three volumes and a placeholder voice

In vlogs, audio is the thing that makes you close a video without knowing why. The agent handles it with three rules.

  • Every shot has a type: speech (you hear the person), ambient (you hear the place) or under the voice (the sound stays low, under my narration). For each one there's a reference volume in LUFS, the unit the platforms use.
  • Normalisation at the end of the mix, with ffmpeg's loudnorm filter, at the right volume for social media.
  • A placeholder voice until I record mine. The script reads the voice-over lines with the Mac's text-to-speech, so I can watch the draft with the right timings. When my audio arrives (even WhatsApp voice notes), it normalises it and puts it in its place.

The voice-over lines live in the script, with the maximum length of each piece. If one of my recordings runs over, the shot underneath gets longer.

07

Got CapCut? Have the agent prepare the draft

Everything you've read so far ends in a finished video: the agent cuts, adds the subtitles, mixes and exports. It works without any editing software, and that's why I built it that way. But if you have CapCut on your computer there's a second way out: Claude doesn't hand you the finished video, it hands you a CapCut project with the clips, text and subtitles already on the timeline, and you do the final polish yourself, by hand.

What you have on your computerWhat the agent hands youWhen it makes sense
CapCutA draft to open in CapCut: tracks, cuts, text and subtitles in place, all editableWhen you want to move a cut while looking at the timeline, or someone who edits in CapCut finishes the video
No editing softwareThe finished video, edited with ffmpeg by the scripts in this guideWhen the style is settled and you just need the file to publish

The bridge is called VectCutAPI: an open source project on GitHub, under the Apache 2.0 licence, that writes drafts in CapCut's format. Inside there's an MCP server, the standard way to give Claude Code new tools. Once it's connected, Claude has eleven extra commands: create a draft, add video, audio, images, text, subtitles, effects, stickers and keyframes, read a clip's duration and save.

  1. 1

    Download the project. Clone the repository into a folder of your own and create a Python environment just for it, so it doesn't touch the rest of the Mac. You need Python 3.10 or newer and ffmpeg, which you already have if you've followed this guide.

  2. 2

    Connect it to Claude Code. Register an MCP server that runs mcp_server.py with that environment's Python. From then on Claude starts it by itself in every session and finds the CapCut commands among its tools.

  3. 3

    Set three options. In config.json: the capcut_legacy profile, meaning drafts for CapCut and not for Jianying, its Chinese version; the local server port, 9001 by default, to change only if it's already taken; and is_upload_draft set to false, so drafts stay on your computer and don't go to any cloud. The online storage fields (OSS) are only for uploading them: if you stay local, leave them as they are.

  4. 4

    Open the draft in CapCut. When Claude saves, VectCutAPI creates a folder starting with dfd_. On a Mac it has to be moved into CapCut's projects folder, ~/Movies/CapCut/User Data/Projects/com.lveditor.draft, and Claude moves it if you ask. Next time you open CapCut, it's among your drafts.

git clone https://github.com/sun-guannan/VectCutAPI.git
cd VectCutAPI
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt -r requirements-mcp.txt
cp config.json.example config.json
claude mcp add --scope user capcut -- "$PWD/.venv/bin/python" "$PWD/mcp_server.py"

Three things to know before you start:

  • Subtitles arrive as text. They go into CapCut from an SRT file, so they stay editable, but the word-by-word effect and the style of my reels don't arrive ready-made: you sort out the style in CapCut.
  • The draft carries the clips with it. VectCutAPI copies every file into the project folder, so CapCut can find it. With 4K footage the disk fills up fast: once the video is exported, you can delete the draft just like the scripts' working folder.
  • The format changes with CapCut versions. VectCutAPI has a profile for each format, and the CapCut one, capcut_legacy, is built on the template from version 6.5. Before trusting it with a whole vlog, have it make a ten-second draft and check that CapCut opens it.

08

Photos: covers, insets, cut-outs

Photos are the simplest part, and also where the agent saves you the most time.

  • Covers from frames. Instead of hunting for the right photo, I pick a moment in the video: ffmpeg extracts the frame at full resolution, Pillow puts the title, inset and arrow on top.
  • Insets. A crop from another clip, with a rounded white border, tilted and with a shadow, like a sticker. The arrow is a curve drawn by the code.
  • Cut-outs and black and white. For the website I needed my official photo in black and white, without the brand's red background: the agent cut me out and saved it in a light format for the web.

At play2match we went further, with three AI models that run on the Mac:

  • Clean cut-outs with BiRefNet. A person lifted off the background in 19 seconds, hair included, as a transparent PNG ready for a slide or a cover.
  • Small photos enlarged with Real-ESRGAN. Four times bigger without going grainy: from 360 to 1,440 pixels wide in 7 seconds. It rescues old photos and ones grabbed from a video.
  • The right frame with SigLIP 2. Instead of scrolling through the footage, you search it in words (“people laughing”, “a hug”) and the model gives you the clip and the second. From there you pull the frame for the cover.

09

Carousels: the piece I'm building

I'll be honest here: for my own carousels I don't have an automatic builder yet. I have two pieces ready, and we're testing the third at play2match.

  1. 1

    The format. My end-of-week carousel has three fixed blocks: what I learned, what I got wrong, what I used. A fixed format is half the work, because the AI doesn't have to invent the structure: it just has to fill it with the week's facts.

  2. 2

    The check before publishing. At play2match we use an agent that does the art director's round before print: it compares the carousel with a spec sheet (grid, fonts, words per slide, where the logo and the call to action go) and gives a verdict, publish or not, with the exact number to change. It was born after two carousels that went badly because of problems that were all avoidable.

  3. 3

    The builder, being tested at play2match. The same method as the videos, with one difference: the slides are HTML pages, with the brand's colours and the fonts installed on the Mac, and Playwright opens them in an invisible browser and saves them as exact PNGs, 1080x1350 for a carousel and 1080x1080 for a square post. With HTML the text wraps and aligns by itself, like on a web page; with Pillow you work out every line break yourself. So far we've tested it on one slide: the slide template has to be approved before the first real carousel.

One tip that already works: export carousels as PDFs with live text, not as images. On a PDF the agent can check fonts, sizes and word count; on a PNG it only sees pixels.

Meanwhile, Claude already writes the copy for a carousel for you, starting from one of your posts or something that happened that week. My Friday agent, for example, suggests ideas for LinkedIn and also says which format: text, carousel, photo or poll. For my own carousels, the automatic layout is still missing.

10

How we brought it to play2match

On 15 November 2026 we took this method and brought it to play2match, where content isn't made by one person and there are lots of formats: reels, carousels, posts, voice-overs. The agent became a content director: a Claude Code command that takes a brief and calls the right agents, in the right order. It doesn't write or edit anything itself: it directs. It's being tested: first we measure it on a real video, then we decide whether it becomes the weekly round.

  1. 1

    Brief. Format, goal, city, materials (footage, photos, audio) and deadline. Everything starts here.

  2. 2

    Script and copy. The director writes the script with our rules for reels and carousels. The on-screen text, the slides and the caption are written by a copywriter agent. On ads and new formats, another agent checks that the content stays on brand.

  3. 3

    First stop: a person approves. Only what's approved gets edited. A mistake here costs minutes; after the edit it costs hours.

  4. 4

    Editing and graphics, in parallel. One agent edits the reels, with subtitles, a clean voice and variants with a different opening or a closing for each city. Another lays out posts and carousels.

  5. 5

    Second stop: a person approves the files. The director reviews everything and delivers the files to a folder, with a list of what's there and what it skipped. It doesn't publish or schedule anything.

The tools are the ones from my version, plus four: the full build of ffmpeg (it writes text and subtitles onto the video, lowers the music when someone speaks, stabilises shaky footage), Playwright for the slides, uv to keep a Python of its own, and the brand's fonts installed on the Mac. Then eight AI models, chosen with four rules: they run locally, they're free, their licence allows business use and none of them generates people, voices or video. They only work on real footage.

ModelWhat it does for usLicence
SigLIP 2 (Google)Searches the footage in words: “a spike”, “people laughing”. It answers with the clip and the secondApache 2.0
MediaPipe (Google)Finds and follows people: when horizontal footage becomes 9:16, the frame follows whoever's playing instead of cropping the centreApache 2.0
Demucs (Meta)Separates the voice from music and background noise: a testimonial recorded with a speaker blasting becomes usableMIT
DeepFilterNet 3Removes the noise left after separation: wind, outdoor noise, echoMIT / Apache 2.0
RIFE 4.6Smooth slow motion up to four times: it creates the missing frames instead of repeating themMIT
BiRefNetClean cut-outs of people from real photos, for carousels and coversMIT
Real-ESRGANEnlarges old or small photos four times without making them grainyBSD-3
SAM 2.1 small (Meta)Lifts a moving person off the background in a video. By hand, on short clipsApache 2.0

We tested them one by one on four real clips shot during games, on an M4 Mac with 16 GB of RAM. SigLIP indexed 61 frames in 26 seconds and, searching for “a person talking to the camera”, found the right clip; MediaPipe found the people in 72 checks out of 72; Demucs separated 6 seconds of audio in 1.3; RIFE turned one second of play into four smooth seconds in 22. With 16 GB you use one at a time, and the whole new install takes up about 5 GB.

  • Choosing the clips. SigLIP looks at one frame every half second and suggests candidates, then Claude looks at the frames and we choose. SigLIP finds, whoever edits decides. And we look for the moments in the script, we don't invent scenes.
  • The voice. It goes through two models in a row: Demucs separates it, DeepFilterNet removes the noise that's left, then ffmpeg brings it to -14 LUFS. If the voice-over is recorded in a room, the separation is skipped.
  • The check before starting. The director runs four commands: can ffmpeg write subtitles? Does the Python environment respond? Are the fonts there? Are the models there? If one fails it stops and says so, instead of improvising.

What we left out matters too, and why:

WhatWhy not
Ultralytics YOLOAGPL licence: a company needs the commercial one. MediaPipe does the same job
BRIA RMBG 2.0Non-commercial licence. BiRefNet does the same job
RemotionFor a company with more than three people the licence is paid, and for now ffmpeg is enough
Cloned voices and avatars (ElevenLabs, HeyGen)The voice-over is the real voice of someone on the team. And a brand that gets people playing in real life doesn't put people who don't exist in its videos
A model that describes clips locallyClaude already gives the judgement by looking at the frames, and on 16 GB it would be slow. SigLIP searches, Claude chooses

The traps we fell into, so you don't:

  • Installing the full ffmpeg broke the normal one. Homebrew updated a codec library and the old ffmpeg wouldn't start any more. The fix is to update it too; since then, after every install that touches the codecs, we check ffmpeg -version.
  • PyTorch is pinned at 2.8. From the next version the way audio is saved changes, and Demucs risks breaking. Before updating it, we rerun the voice clean-up.
  • Never the Mac's own Python. Everything runs in a separate environment, created with uv, and is always launched from there.
  • SRT subtitles think in terms of a fake 384x288 screen. To put them in the right place you write an .ass file with the real size, 1080x1920.
  • Whisper gets the brand's words wrong, and writes “Play 2 Match”. They're corrected before the subtitles are burned into the video.

If you want to do it yourself, on an Apple Silicon Mac with Homebrew you need about 7 GB, models included. The heart of the install is this:

brew install uv ffmpeg-full whisper.cpp yt-dlp
brew upgrade ffmpeg
uv venv ~/.venvs/video --python 3.12
uv pip install --python ~/.venvs/video/bin/python \
  playwright numpy pillow "torch==2.8.0" "torchvision==0.23.0" "torchaudio==2.8.0" \
  transformers huggingface_hub safetensors sentencepiece \
  mediapipe demucs soundfile "rembg[cpu]" opencv-python-headless
~/.venvs/video/bin/playwright install chromium

The weights for SigLIP 2, Demucs, BiRefNet and SAM 2 download themselves the first time you use them. RIFE, Real-ESRGAN and DeepFilterNet are ready-made programs to download from their GitHub pages; for MediaPipe you need the model files from Google's site.

11

The brand's words

The last check before the edit is on the script. The agent rereads it looking for two things:

  • Startup jargon that the people watching don't get: “we pitched” becomes “we presented”. I rejected it in the vlog's title, and it became a rule.
  • Words outside the positioning. play2match is told as sport, not as one sport in particular, even when the event is. That word doesn't make it into the scripts.

They look like details. They're the difference between a video that feels like yours and one that looks like it came out of an agency.

12

What not to delegate

After the first vlog, the split is clear to me:

The agent does itI do it
Transcribing and finding the timing of every wordShooting: the agent can't be there
Drawing subtitles, titles and covers in my styleThe voice: the draft has the synthetic one, the real video has mine
Suggesting the running order, starting from transcripts and framesChoosing the story and saying yes to the running order
Cutting, fixing the audio, exporting in three formatsThe final yes, before publishing

As I write, the draft is waiting for exactly that, my voice: eight voice-over pieces to record. The script is ready, the rest is my job. And that's how it should be.

The message I want to leave you with is this: you don't need a new app to make content with AI. You need to know what your style is, write it down and give an agent the right tools. The rest gets built one piece at a time.

If you build your own media agent, send me the first video it edits. I'm curious 😉

Simone, aka Tabba 🔥

More guides from the Gym

FAQ

Can you edit a video with AI without editing software?

Yes. Simone Tabellini edits his vlogs with an agent built with Claude Code and three Python scripts: ffmpeg cuts and joins the clips, whisper.cpp transcribes the speech with the timing of every word, Pillow draws subtitles and covers. No editing software is used: the running order is a list of shots that the agent turns into a video.

How do you make word-by-word auto subtitles for reels?

You transcribe the audio with whisper.cpp using DTW alignment, which gives the timing of every single word, then you draw every state of the subtitle as an image and overlay it on the video with ffmpeg. To stay in sync you need shots that last a whole number of frames and audio exactly as long as each shot.

What's the difference between an AI agent and an app like CapCut?

An editing app offers the styles and features decided by whoever designed it, and the editing is done by hand. An AI agent follows rules you write yourself (font, colours, cover, words to avoid), applies them on its own to every video and gets corrected by changing the rule. It takes more work at the start, much less for each video. The two can also be combined: with VectCutAPI, an open source project connected to Claude Code as an MCP server, the agent prepares a CapCut project with clips, text and subtitles already on the timeline, and the final polish is done by hand in CapCut.

Can you create a CapCut project with Claude?

Yes, if CapCut is installed on the computer. VectCutAPI, an open source project under the Apache 2.0 licence, adds an MCP server to Claude Code with eleven commands to create a draft, add video, audio, images, text, subtitles, effects and keyframes and save it in CapCut's format. The draft opens in CapCut like a normal project and is polished by hand; with the is_upload_draft setting on false it stays on the computer. Without CapCut, the agent can edit the finished video itself with ffmpeg and three Python scripts, as Simone Tabellini does.

Do you need to know how to code to use ffmpeg and Whisper?

No, if you work with an agent like Claude Code: it writes the scripts and the commands, runs them and checks the result. You need to know what you want to achieve and be able to describe it. The tools have to be installed once on the computer, and the agent can guide you through that too.

Can you create carousels for Instagram and LinkedIn with Claude?

Claude can write the copy for a carousel starting from a post or a fact, suggest the structure slide by slide and check an already laid-out carousel against a spec sheet (fonts, grid, words per slide). Automatic layout is built with the same method as the videos: at play2match, where it's being tested, the slides are HTML pages with the brand's colours and fonts, and Playwright turns them into exact 1080x1350 PNGs.

How much does an AI agent for social media content cost?

The tools Simone Tabellini uses are free and open source: ffmpeg, whisper.cpp, Python with Pillow and the Montserrat font. The only cost is the Claude subscription to use Claude Code. Transcription with whisper.cpp runs on the computer, without sending the audio to external services. The eight AI models in play2match's content director are free too, all with licences that allow business use.

Can AI choose the best cuts in a video?

It can suggest them: starting from the transcripts and the frames of the clips, the agent proposes a running order. But the story, meaning what to tell and in what order, is decided by whoever shot the footage. In Simone Tabellini's method the agent proposes and he says yes, and the narrating voice stays his.

Which open source AI models can you use to edit video locally?

play2match's content director, built by Simone Tabellini with Claude Code, runs eight free models with licences that allow business use: SigLIP 2 to search footage in words, MediaPipe to turn footage into 9:16 by following people, Demucs and DeepFilterNet to clean up the voice, RIFE for slow motion, BiRefNet for cut-outs, Real-ESRGAN to enlarge photos and SAM 2.1 to lift a person off the background in a video. None of them generates people, voices or video, and they all run on a Mac with 16 GB of RAM, one at a time.

How do you remove a photo's background with AI for free?

With BiRefNet, an open source model under the MIT licence that you use in Python through the rembg library. In play2match's content director it lifts a person off the background in about 19 seconds on a Mac, hair included, and returns a transparent PNG ready for a carousel or a cover. For small or old photos, Real-ESRGAN enlarges them four times without making them grainy.