Deploy OpenShorts

AI short generator with Apify YouTube downloading

Deploy OpenShorts

Just deployed

/data

OpenShorts — AI-Powered Vertical Video Generator

Deploy to Railway

OpenShorts turns long-form videos into viral vertical shorts. It offers three tools in one dashboard:

  1. Clip Generator — paste a YouTube URL, get AI-detected highlight clips cropped to 9:16.
  2. AI Shorts — generate UGC-style marketing videos with AI actors, subtitles and voice-over.
  3. 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

  1. Click the Deploy to Railway button above.
  2. 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).
  3. (Optional) Set APIFY_TOKEN for YouTube downloading via Apify — residential-network downloads bypass YouTube bot checks. Free tier includes $5/month usage.
  4. Wait for provisioning and the build to finish (first build pulls torch + deps; allow 3–5 minutes).
  5. Open your service URL — the dashboard loads at /.
  6. 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:

  1. Install a cookies export extension (e.g. Get cookies.txt LOCALLY for Chrome).
  2. Log into YouTube in your browser.
  3. Export your cookies to a cookies.txt file (Netscape format).
  4. In the OpenShorts dashboard, go to SettingsYouTube 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

VariableRequiredDescription
GEMINI_API_KEYYes
APIFY_TOKENNo
MAX_CONCURRENT_JOBSNo
AWS_ACCESS_KEY_IDNoOptional AWS access key for S3 upload of generated clips.
AWS_SECRET_ACCESS_KEYNoOptional AWS secret key paired with AWS_ACCESS_KEY_ID.
AWS_REGIONNoOptional AWS region. Default eu-west-3.
AWS_S3_BUCKETNoOptional S3 bucket for generated clips.
AWS_S3_PUBLIC_BUCKETNoOptional public S3 bucket for gallery public URLs.
PORTNoHTTP port (Railway sets this; default 8000 in the image).

Prerequisites

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

  1. You submit a YouTube URL (or upload a file) with a Gemini key.
  2. The backend queues the job and spawns main.py in a subprocess.
  3. If a YouTube URL was given, yt-dlp fetches the source MP4 locally (no vendor lock-in).
  4. Gemini picks highlight moments; ffmpeg crops each to 9:16 with smart tracking.
  5. faster-whisper transcribes audio; subtitles are burned in.
  6. 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

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
116
View Template
stella
Self-host stella with web, API, Postgres, Redis, and object storage.

Jan Kubica
5
View Template
Hermes Agent | OpenClaw Alternative with Dashboard
Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

codestorm
67