A video streaming service in Spring Boot supporting video upload, transcoding to HTTP Live Streaming (HLS) and playback.
- 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
- 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+
- Java 17 or higher installed
- Maven
- Docker
- FFMPEG (if running locally without Docker)
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 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 pathSTORAGE_HLS_PATH- HLS output directory pathS3_ENABLED- Enable S3 storage (default: false)S3_BUCKET- S3 bucket nameS3_ACCESS_KEY- S3 access keyS3_SECRET_KEY- S3 secret keyS3_REGION- S3 regionFFMPEG_PATH- Path to FFMPEG executableFFPROBE_PATH- Path to FFPROBE executableMAX_FILE_SIZE- Maximum file size (in MB)JWT_SECRET- JWT secretJWT_EXPIRATION_TIME- JWT expiration time (in milliseconds)
The backend provides a RESTful API for video management:
POST /api/auth/register- Register a new userPOST /api/auth/login- Login with username and password`POST /api/videos/upload- Upload a new videoGET /api/videos- Get all videosGET /api/videos/{id}- Get video by IDGET /api/videos/ready- Get ready-to-stream videosGET /api/videos/{id}/stream- Stream video directlyGET /api/videos/{id}/hls/playlist.m3u8- Get HLS playlistGET /api/videos/{id}/hls/{segment}- Get HLS segmentGET /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 thumbnailDELETE /api/videos/{id}- Delete videoGET /api/analytics/{videoId}/track- Generate video analytics
- 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