a python cli that generates youtube shorts end-to-end using only free ai services. give it a topic, get back a vertical 1080x1920 video with voiceover, burned captions, and ai-generated visuals.
- generates a script from your topic via openrouter (free llm tier)
- fetches ai images from pollinations.ai for each scene (no auth required)
- synthesizes voiceover using edge-tts (microsoft tts, completely free)
- transcribes audio locally with faster-whisper to produce captions
- composes everything into a shorts-ready mp4 via ffmpeg
zero paid api calls required. one openrouter account for the script step is the only external dependency.
requires python 3.11+, ffmpeg on your $PATH, and uv.
git clone https://github.com/numbpill3d/ffmpeg-ai.git
cd ffmpeg-ai
uv pip install -e ".[dev]"copy .env.example to .env and add your openrouter key:
cp .env.example .env
# edit .env — get a free key at https://openrouter.ai# generate a short from a topic
python -m ffmpeg_ai generate "the history of the moon"
# preview the pipeline steps without making api calls
python -m ffmpeg_ai generate --dry-run "any topic"or via the installed entrypoint:
ffmpeg-ai generate "deep sea creatures ranked"| property | value |
|---|---|
| resolution | 1080 x 1920 (9:16) |
| framerate | 30 fps |
| max length | 60 seconds |
| video codec | h.264 |
| audio codec | aac |
| captions | burned-in (ass) |
| service | purpose | auth required |
|---|---|---|
| openrouter | script generation | free api key |
| pollinations.ai | image generation | none |
| edge-tts | voiceover / tts | none |
| faster-whisper | local transcription | none (local) |
src/ffmpeg_ai/
├── cli.py # typer entrypoint
├── pipeline.py # full generation pipeline
├── ai/
│ ├── openrouter.py # llm client
│ ├── images.py # pollinations image fetcher
│ └── tts.py # edge-tts voiceover
├── video/
│ ├── composer.py # all ffmpeg subprocess calls
│ ├── captions.py # whisper + ass/srt generation
│ └── shorts.py # shorts constants and helpers
└── ui/
├── display.py # ascii banner, pipeline status
└── widgets.py # rich renderables
uv pip install -e ".[dev]"
pytest
ruff check src/mit

