Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑ AttentionX β€” Automated Content Repurposing Engine

AttentionX Banner

Python FastAPI Whisper MediaPipe Claude AI License

Transform 60-minute podcasts and lectures into 10 viral vertical clips β€” fully automated.

πŸš€ Quick Start β€’ 🎬 Demo β€’ πŸ“– Docs β€’ πŸ† Hackathon Edge


🎯 What Is AttentionX?

AttentionX is a fully automated AI pipeline that takes a long-form video (lecture, podcast, interview, webinar) and produces platform-ready 9:16 vertical short clips complete with:

  • βœ… Smart clip selection β€” Detects emotionally charged, high-impact moments using audio energy + NLP
  • βœ… Face-tracked vertical crop β€” Converts 16:9 β†’ 9:16 automatically keeping the speaker centered
  • βœ… Burned-in subtitles β€” TikTok-style bold captions with word-level timestamps
  • βœ… Viral hooks β€” Claude AI generates 3 platform-specific hooks per clip (TikTok, Instagram, YouTube)
  • βœ… One-click pipeline β€” Upload β†’ Process β†’ Download. Zero manual editing

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     USER INTERFACE (Streamlit)                   β”‚
β”‚              Upload Video ──► Track Progress ──► Download        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚ HTTP REST API
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      FASTAPI BACKEND                             β”‚
β”‚   POST /upload ──► Background Job ──► GET /status ──► /results  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    PROCESSING PIPELINE                           β”‚
β”‚                                                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
β”‚  β”‚  STEP 1  β”‚   β”‚  STEP 2  β”‚   β”‚  STEP 3  β”‚   β”‚  STEP 4  β”‚     β”‚
β”‚  β”‚  FFmpeg  │──►│  Whisper │──►│ Librosa  │──►│  FFmpeg  β”‚     β”‚
β”‚  β”‚  Audio   β”‚   β”‚   STT    β”‚   β”‚ + NLP    β”‚   β”‚   Clip   β”‚     β”‚
β”‚  β”‚ Extract  β”‚   β”‚Transcribeβ”‚   β”‚Detection β”‚   β”‚ Extract  β”‚     β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚
β”‚                                                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                     β”‚
β”‚  β”‚  STEP 5  β”‚   β”‚  STEP 6  β”‚   β”‚  STEP 7  β”‚                     β”‚
β”‚  β”‚MediaPipe │──►│  FFmpeg  │──►│  Claude  β”‚                     β”‚
β”‚  β”‚  Face    β”‚   β”‚Subtitle  β”‚   β”‚   Hook   β”‚                     β”‚
β”‚  β”‚ Tracking β”‚   β”‚ Burning  β”‚   β”‚Generator β”‚                     β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                     β”‚
β”‚                                                                  β”‚
β”‚                         β–Ό                                        β”‚
β”‚         OUTPUT: Vertical MP4 + SRT + JSON Metadata               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Key Features

Feature Technology Detail
🎡 Audio Extraction FFmpeg WAV 16kHz mono, loudness normalized
πŸ“ Transcription OpenAI Whisper Word-level timestamps, multi-language
πŸ’₯ Emotion Detection Librosa + NLP RMS energy + pitch variance + keyword scoring
βœ‚οΈ Clip Extraction FFmpeg Lossless stream copy or re-encode
πŸ“± Face Tracking MediaPipe Smooth 16:9β†’9:16 crop with exponential smoothing
πŸ’¬ Subtitles FFmpeg drawtext TikTok-style bold burned-in captions
πŸͺ Viral Hooks Claude AI 3 platform-specific hooks per clip
πŸ”„ Async Processing FastAPI + BackgroundTasks Non-blocking, real-time status polling
πŸ“¦ Export JSON + SRT + MP4 Ready to upload to any platform

πŸš€ Quick Start

Prerequisites

# Required system tools
python3.11+
ffmpeg          # brew install ffmpeg  |  sudo apt install ffmpeg
git

Option 1: Local Setup (Recommended for Demo)

# 1. Clone repository
git clone https://github.com/yourusername/attentionx.git
cd attentionx

# 2. Run the setup script (handles everything)
chmod +x start.sh
./start.sh

That's it! Open http://localhost:8501 in your browser.


Option 2: Manual Setup

# 1. Clone
git clone https://github.com/yourusername/attentionx.git
cd attentionx

# 2. Create virtual environment
python3 -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# 3. Install dependencies
pip install -r requirements.txt

# 4. Configure environment
cp .env.example .env
# Edit .env and add your ANTHROPIC_API_KEY

