I built a tool that posts one YouTube Short a day — lessons on FFmpeg, free LLMs and the YouTube API
Every guide to growing on YouTube Shorts says the same thing: post every day. Almost nobody does it, because even a 40-second vertical video means finding a topic, writing a script, finding images, editing, adding music, writing a title and uploading.
So I built Corto Viral, a web app that does the whole pipeline. You connect your YouTube channel once, and from then on a new Short is written, edited and published every day. It's free for one channel and one Short a day.
Note: right now the Shorts it makes are in Spanish (it started as a tool for Spanish-speaking creators). English Shorts are next on the roadmap. The interface and tutorials are already in English.
Here's how it works under the hood, and the problems I didn't expect.
1. The pipeline
topic → script (LLM) → image search → frame composition (Pillow) → FFmpeg encode → YouTube upload
- Backend: FastAPI + SQLite. It started on MongoDB; I replaced it with a thin layer that mimics the parts of the Motor API I actually used, which made the move painless.
- Frontend: React, served by the same backend.
- Video: 1080×1920, with a slow camera move on each background, a text layer on top, random transitions and a music track. Colour palette, text style and transitions are picked per video from a seed, so two Shorts never look identical.
- Images: stock photo APIs (Pexels, Pixabay) with author credits in the video and in the description.
2. Lesson one: FFmpeg xfade can eat 3 GB of RAM
My first version passed every scene image to FFmpeg as a looped input and chained xfade transitions between them. It looked great, and it peaked at 3.3 GB of RAM for one 30-second video.
That's a problem when the app runs on a small VPS next to other services: one render and the kernel's OOM killer starts picking victims.
The fix was to stop asking FFmpeg to do the compositing:
- Python composes every frame (background crop + text layer + transition blend) with Pillow.
- It writes the raw frames to FFmpeg's stdin as
rgb24. - FFmpeg only has to encode.
proc = subprocess.Popen(
["ffmpeg", "-f", "rawvideo", "-pix_fmt", "rgb24",
"-s", "1080x1920", "-r", "30", "-i", "-",
"-i", music_path, "-c:v", "libx264", "-preset", "veryfast",
"-pix_fmt", "yuv420p", "-shortest", out_path],
stdin=subprocess.PIPE,
)
for frame in frames(): # generator: only a couple of frames in memory
proc.stdin.write(frame.tobytes())
proc.stdin.close()
proc.wait()
Result: about 460 MB for FFmpeg and 180 MB for Python, measured on the same video. On top of that:
- the compositing thread runs at a lower priority (
nice10); - FFmpeg is limited to 2 threads;
- only one render runs at a time, so the other services never notice.
3. Lesson two: free LLM APIs change under your feet
I wanted free users to cost me as little as possible, so scripts can come from several providers, including free tiers with OpenAI-compatible APIs.
What I learned the hard way: free model catalogues change without notice. A model you hard-coded last month can return a 404 today.
So the app doesn't hard-code a model. It:
- lists the provider's models;
- ranks them by preferred families, skipping coding, safety and tiny models;
- caches the ranking for 6 hours;
- on a 429, 404 or 5xx, moves to the next model and then to the next provider.
If every AI call fails, the Short is still made from a hand-written template, and the user sees a notice. A daily autopilot that silently skips days is worse than a slightly less creative video.
Parsing JSON from LLMs also needed a forgiving extractor. Some models wrap the JSON in code fences, and reasoning models add <think> blocks before it.
4. Lesson three: the YouTube API audit is the real launch date
Here's the thing nobody tells you. A Google Cloud project that hasn't passed YouTube's API audit uploads every video as private, and you can't make them public, not even by hand.
So "it works on my channel" means nothing until the audit is done. It took:
- an OAuth verification (privacy policy, terms, a demo video of the consent flow);
- then the YouTube API compliance audit (screen recordings, answers about data use and retention);
- a couple of rounds of questions.
Tips if you're going down this road:
- Ask for the minimum scopes. We only request upload and read-only access to the channel.
- Write a real data-retention policy and enforce it in code. For example, cached API data gets deleted after a fixed number of days.
- Separate projects. User channels run on their own Google Cloud project, so they never compete with my own channels for quota.
5. Small things that made a big difference
- Watermark-free paid tier, watermarked free tier. Simple, and it's honest about the trade-off.
- Disk guard: old videos are cleaned up hourly, and if free disk drops below a threshold, new renders are refused (503) instead of filling the disk.
- Image filtering: stock photo results are filtered by tags, to skip suggestive or inappropriate images and photos of children unless the topic asks for them. Then the app picks the photo that best matches the search words.
6. Where it is now
- ✅ Free plan: 1 YouTube channel, 1 Short published every day, forever, no card.
- ✅ Four short tutorials in English, with subtitles in 6 languages.
- 🔜 Voice-over, a "Viral Radar" that spots rising topics and writes an original Short about them (it never re-uploads anyone's video), more Shorts per day, English Shorts and cross-posting.
The other tutorials:
I'm the solo developer behind it, so feedback is very welcome, especially from anyone who's fought with FFmpeg memory or the YouTube audit.