Skip to main content
COSMICBYTEZLABS
NewsSecurityHOWTOsToolsStudyTraining
ProjectsNewsletterHire MeAbout
Subscribe

Press Enter to search or Esc to close

News
Security
HOWTOs
Tools
Study
Training
Projects
Newsletter
Hire Me
About
RSS Feed
Reading List
Subscribe

Stay in the Loop

Get the latest security alerts, tutorials, and tech insights delivered to your inbox.

Subscribe NowFree forever. No spam.
COSMICBYTEZLABS

Your trusted source for IT intelligence, cybersecurity insights, and hands-on technical guides.

1184+ Articles
136+ Guides

CONTENT

  • Latest News
  • Security Alerts
  • HOWTOs
  • Checklists
  • Projects
  • Exam Prep

RESOURCES

  • Search
  • Browse Tags
  • Newsletter Archive
  • Reading List
  • RSS Feed

COMPANY

  • About Us
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CosmicBytez Labs. All rights reserved.

System Status: Operational
  1. Home
  2. Projects
  3. Self-Hosted IPTV Manager with HDHomeRun Emulation for Plex
Self-Hosted IPTV Manager with HDHomeRun Emulation for Plex
PROJECTIntermediate

Self-Hosted IPTV Manager with HDHomeRun Emulation for Plex

An IPTV stream manager that pretends to be an HDHomeRun tuner so Plex DVR can record over-the-air-style live TV — M3U import, tier-based channel classification, FFmpeg HLS remux, and an XMLTV EPG.

Dylan H.

Projects

May 5, 2026
3 min read
4-6 hours

Tools & Technologies

Next.js 15FFmpegbetter-sqlite3Docker

Overview

Plex DVR speaks HDHomeRun. There are good reasons to want live TV in Plex (unified UI, recording, mobile streaming) but most IPTV sources don't natively talk to it. This project bridges the gap — a Next.js app that ingests M3U playlists, classifies channels by tier, and exposes them through HDHomeRun's discovery and lineup endpoints so Plex sees a "tuner" with whatever channels you've curated.

Stack

  • Framework: Next.js 15.1, React 19, TypeScript 5.7
  • Styling: Tailwind CSS 3.4
  • Database: SQLite (better-sqlite3)
  • Stream Processing: FFmpeg (HLS remux)
  • Deployment: Docker

Key Features

  • M3U playlist parsing and import (iptv-org or custom URLs)
  • HDHomeRun device emulation — Plex DVR recognizes it as a tuner
  • Tier-based channel classification (Canadian → International News → International Sports → Rejected)
  • Stream health checking and validation
  • Duplicate stream detection
  • XMLTV EPG export at /epg.xml
  • Source management with sync history
  • Plex DVR integration (device config, channel-number assignment)

Data Flow

  1. Sources — iptv-org or custom M3U URLs.
  2. Sync — fetch M3U, parse, classify channels by tier, filter rejects.
  3. Streams — stored in SQLite with tier, channel numbers, enable/disable.
  4. Lineup — exposed via HDHomeRun API for Plex.
  5. EPG — XMLTV export at /epg.xml.

Channel Tier System

  • Tier 1 — Canadian (CBC, CTV, CP24, Global, CPAC, TSN 1–5, Sportsnet variants)
  • Tier 2 — International News (BBC News, Sky News, CNN, Al Jazeera, France 24, DW, Euronews, NHK World)
  • Tier 3 — International Sports (ESPN, beIN Sports, Sky Sports News)
  • Tier 0 — Rejected (everything else)

HDHomeRun Endpoints

EndpointPurpose
GET /device.xmlDevice description for DLNA discovery
GET /discover.jsonDevice info for Plex
GET /lineup.jsonChannel lineup
GET /lineup_status.jsonTuner status
GET /stream/[id]Stream proxy endpoint (FFmpeg remux for HLS)

Database Schema (SQLite)

TableNotes
streamsURL, tier, channel_number, is_enabled
sourcesiptv_org or custom M3U source URLs
epg_programsTV-guide data
plex_settingsDevice ID, tuner count
sync_logSync history per source

Stream API

EndpointMethodsPurpose
/api/streamsGET / POSTList/create streams
/api/streams/[id]GET / PUT / DELETESingle stream CRUD
/api/streams/[id]/testGETTest stream health
/api/streams/importPOSTBulk import from M3U
/api/streams/exportGETExport as M3U
/api/streams/duplicatesGET / POSTDetect/manage duplicates
/api/streams/validateGET / POSTBatch validation

Lessons Learned

  • HDHomeRun discovery is case-sensitive for the manufacturer string — Plex won't pick up a tuner that returns the wrong casing in discover.json.
  • Plex caches the lineup aggressively. Force a refresh from the DVR settings after big channel changes.
  • HLS-to-MPEG-TS remux via FFmpeg is the cleanest path to broad client compatibility, at the cost of a few seconds of latency per stream.
#Next.js#IPTV#Plex#HDHomeRun#SQLite#FFmpeg#Self-Hosted

Related Articles

Orbit: An Offline-First Fitness PWA with Dual Storage Backend

A household fitness PWA with weight tracking, meal planning, workouts, and pantry — built on Next.js 15 with a single codebase that runs against either Supabase or local SQLite, plus an IndexedDB mutation queue for offline.

3 min read

Subscription Tracker: A 2-Tier Storage PWA for Recurring Expenses

Track subscriptions, utility bills, and payments with auto-payment generation and analytics — one Next.js codebase that runs on Docker with SQLite or on Vercel with localStorage, no per-target branching above the data layer.

3 min read

How CosmicBytez Labs Is Built: Next.js 16, velite, and Resend

A meta writeup about this site — content pipeline via velite (the contentlayer2 successor), a Resend-backed newsletter wired through a Vercel cron, the IT exam prep with 770 practice questions across 11 cert tracks, and the 8-tool utility suite.

3 min read
Back to all Projects