# 5. Create storage directories
mkdir -p storage/uploads storage/outputs storage/temp

# 6. Start backend (Terminal 1)
cd backend
uvicorn main:app --host 0.0.0.0 --port 8000 --reload

# 7. Start frontend (Terminal 2)
cd frontend
streamlit run app.py --server.port 8501

Option 3: Docker

# 1. Clone and configure
git clone https://github.com/yourusername/attentionx.git
cd attentionx
cp .env.example .env
# Edit .env with your API key

# 2. Run with Docker Compose
docker-compose up --build

# Access:
# Frontend: http://localhost:8501
# API Docs: http://localhost:8000/docs

πŸ“ Project Structure

attentionx/
β”œβ”€β”€ πŸ“„ README.md
β”œβ”€β”€ πŸ“„ requirements.txt
β”œβ”€β”€ πŸ“„ .env.example
β”œβ”€β”€ πŸ“„ .gitignore
β”œβ”€β”€ πŸ“„ Dockerfile
β”œβ”€β”€ πŸ“„ docker-compose.yml
β”œβ”€β”€ πŸ“„ start.sh
β”‚
β”œβ”€β”€ πŸ”§ backend/
β”‚   β”œβ”€β”€ main.py                    # FastAPI app + endpoints
β”‚   β”œβ”€β”€ pipeline/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ processor.py           # Master pipeline orchestrator
β”‚   β”‚   β”œβ”€β”€ audio_extractor.py     # Step 1: FFmpeg audio extraction
β”‚   β”‚   β”œβ”€β”€ transcriber.py         # Step 2: Whisper STT
β”‚   β”‚   β”œβ”€β”€ emotion_detector.py    # Step 3: Librosa + NLP scoring
β”‚   β”‚   β”œβ”€β”€ clip_extractor.py      # Step 4: Clip extraction
β”‚   β”‚   β”œβ”€β”€ face_tracker.py        # Step 5: MediaPipe face tracking
β”‚   β”‚   β”œβ”€β”€ subtitle_generator.py  # Step 6: Subtitle burning
β”‚   β”‚   └── hook_generator.py      # Step 7: Claude AI hooks
β”‚   └── utils/
β”‚       β”œβ”€β”€ __init__.py
β”‚       β”œβ”€β”€ config.py              # Pydantic settings
β”‚       └── helpers.py             # Utility functions
β”‚
β”œβ”€β”€ 🎨 frontend/
β”‚   └── app.py                     # Streamlit UI
β”‚
└── πŸ“¦ storage/                    # Auto-created at runtime
    β”œβ”€β”€ uploads/                   # Raw uploaded videos
    β”œβ”€β”€ outputs/                   # Processed clips + metadata
    └── temp/                      # Intermediate files (auto-cleaned)

πŸ”‘ Getting an API Key

AttentionX uses Claude AI for viral hook generation. To enable this:

  1. Go to console.anthropic.com
  2. Create an account (free tier available)
  3. Generate an API key
  4. Add it to your .env file:
    ANTHROPIC_API_KEY=sk-ant-your-key-here
    

Note: Hook generation works without an API key using our built-in template engine. The AI-powered hooks are simply higher quality.


πŸ“– API Documentation

Once running, visit http://localhost:8000/docs for interactive Swagger UI.

Key Endpoints

POST   /upload              Upload video + start processing
GET    /status/{job_id}     Poll processing progress
GET    /results/{job_id}    Get completed results
GET    /download/{job_id}/{filename}  Download a clip
DELETE /jobs/{job_id}       Clean up job data
GET    /jobs                List all jobs
GET    /health              Service health check

Example API Call

import requests

# Upload video
with open("my_podcast.mp4", "rb") as f:
    resp = requests.post(
        "http://localhost:8000/upload",
        files={"file": ("my_podcast.mp4", f, "video/mp4")},
        params={"max_clips": 5, "clip_duration": 60, "generate_hooks": True}
    )
    job_id = resp.json()["job_id"]

# Poll for completion
import time
while True:
    status = requests.get(f"http://localhost:8000/status/{job_id}").json()
    print(f"Progress: {status['progress']}% - {status['stage']}")
    if status["status"] in ["completed", "failed"]:
        break
    time.sleep(3)

# Get results
results = requests.get(f"http://localhost:8000/results/{job_id}").json()
for clip in results["clips"]:
    print(f"Clip {clip['clip_number']}: {clip['title']}")
    print(f"Download: {clip['download_url']}")

🎬 Demo

Sample Output

Input: 60-minute tech podcast (16:9 horizontal)

