Skip to content

KunjShah01/video-broadcaster

Repository files navigation

📺 Custom Video Broadcaster

Video Broadcaster Logo

Python FastAPI OpenCV License

🚀 A modern, web-based video broadcasting solution with real-time effects and virtual camera support

FeaturesInstallationUsageArchitectureSupport

🎯 Features

🎥 Video Processing

  • 📹 Multi-Camera Support - Detect and use multiple camera devices
  • 🎛️ Real-time Controls - Adjust FPS, blur strength, and effects live
  • 🖼️ Background Effects - Blur, image, or video backgrounds
  • 🔄 Virtual Camera Output - Stream to other applications

🌐 Web Interface

  • 📱 Responsive Design - Works on desktop and mobile devices
  • 🎨 Modern UI - Clean, intuitive glassmorphism design
  • Real-time Updates - Live status and device management
  • 🔧 Easy Configuration - Simple web-based controls

🛠️ Technical Features

  • 🚀 FastAPI Backend - High-performance async API
  • 🎬 OpenCV Processing - Professional video processing
  • 📡 RESTful API - Clean API endpoints for integration
  • 🔒 Error Handling - Robust error management and logging

📋 Prerequisites

Before you begin, ensure you have the following installed:

  • 🐍 Python 3.8+
  • 📹 Camera/Webcam (built-in or USB)
  • 🌐 Modern Web Browser (Chrome, Firefox, Safari, Edge)

🚀 Installation

1️⃣ Clone the Repository

git clone https://github.com/KunjShah01/video-broadcaster.git
cd video-broadcaster

2️⃣ Create Virtual Environment

python -m venv venv
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate

3️⃣ Install Dependencies

pip install -r requirements.txt

4️⃣ Run the Application

python main.py

5️⃣ Access the Interface

Open your browser and navigate to:

http://localhost:8080

🎮 Usage

🔍 Getting Started

  1. 🎥 List Devices: Click "List Devices" to scan for available cameras
  2. 📹 Select Camera: Choose your preferred camera from the dropdown
  3. ⚙️ Configure Settings:
    • 🎛️ FPS: Set frame rate (1-60)
    • 🌫️ Blur Strength: Adjust background blur (1-52)
    • 🖼️ Background: Choose effect type
  4. ▶️ Start Streaming: Click "Start Streaming" to begin broadcast
  5. ⏹️ Stop Streaming: Click "Stop Streaming" to end session

🎛️ Controls Guide

Control Description Range/Options
📹 Camera Select input device Auto-detected cameras
🎯 FPS Frames per second 1-60
🌫️ Blur Background blur intensity 1-52 (odd numbers)
🖼️ Background Effect type None, Blur, Image, Video

🏗️ Architecture

📊 System Overview

graph TB
    A[🌐 Web Interface] --> B[📡 FastAPI Server]
    B --> C[🎥 Stream Utils]
    C --> D[📹 OpenCV Engine]
    D --> E[🎬 Video Processing]
    E --> F[📺 Virtual Camera Output]
    
    B --> G[📁 Static Files]
    G --> H[🎨 HTML/CSS/JS]
    
    style A fill:#e1f5fe
    style B fill:#f3e5f5
    style C fill:#e8f5e8
    style D fill:#fff3e0
    style E fill:#fce4ec
    style F fill:#f1f8e9
Loading

🔧 Component Architecture

🖥️ Frontend Layer

  • 📱 Responsive UI: Modern glassmorphism design
  • ⚡ Real-time Updates: Live status and controls
  • 🎨 Interactive Elements: Buttons, sliders, dropdowns

🌐 API Layer (FastAPI)

  • 🚀 High Performance: Async request handling
  • 📡 RESTful Endpoints: Clean API design
  • 🔒 Error Handling: Comprehensive error management

🎥 Processing Layer (OpenCV)

  • 📹 Camera Management: Device detection and control
  • 🎬 Video Processing: Real-time effects and filters
  • 🔄 Stream Management: Input/output handling

📁 Project Structure

📦 video-broadcaster/
├── 📄 main.py              # FastAPI application entry point
├── 🛠️ stream_utils.py      # Video processing utilities
├── 📋 requirements.txt     # Python dependencies
├── 📖 README.md           # Project documentation
├── 🤝 CONTRIBUTING.md     # Contribution guidelines
└── 📁 static/             # Web assets
    ├── 🎨 index.html      # Main web interface
    ├── 🖼️ logo.png        # Application logo
    └── 🖼️ image.png       # Background image

📡 API Reference

🔍 Endpoints

Method Endpoint Description Parameters
GET / 🏠 Serve main interface None
GET /devices 📹 List available cameras None
GET /start ▶️ Start video stream source, fps, blur_strength, background
POST /stop ⏹️ Stop video stream None

📝 Example Requests

// 🔍 Get available devices
fetch('/devices')
  .then(response => response.json())
  .then(devices => console.log(devices));

// ▶️ Start streaming
fetch('/start?source=0&fps=30&blur_strength=21&background=blur')
  .then(response => response.json())
  .then(result => console.log(result));

🛠️ Technologies Used

🔧 Backend

Python FastAPI OpenCV Uvicorn

🎨 Frontend

HTML5 CSS3 JavaScript

🐛 Troubleshooting

❌ Common Issues

🔌 Port Already in Use

# Error: [Errno 10048] Only one usage of each socket address is permitted
# Solution: Change port in main.py or kill existing process
netstat -ano | findstr :8080
taskkill /PID <PID_NUMBER> /F

📹 No Cameras Detected

# Ensure camera permissions are granted
# Check if camera is used by another application
# Restart the application

🌐 Web Interface Not Loading

# Check if server is running on correct port
# Verify static files are in place
# Clear browser cache

🚧 Roadmap

  • 🎨 Advanced Effects - Green screen, color filters
  • 📱 Mobile App - Native iOS/Android applications
  • 🌍 Multi-language - Internationalization support
  • 📊 Analytics - Usage statistics and monitoring
  • 🔐 Authentication - User accounts and security
  • ☁️ Cloud Integration - Remote streaming capabilities

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • 🎥 OpenCV Community - For excellent computer vision libraries
  • 🚀 FastAPI Team - For the amazing web framework
  • 🎨 Design Inspiration - Modern glassmorphism trends
  • 👥 Contributors - Everyone who helps improve this project

📞 Support

Need help? 🤝


⭐ Star this project if you find it useful! ⭐

Made with ❤️ by the Video Broadcaster Team

GitHub stars GitHub forks

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors