Skip to content

thegauravmahto/recast

Repository files navigation

Recast

AI-powered video-to-ad content generator. Paste any Instagram Reel, YouTube Short, Facebook Ad, or TikTok video — get an adapted script, hook, caption, and visual direction for your brand in seconds.

Built with Next.js, Gemini AI, shadcn/ui, and Tailwind CSS.


What It Does

Recast downloads a social media video, analyzes it with Google's Gemini 2.5 Flash, and generates five adapted ad content sections for your product:

Output Description
Video Summary Breakdown of the source video's hook, format, tone, and structure
Adapted Hook A rewritten opening hook for your product (under 10 seconds)
Adapted Script 30-45 second script with [VISUAL CUE] markers, matching the source's pacing
Instagram Caption 100-150 word caption with hashtags and CTA
Visual Direction 2-3 scene descriptions with camera angles, overlays, and mood notes

The adapted script preserves the original language of the source video — Hindi stays Hindi, Tamil stays Tamil.


Features

  • Multi-platform support — Instagram Reels, YouTube Shorts, Facebook Ads, TikTok
  • Audio or Full Video mode — fast audio-only analysis or full visual + audio
  • Product URL scraping — paste a product page URL and context is auto-extracted
  • Copy any section — one-click copy on every result card
  • Dark mode — system-aware theme toggle
  • Cal.com-inspired design — monochrome, shadow-based depth, generous whitespace
  • Video preview — watch the downloaded source video inline

Quick Start

Prerequisites

  • Node.js 18+
  • yt-dlppip install yt-dlp or brew install yt-dlp
  • ffmpegbrew install ffmpeg
  • Google API KeyGet one here

Setup

git clone https://github.com/thegauravmahto/recast.git
cd recast
npm install

Create a .env file:

GOOGLE_API_KEY=your_google_api_key_here

Optionally set custom paths for yt-dlp and ffmpeg:

YTDLP_PATH=/usr/local/bin/yt-dlp
FFMPEG_PATH=/usr/local/bin/ffmpeg

Run

npm run dev

Open http://localhost:3000.


How It Works

Video URL → yt-dlp download → ffmpeg audio extraction (optional)
    → Gemini Files API upload → Gemini 2.5 Flash analysis
    → Structured markdown parsing → JSON response → UI
  1. Download — yt-dlp pulls the video from any supported platform
  2. Process — Audio extracted via ffmpeg (in audio mode) or full video sent
  3. Upload — File uploaded to Gemini's Files API, polled until ready
  4. Analyze — Gemini generates adapted ad content with a specialized system prompt
  5. Parse — Response split into 5 sections by markdown headers
  6. Render — Results displayed in a card grid with copy buttons

Tech Stack

Layer Technology
Framework Next.js 16 (App Router)
UI shadcn/ui, Tailwind CSS
AI Google Gemini 2.5 Flash
Video yt-dlp, ffmpeg
Styling Cal.com-inspired design system
Theme next-themes (dark/light)
Language TypeScript

Project Structure

recast/
├── app/
│   ├── layout.tsx              # Theme provider, fonts, metadata
│   ├── page.tsx                # Renders dashboard
│   ├── globals.css             # Design tokens, Cal.com shadows
│   └── api/
│       ├── analyze/route.ts    # Video download → Gemini → JSON
│       └── video/[filename]/   # Serves downloaded videos
├── components/
│   ├── dashboard.tsx           # Main UI — input, skeletons, results
│   ├── result-card.tsx         # Card with copy button
│   ├── theme-provider.tsx      # next-themes wrapper
│   └── theme-toggle.tsx        # Dark/light toggle
├── DESIGN.md                   # Design system reference
└── .env.example                # Environment variables template

Supported Platforms

  • Instagram Reels
  • YouTube Shorts & Videos
  • Facebook Ads (via Ads Library)
  • TikTok Videos
  • Any platform supported by yt-dlp

License

MIT


Author

GauravLinkedIn / X

About

AI-powered video-to-ad content generator. Paste any Instagram Reel, YouTube Short, or Facebook Ad — get adapted scripts, hooks, and captions for your brand. Built with Next.js, Gemini AI, and shadcn/ui.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors