Skip to content

Dinakarnayak/bunny_agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

🎬 Bunny Video Agent API

A professional FastAPI application that integrates with Bunny.net to download and process videos, extract and transcribe audio, generate semantic metadata using OpenAI, and store it in Pinecone for semantic search and retrieval.


🚀 Features

  • ✅ Download videos from secured Bunny.net endpoints
  • 🎧 Extract audio using ffmpeg and transcribe it with Google Speech Recognition
  • 📄 Generate metadata and embeddings using OpenAI
  • 📦 Store transcription and metadata into Pinecone Vector DB
  • 📤 Clean and modular FastAPI design with logging and error handling

📁 Directory Structure


.
├── main.py           # Single-file FastAPI app with all logic            
├── README.md         # You are here
└── downloads/        # Temporary video/audio storage


⚙️ Setup Instructions

1. Clone the Repository

git clone https://github.com/yourusername/bunny-video-agent.git
cd bunny-video-agent

2. Install Dependencies

pip install -r requirements.txt

If you don't have a requirements.txt, run:

pip install fastapi uvicorn python-dotenv requests speechrecognition openai pinecone-client

3. Add Environment Variables

Create a .env file:

BUNNY_API_KEY=your_bunny_api_key
PINECONE_API_KEY=your_pinecone_api_key

▶️ Running the App

uvicorn main:app --reload

The server will start at: http://127.0.0.1:8000/docs


🧪 Example API Usage

Endpoint

POST /agent/video/

Request Body

{
  "video_url": "https://video.bunnycdn.com/your-file-url.mp4",
 
}

Response

{
  "message": "🎉 Success",
  "video_path": "downloads/video_abc123.mp4",
  "metadata": {
    "title": "video_abc123.mp4",
    "description": "Video file ...",
    "size": "10485760 bytes",
    "resolution": "Unknown",
    "keywords": [...]
  },
  "transcription": "Hello world, this is an example video ..."
}

🛠 Tech Stack

  • FastAPI – Modern Python web framework
  • OpenAI – For metadata embedding
  • Pinecone – For vector storage and retrieval
  • SpeechRecognition – For transcribing video audio
  • FFmpeg – For audio extraction
  • Agno SDK – Agent-based LLM orchestration

🔐 Security Notes

  • Validate Content-Type to prevent unsafe files
  • Perform size and integrity checks
  • Uses secure .env management for secrets

👤 Author

Dinakar Nayak N GitHubLinkedIn

About

An AI-powered FastAPI service that downloads, transcribes, and embeds Bunny.net videos using AGNO, FFmpeg, OpenAI, and Pinecone.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages