[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"post:hls-video-streaming-on-a-budget":3},{"id":4,"slug":5,"title":6,"excerpt":7,"body":8,"tags":9,"read_minutes":14,"status":15,"published_at":16,"updated_at":17},"61d11639-6d8f-48e9-8794-88cf62ae147c","hls-video-streaming-on-a-budget","Streaming Course Video on a Budget: HLS, R2 and a CDN","How we serve adaptive-bitrate course video for near-zero cost using ffmpeg, Cloudflare R2's free egress, and signed URLs at the edge.","\u003Cp>Video is usually the most expensive part of running a learning platform. Managed players charge per minute watched; cloud storage charges again every time a student presses play. When we built learn.steleios.com we wanted Udemy-style playback — adaptive quality, resume position, instant seeking — without a per-view bill.\u003C\u002Fp>\u003Cp>The answer was a boring, reliable pipeline: ffmpeg for transcoding, Cloudflare R2 for storage, and a CDN in front. R2's killer feature is zero egress fees — the thing that makes most video hosting expensive is free.\u003C\u002Fp>\n\u003Ch2>The pipeline\u003C\u002Fh2>\u003Cp>When an instructor uploads a lesson, the server transcodes it into three HLS quality tiers (1080p, 720p, 480p) with four-second segments and a master playlist. The whole tree is pushed to R2 with immutable cache headers, so the CDN caches every segment essentially forever.\u003C\u002Fp>\u003Cp>The player is hls.js — it reads the master playlist and switches quality automatically as the student's bandwidth changes. Total cost per view after the first: effectively zero, because the CDN serves everything from cache.\u003C\u002Fp>\n\u003Ch2>Protecting paid content\u003C\u002Fh2>\u003Cp>Public bucket URLs are fine for previews but not for paid lessons. Our backend issues time-limited HMAC-signed URLs, and a small Cloudflare Worker verifies the signature at the edge before serving from R2. One token covers a whole video's playlist and segments, so the player never notices — but a shared link dies within hours.\u003C\u002Fp>\u003Cp>The lesson: you don't need a video SaaS to ship professional course playback. A day of plumbing with open tools gets you the same experience, and your costs stop scaling with your success.\u003C\u002Fp>",[10,11,12,13],"Video","Cloudflare R2","HLS","Architecture",7,"published","2026-07-09T00:00:00Z","2026-08-27T16:17:41.412599Z"]