Output (5 clips, processed in ~8 minutes on CPU):

Clip 1 β€” 04:23 β†’ 05:23 | Score: 87%
  Title: "The Hidden Cost of Technical Debt Nobody Talks About"
  Hook:  "EVERY STARTUP FAILS FOR THIS EXACT REASON"
  Tags:  #startup #techdebt #programming #viral #coding

Clip 2 β€” 18:41 β†’ 19:41 | Score: 82%
  Title: "Why 90% of Developers Get This Completely Wrong"
  Hook:  "THEY NEVER TEACH YOU THIS IN COMPUTER SCIENCE"
  Tags:  #developer #coding #javascript #learn #shorts

Clip 3 β€” 34:12 β†’ 35:12 | Score: 79%
  Title: "The Real Reason Your Code Is Slow"
  Hook:  "WARNING: THIS MISTAKE COSTS COMPANIES MILLIONS"
  Tags:  #performance #coding #software #engineering #fyp

Sample SRT Output

1
00:00:00,000 --> 00:00:01,200
THE TRUTH IS

2
00:00:01,200 --> 00:00:02,800
NOBODY TALKS ABOUT

3
00:00:02,800 --> 00:00:04,400
TECHNICAL DEBT UNTIL

4
00:00:04,400 --> 00:00:06,000
IT'S TOO LATE

βš™οΈ Configuration Reference

All settings are in .env or backend/utils/config.py:

Variable Default Description
WHISPER_MODEL base tiny/base/small/medium/large
WHISPER_DEVICE cpu cpu or cuda
MAX_CLIPS_PER_VIDEO 10 Max clips to generate
DEFAULT_CLIP_DURATION 60 Clip length in seconds
OUTPUT_WIDTH 1080 Output video width
OUTPUT_HEIGHT 1920 Output video height
EMOTION_PEAK_THRESHOLD 0.65 Min score to select as peak
FACE_TRACKING_SMOOTH_FACTOR 0.15 Camera smoothness (lower = smoother)
SUBTITLE_FONT_SIZE 60 Caption font size

πŸš€ Deployment

Free Deployment Options

Railway (Recommended)

# Install Railway CLI
npm install -g @railway/cli
railway login
railway init
railway up

Render

# Connect GitHub repo to render.com
# Set build command: pip install -r requirements.txt
# Set start command: cd backend && uvicorn main:app --host 0.0.0.0 --port $PORT

Local Network Demo

# Expose local server (for demos without deployment)
# Install ngrok: https://ngrok.com
ngrok http 8501  # Frontend
ngrok http 8000  # Backend API

πŸ† Hackathon Winning Edge

3 Unique Features That Set Us Apart

1. 🧠 Multi-Signal Emotion Detection We don't just look for loud moments. Our proprietary scoring combines:

  • Audio RMS energy (volume peaks)
  • Spectral flux (rapid speech dynamics)
  • Pitch variation (emotional vocal range)
  • NLP keyword scoring (power words database of 60+ terms)

This creates a composite impact score that identifies moments humans would actually find compelling.

2. πŸ“± Smooth Face-Tracked Vertical Crop Unlike naive center-crop tools, we use MediaPipe face detection + exponential position smoothing to create a natural "camera operator" feel. The crop window follows the speaker without jarring jumps.

3. πŸͺ Platform-Native AI Hooks Hooks aren't generic β€” they're tailored per platform:

  • TikTok: FOMO + shock + curiosity gap
  • Instagram: Lifestyle + aspiration + save-worthy
  • YouTube Shorts: Question-based + SEO-optimized

Demo Script (2-Minute Pitch)

"Let me show you a problem every content creator faces.

You spend 3 hours recording a podcast.
You get 200 views.
Meanwhile, a 60-second clip from that same podcast
could get 2 million views on TikTok.

The problem isn't your content. It's distribution.
AttentionX solves this automatically.

[LIVE DEMO: Upload a 10-min video]

Watch as our AI:
1. Finds the 5 most emotionally compelling moments β€” not just the loudest ones
2. Converts horizontal video to vertical with face tracking
3. Burns TikTok-style captions
4. Generates platform-specific viral hooks using Claude AI

[Show results in 60 seconds on a pre-processed video]

What took an editor 4 hours now takes 8 minutes.
We're not replacing creators β€” we're giving them a 10x multiplier.

Thank you."

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

πŸ“„ License

MIT License β€” see LICENSE for details.


πŸ™ Acknowledgments


Built with ❀️ for hackathons | ⚑ AttentionX

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages