Full-stack video streaming platform with Netflix-style architecture, HLS adaptive bitrate, and Go microservices
Videos Transcoded
Quality Levels
Microservices
HLS Content
Built a production-ready Over-The-Top (OTT) streaming platform from scratch, featuring Netflix-style architecture with adaptive bitrate streaming. The platform handles video upload, transcoding to multiple resolutions (1080p, 720p, 480p, 360p), and serves content via HLS (HTTP Live Streaming) for seamless playback across devices.
┌─────────────────────────────────────────────────────────────────────────────┐ │ OTT Platform Architecture │ ├─────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌──────────┐ ┌──────────────┐ ┌──────────────┐ ┌─────────────┐ │ │ │ Client │────▶│ API Gateway │────▶│ Media Service│────▶│ MinIO │ │ │ │ (Player) │ │ (Go/Fiber) │ │ (Go/FFmpeg) │ │ (Storage) │ │ │ └──────────┘ └──────────────┘ └──────────────┘ └─────────────┘ │ │ │ │ │ │ │ │ │ ▼ ▼ │ │ │ │ ┌──────────────┐ ┌──────────────┐ │ │ │ │ │ PostgreSQL │ │ Redis │ │ │ │ │ │ (Metadata) │ │ (Cache) │ │ │ │ │ └──────────────┘ └──────────────┘ │ │ │ │ │ │ │ └─────────────── HLS Streaming ◀──────────────────────────────┘ │ │ │ │ Transcoding Pipeline: │ │ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │ │ │ Upload │──▶│ Decode │──▶│ Scale │──▶│ Encode │──▶│ HLS │ │ │ │ MP4 │ │ FFmpeg │ │ 4 Res │ │ H.264 │ │ .m3u8 │ │ │ └────────┘ └────────┘ └────────┘ └────────┘ └────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────┘
HLS with multiple quality levels (1080p, 720p, 480p, 360p) that automatically adjusts based on network conditions for buffer-free playback.
Automated video processing with FFmpeg for format conversion, resolution scaling, and HLS segmentation with optimized encoding settings.
Separate API Gateway and Media Service for scalability. Each service is containerized with Docker and orchestrated via Docker Compose.
Secure user authentication with JWT tokens, bcrypt password hashing, and role-based access control for content management.
PostgreSQL database for content metadata, user profiles, watchlists, and viewing history with Redis caching for performance.
MinIO S3-compatible storage for raw uploads and HLS segments, enabling easy migration to AWS S3 or other cloud providers.
// Transcode video to multiple HLS quality levels func (t *FFmpegTranscoder) TranscodeToHLS(input, outputDir string) error { resolutions := []Resolution{ {Name: "1080p", Width: 1920, Height: 1080, Bitrate: "5000k"}, {Name: "720p", Width: 1280, Height: 720, Bitrate: "2500k"}, {Name: "480p", Width: 854, Height: 480, Bitrate: "1000k"}, {Name: "360p", Width: 640, Height: 360, Bitrate: "500k"}, } for _, res := range resolutions { args := []string{ "-i", input, "-vf", fmt.Sprintf("scale=%d:%d", res.Width, res.Height), "-c:v", "libx264", "-b:v", res.Bitrate, "-c:a", "aac", "-b:a", "128k", "-hls_time", "4", "-hls_list_size", "0", filepath.Join(outputDir, res.Name, "playlist.m3u8"), } exec.Command("ffmpeg", args...).Run() } return t.generateMasterPlaylist(outputDir, resolutions) }