How does video streaming work?
HLS Streaming
HLS stands for HTTP Live Streaming.
.m3u8 file
A manifest file is a special file that provides metadata (data about data) for a group of files
text manifest file, in m3u format extended for HLS tells video plyer what chunks to download, metadata etc.
🔹 There are 2 types of HLS manifest files:
- Master Playlist (Master Manifest)
Points to multiple variant playlists (for adaptive bitrate streaming).
Lets the player choose the best quality based on network speed.
File extension: .m3u8
Example:
m3u Copy Edit #EXTM3U #EXT-X-STREAM-INF:BANDWIDTH=800000,RESOLUTION=640x360 low.m3u8 #EXT-X-STREAM-INF:BANDWIDTH=1400000,RESOLUTION=1280x720 mid.m3u8 #EXT-X-STREAM-INF:BANDWIDTH=2800000,RESOLUTION=1920x1080 high.m3u8
- Media Playlist
Points to the actual .ts segment files (or fMP4) that make up the video.
The player downloads and plays these in order.
Example: .ts files - video segments
.ts (Transport Stream) files are small chunks of the video, often ~10 seconds each. Each one contains:
Compressed video & audio
Encoded using MPEG-2 TS
Your player downloads and plays these chunks in sequence, giving the illusion of continuous playback.
- .vtt files — Subtitles/Captions
.vtt (WebVTT) files hold text-based subtitles or captions that sync with the video. Used for accessibility and translations.
has styling
How do we download files?
curl, jq, github REST API
ffmpeg -i 1.mp4 -i eng-2.vtt -c:v copy -c:a copy -c:s mov_text ep1.mp4