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.
- ✅ Download videos from secured Bunny.net endpoints
- 🎧 Extract audio using
ffmpegand 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
.
├── main.py # Single-file FastAPI app with all logic
├── README.md # You are here
└── downloads/ # Temporary video/audio storage
git clone https://github.com/yourusername/bunny-video-agent.git
cd bunny-video-agentpip install -r requirements.txtIf you don't have a
requirements.txt, run:
pip install fastapi uvicorn python-dotenv requests speechrecognition openai pinecone-clientCreate a .env file:
BUNNY_API_KEY=your_bunny_api_key
PINECONE_API_KEY=your_pinecone_api_keyuvicorn main:app --reloadThe server will start at: http://127.0.0.1:8000/docs
POST /agent/video/
{
"video_url": "https://video.bunnycdn.com/your-file-url.mp4",
}{
"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 ..."
}- 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
- Validate
Content-Typeto prevent unsafe files - Perform size and integrity checks
- Uses secure
.envmanagement for secrets