Deploy OpenShorts
AI short generator with Apify YouTube downloading
openshorts
Just deployed
/data
OpenShorts — AI-Powered Vertical Video Generator
OpenShorts turns long-form videos into viral vertical shorts. It offers three tools in one dashboard:
- Clip Generator — paste a YouTube URL, get AI-detected highlight clips cropped to 9:16.
- AI Shorts — generate UGC-style marketing videos with AI actors, subtitles and voice-over.
- YouTube Studio — generate thumbnails, titles and descriptions with AI.
This is the official one-click Railway template. The dashboard is served same-origin from the FastAPI backend, so there is no extra service to configure.
Features
- YouTube downloading via Apify — residential-network downloads bypass YouTube's datacenter-IP bot checks (includes $5/month free tier).
- yt-dlp fallback — optional local downloader if you prefer not to use Apify (may fail on Railway's AWS/GCP IPs).
- AI clip detection — Gemini analyses long videos and picks the most viral moments.
- Vertical crop with smart tracking — auto-faces/peaks keep subjects centred in 9:16.
- Burned subtitles — faster-whisper transcription, baked into the final MP4.
- AI voice-over and translation — synthesis + translation pipeline for multilingual shorts.
- AI thumbnail & title generation — artwork and copy from Gemini.
- S3 backup gallery — optionally mirror generated clips to AWS S3 for a public gallery.
- Hash-routed dashboard — single-page React app served by FastAPI (no separate web server).
- One worker-concurrency limit — stay inside a small Railway plan's RAM envelope.
Quick Start
- Click the Deploy to Railway button above.
- Railway will prompt you for
GEMINI_API_KEY— this is required for the full pipeline. Supply it during setup (or add it in the service's Variables tab afterward). - (Optional) Set
APIFY_TOKENfor YouTube downloading via Apify — residential-network downloads bypass YouTube bot checks. Free tier includes $5/month usage. - Wait for provisioning and the build to finish (first build pulls torch + deps; allow 3–5 minutes).
- Open your service URL — the dashboard loads at
/. - Use the Clip Generator tab with a YouTube URL, or upload a local video file.
YouTube Cookies (Optional)
Some YouTube videos are age-restricted or require login. To download these, provide a browser cookies file:
- Install a cookies export extension (e.g. Get cookies.txt LOCALLY for Chrome).
- Log into YouTube in your browser.
- Export your cookies to a
cookies.txtfile (Netscape format). - In the OpenShorts dashboard, go to Settings → YouTube Cookies and upload the file.
The file is saved to a fixed path on the Railway volume and is picked up by yt-dlp immediately — no service restart or path configuration needed.
Environment Variables
| Variable | Required | Description |
|---|---|---|
GEMINI_API_KEY | Yes | |
APIFY_TOKEN | No | |
MAX_CONCURRENT_JOBS | No | |
AWS_ACCESS_KEY_ID | No | Optional AWS access key for S3 upload of generated clips. |
AWS_SECRET_ACCESS_KEY | No | Optional AWS secret key paired with AWS_ACCESS_KEY_ID. |
AWS_REGION | No | Optional AWS region. Default eu-west-3. |
AWS_S3_BUCKET | No | Optional S3 bucket for generated clips. |
AWS_S3_PUBLIC_BUCKET | No | Optional public S3 bucket for gallery public URLs. |
PORT | No | HTTP port (Railway sets this; default 8000 in the image). |
Prerequisites
- A Railway account.
- A Google Gemini API key.
- (Optional) an AWS account + S3 bucket if you want the public gallery.
Architecture
┌─────────────────────────────────────────────────────────┐
│ Railway Project │
│ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ OpenShorts service (single) │ │
│ │ │ │
│ │ uvicorn ── app:app (port $PORT) │ │
│ │ ├── /api/* JSON API (process, status…) │ │
│ │ ├── /health Railway healthcheck │ │
│ │ ├── /videos/* static generated clips │ │
│ │ ├── /thumbnails/* static thumbnails │ │
│ │ └── /* pre-built React dashboard │ │
│ │ │ │
│ │ Volume: /data ── output/ + uploads/ │ │
│ └─────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
The multi-stage Docker build compiles the Vite dashboard in a node stage, then copies the result into a python:3.11-slim runtime image with CPU-only PyTorch, ffmpeg and all ML deps. There is no separate renderer to run — the dashboard's preview is in-browser (@remotion/player).
Deploy
Click the button at the top of this README. Railway builds the image, mounts a persistent volume for your generated clips, and routes a public domain to the service. If you set a custom domain later, update the service's Settings → Networking → Custom Domains page.
How It Works
- You submit a YouTube URL (or upload a file) with a Gemini key.
- The backend queues the job and spawns
main.pyin a subprocess. - If a YouTube URL was given, yt-dlp fetches the source MP4 locally (no vendor lock-in).
- Gemini picks highlight moments; ffmpeg crops each to 9:16 with smart tracking.
faster-whispertranscribes audio; subtitles are burned in.- The finished clips land under
/data/output//and are streamable at/videos/....
Deploy and Host
Deploy this template on Railway with one click. Railway provides compute, TLS at the edge, and a public URL. The service restarts automatically on failures.
About Hosting
This template runs as a single container with a persistent volume for generated videos and uploaded source files. The dashboard, the JSON API, the healthcheck and the video files are all served by one FastAPI process on $PORT. There is no external database to manage — clips are written directly to the attached volume.
Why Deploy
- One-click deploy — no setup, just provide two API keys and go.
- Single service — no multi-service orchestration, no extra Redis/Postgres to wire.
- Automatic HTTPS — Railway provisions TLS certificates automatically.
- Self-healing — automatic restarts on failure.
- Persistent storage — your generated clips survive deploys and restarts on the attached volume.
- CPU-only ML — PyTorch runs on CPU, which is all a default Railway plan needs.
Common Use Cases
- Repurpose long-form YouTube/Twitch content into TikToks, Reels and Shorts.
- Produce AI-UGC marketing videos at scale.
- Generate AI thumbnails and titles for a video pipeline.
- Run a self-hosted alternative to paid clipping SaaS.
- Prototype a short-video pipeline on a free Railway plan.
Dependencies for OpenShorts
Deployment Dependencies
- Railway Account — hosting platform.
- yt-dlp — YouTube video downloader (bundled with the image, no external token needed).
- Google Gemini API — AI clip detection, titles, thumbnails, voice-over.
No external database, cache or message queue is required. Optional AWS S3 is only needed if you want generated clips mirrored to a public gallery.
Template Content
openshorts
INAPP-Mobile/openshorts-fresh