Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Video Streaming Service - Backend

A video streaming service in Spring Boot supporting video upload, transcoding to HTTP Live Streaming (HLS) and playback.

Features

  • Video Upload
  • Transcoding Using FFMPEG for transcoding
  • Multi-Bitrate Adaptive Streaming: HLS with multiple quality levels (1080p, 720p, 480p) for adaptive streaming
  • User Authentication: JWT-based authentication and authorization
  • Video Analytics: Track views, watch duration, and video engagement metrics
  • Asynchronous Processing: RabbitMQ message queue for asynchronous video processing
  • Thumbnail Generation: Generate thumbnails for uploaded videos
  • Caching: Caching video metadata and thumbnails in Redis
  • Video Metadata: Store video metadata (title, description, duration, tags, etc.)
  • Search: Search videos by title, description, tags, etc.
  • File Storage: Store uploaded videos and thumbnails on AWS S3
  • Docker: Docker Compose for local development and production deployment

Tech Stack

  • Framework: Spring Boot 4.0.0
  • Database: PostgreSQL 17
  • Caching: Redis 8
  • Message Queue: RabbitMQ 3
  • Authentication: Spring Security with JWT
  • Storage: AWS S3 (local file system for development/fallback)
  • Video Processing: FFMPEG
  • Build Tool: Maven
  • Java Version: 17+

Prerequisites

  • Java 17 or higher installed
  • Maven
  • Docker
  • FFMPEG (if running locally without Docker)

Project Structure

VideoStreamingBackend/
├── src/
│   ├── main/
│   │   ├── java/com/videostreamingservice/
│   │   │   ├── VideoStreamingServiceBackendApplication.java
│   │   │   ├── config/
│   │   │   ├── controller/
│   │   │   ├── entity/
│   │   │   ├── repository/
│   │   │   └── service/
│   │   └── resources/
│   │       └── application.properties
│   └── test/
├── Dockerfile
├── docker-compose.yml
├── pom.xml
└── README.md

Configuration

Configuration is managed through src/main/resources/application.properties and environment variables.

Key environment variables:

  • DB_HOST - PostgreSQL host (default: localhost)
  • DB_PORT - PostgreSQL port (default: 5432)
  • DB_NAME - Database name (default: videodb)
  • DB_USER - Database user (default: postgres)
  • DB_PASSWORD - Database password (default: postgres)
  • REDIS_HOST - Redis host (default: localhost)
  • REDIS_PORT - Redis port (default: 6379)
  • RABBITMQ_HOST - RabbitMQ host (default: localhost)
  • RABBITMQ_PORT - RabbitMQ port (default: 5672)
  • RABBITMQ_USERNAME - RabbitMQ username (default: guest)
  • RABBITMQ_PASSWORD - RabbitMQ password (default: guest)`
  • STORAGE_UPLOAD_PATH - Upload directory path
  • STORAGE_HLS_PATH - HLS output directory path
  • S3_ENABLED - Enable S3 storage (default: false)
  • S3_BUCKET - S3 bucket name
  • S3_ACCESS_KEY - S3 access key
  • S3_SECRET_KEY - S3 secret key
  • S3_REGION - S3 region
  • FFMPEG_PATH - Path to FFMPEG executable
  • FFPROBE_PATH - Path to FFPROBE executable
  • MAX_FILE_SIZE - Maximum file size (in MB)
  • JWT_SECRET - JWT secret
  • JWT_EXPIRATION_TIME - JWT expiration time (in milliseconds)

API Endpoints

The backend provides a RESTful API for video management:

  • POST /api/auth/register - Register a new user
  • POST /api/auth/login - Login with username and password`
  • POST /api/videos/upload - Upload a new video
  • GET /api/videos - Get all videos
  • GET /api/videos/{id} - Get video by ID
  • GET /api/videos/ready - Get ready-to-stream videos
  • GET /api/videos/{id}/stream - Stream video directly
  • GET /api/videos/{id}/hls/playlist.m3u8 - Get HLS playlist
  • GET /api/videos/{id}/hls/{segment} - Get HLS segment
  • GET /api/videos/{id}/hls/format/{1080p|720p|480p}.m3u8 - Get HLS segment`
  • GET /api/videos/{id}/metadata - Get video metadata`
  • GET /api/videos/{id}/thumbnail - Get video thumbnail
  • DELETE /api/videos/{id} - Delete video
  • GET /api/analytics/{videoId}/track - Generate video analytics

Future Improvements

  • Add support for video conversion to other formats (e.g., MP4)
  • CDN integration for global distribution
  • Video encryption and DRM
  • Live Streaming Support
  • Video Playlists and Recommendations
  • Generated Video Subtitles

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages