IPTVBlog
Search IPTVBlog

Guide· beginner

IPTV EPG explained: XMLTV sources, matching and time offsets

How an IPTV EPG works: XMLTV sources (.xml, .xml.gz), priorities, matching channels by name and country, time offsets, how apps fetch the guide, and fixes.

By
Published
Reading time
8 min · 1,859 words

An IPTV EPG, the programme guide your customers scroll through, is the feature that turns a list of streams into television. It also generates the vaguest tickets: “the guide is empty”, “the guide shows yesterday”, “the times are wrong”.

This guide explains where the data comes from (XMLTV) and how a panel attaches it to your channels. It covers why time offsets exist and how player apps fetch the guide. Then it walks through the common failures, so you stop guessing.

Short version: EPG data arrives as XMLTV, an XML file (often gzipped) listing channels and programmes with start and stop times. Your panel imports one or more sources on a schedule, matches each of your channels to a channel ID in a source, applies time offsets where a source’s times are wrong, and serves the result to apps through xmltv.php, the url-tvg header of your M3U or the player API. Almost every EPG problem is one of four things: no match, wrong match, wrong offset or a stale import.

What XMLTV is

XMLTV is a plain XML format from the early 2000s that nearly every IPTV panel, PVR and player understands. A file has two parts. First, a list of channels, each with an id attribute and one or more display names. Second, a list of programmes, each referring to a channel ID and carrying a start time, a stop time, a title and optional description, category, episode number and icon.

The time stamps look like 20261112203000 +0100: date and time to the second, then the offset from UTC. That trailing offset is the part that matters later.

.xml and .xml.gz

Sources publish the file either as .xml or compressed as .xml.gz. A guide for a few hundred channels over seven days is tens of megabytes uncompressed and a few megabytes gzipped. Panels import both; most also serve the guide gzipped to apps that accept it. If a source offers both, take the compressed one.

Where the data comes from

Broadcasters publish schedules. EPG data vendors collect, clean and license them. Community projects scrape public listings into XMLTV and share the result, with uneven quality and uncertain legal footing. Hardware operators sometimes capture the over-the-air EIT guide from satellite or DVB-T and export it.

Whichever you use, the data has an owner. Copyright or database rights cover schedule listings in many countries. A licensed vendor is part of running a legitimate service, alongside the stream rights themselves (see how to start an IPTV business).

How a panel imports and prioritises sources

The panel fetches each source on a schedule, parses it and stores programmes per channel ID.

With more than one source the panel needs a rule for conflicts. The usual rule is priority order. For each of your channels, the first source in your list with programmes for the matched ID wins. Lower-priority sources fill in only where higher ones have nothing.

In practice you layer sources. A paid, accurate feed for your main markets goes at the top. A broad free feed below it covers long-tail channels. A regional feed fills one country where the big feeds are weak.

Keep the list short. Every extra source is another file to parse, another set of IDs to match and another offset to get wrong.

Diagram: three XMLTV sources with priorities 1 to 3 feed the panel’s EPG importer, which matches IDs, applies offsets and serves xmltv.php, M3U url-tvg and player_api.php

Matching channels to the guide

Here is where the hours go. A source’s channel IDs look like ChannelOne.uk or newschannel.de or an opaque number. Your channels are called whatever you or your provider called them, say UK| CHANNEL ONE HD. Something has to connect the two.

Manual matching by EPG ID

Older panels, Xtream UI among them, make this a manual field: you type or paste the source’s channel ID into each stream. Thousands of channels mean thousands of fields; a typo means an empty guide for that channel. The Xtream UI panel guide describes how far its bulk editing goes, which is not far.

Automatic matching by name and country

Newer panels attempt the match for you. The usual approach normalises both names: it strips prefixes like UK|, suffixes like HD or FHD, punctuation and case. Then it compares them, often with the country as a filter. That way a French Channel One matches the French feed and not a Belgian relay.

Good matchers show you a confidence score and let you accept, reject or override per channel. Treat any automatic match as a proposal. Spot-check the channels your customers watch most. A wrong match (the right name on the wrong regional variant) is worse than no match, because the guide looks fine and lies.

Common mismatch causes

  • Regional variants: a national channel can have a dozen regional schedules; most sources carry only some.
  • Time-shifted channels (+1 channels) need a separate ID or an offset, not the parent’s guide.
  • HD and SD versions of a channel usually share an ID; 4K event channels usually have none.
  • Provider renames break matches that were keyed on the old name. Match on a stable channel ID of your own where the panel allows it.

Time offsets, per source and per channel

The XMLTV time stamp carries its own UTC offset, so in theory nothing else is needed.

In practice sources get it wrong. One feed labels everything +0000 although it was built in another zone. A scraper ignores daylight saving. A vendor serves the UK and Germany from one file with one offset.

Panels therefore offer two corrections. A source offset shifts everything from one source by a fixed number of hours. Use it when every channel from that source is wrong by the same amount. A channel offset shifts one channel; use it for +1 channels that reuse the parent’s data, or for a single mis-timed channel in an otherwise correct source.

Set the source offset first and only then touch channels. Stacked offsets are how a guide ends up two hours wrong after a clock change. Someone corrected the same error twice, at two levels.

Note the date the clocks change in your markets. A source that is right in winter may be wrong in summer, and the other way round.

How players consume the guide

Apps do not read your panel’s database. They fetch the guide in one of three ways, and knowing which one a given app uses shortens every EPG ticket.

xmltv.php is the Xtream Codes convention. A request to http://host:port/xmltv.php?username=…&password=… returns an XMLTV file with only the channels the line can see. It carries the panel’s matched IDs. Most Xtream-API apps and PVR add-ons use it, usually once a day with a cache.

url-tvg in the M3U is for playlist-based players. The playlist’s first line carries #EXTM3U url-tvg="http://…/xmltv.php?…"; some players also read x-tvg-url. Each channel line carries a tvg-id that must equal the channel ID inside that XMLTV file. If the IDs disagree, the player shows nothing, even though both files are correct on their own.

player_api.php serves the guide in JSON for apps that build their own guide view. get_short_epg returns the next few programmes on one channel. get_simple_data_table returns a channel’s full listing. The “now playing” line under a channel comes from these calls.

Apps that use them hit your main server far more often than apps that download the file once. That is why a popular app update can raise your API load overnight.

The Windows player comparison notes which method each player family uses; the pattern holds on Android and TV boxes too.

Troubleshooting

Work from the source towards the app. The table lists the symptoms we see most and where to look first.

Symptom Most likely cause Check
Guide empty for every channel Import failed or never ran; file not fetched, parse error, gzip mismatch Last import time and log in the panel; download the source URL by hand
Guide empty for some channels No match for those channels The channel’s EPG ID field; search the source file for the channel’s display name
Guide shows the wrong programmes Wrong match, usually a regional variant or a +1 channel Compare one programme against the broadcaster’s own schedule
Guide is off by one or more hours Offset error at source or channel level, or a daylight-saving change Source’s time stamps vs real time; remove stacked offsets
Guide shows yesterday or ends today Stale import; source publishes fewer days than you expected Import schedule; how many days ahead the source actually carries
Guide fine in one app, empty in another Different fetch method; tvg-id and XMLTV IDs disagree; file too large for the app Open xmltv.php for the line; compare IDs with the M3U; check file size
Guide fine on the panel server, wrong on load balancers Clock drift on the stream servers affecting catch-up and now/next NTP status on every server
EPG disappears after a provider rename Match was keyed on the old channel name Re-match; prefer stable IDs over names

Two habits prevent most of this. First, keep a short list of reference channels in each country you serve and glance at their guide against a public schedule once a day. Second, alert on import failures in the panel rather than waiting for a customer to tell you.

Illustration of an EPG mapping table: five channels with matched source IDs, confidence levels, a +1 h channel offset, one low-confidence match flagged for review and one channel without a match

How panels differ

Xtream UI and XUI One take XMLTV URLs or uploads and rely on a manual EPG ID per stream, with limited bulk tools. Hosted panels tend to add the automation.

IPTVOS, an advertiser on IPTVBlog, is one we have looked at. It accepts any number of XMLTV sources, plain or gzipped, with priorities. It proposes matches by name and country and has time offsets per source and per channel. It serves the result through xmltv.php, the M3U url-tvg and player_api.php.

IPTVOS is still in beta, so check its changelog before you rely on a specific behaviour. Whatever panel you use, the structure above is the same, and the troubleshooting table applies.

What to do next

  1. List the sources you use with their priority and the offset you set on each. If you cannot explain an offset, remove it and re-check the guide.
  2. Pick five reference channels per country and compare their guide against the broadcaster’s schedule today, then set a reminder for the next daylight-saving change.
  3. Open xmltv.php for a test line and confirm the channel IDs match the tvg-id values in the same line’s M3U.
  4. If you run Xtream UI, read the EPG section of the Xtream UI panel guide; for the servers behind the guide, see the server requirements guide.

Questions people ask

Where do I get XMLTV data for my channels?

From the broadcasters' published schedules, from licensed EPG data vendors, or from community XMLTV projects that scrape public listings. Check the licence of whatever you use; schedule data is copyrighted in many countries, and vendors sell it for a reason.

Why does the EPG show in the panel but not in the app?

The app fetches the guide separately from the stream list, usually through xmltv.php or player_api.php. Check that the line has access, that the file is not too large for the app to parse, and that the app's EPG refresh interval has passed. Many apps cache the guide for a day.

Why is my guide one hour off?

A time offset is wrong somewhere: the source publishes times in a different zone than its header claims, the server's time zone changed, or a per-channel offset was set for a channel that did not need it. Compare one programme against the broadcaster's own schedule and adjust the offset at the source level first.

How often should the panel refresh EPG sources?

Once or twice a day is enough for most schedule feeds; they publish a few days ahead. Refresh more often only for sources that update late-breaking changes, and never faster than the source itself updates, or you just add load without new data.

Can one channel take EPG from two sources?

Usually one source wins per channel. Source priority decides which: the panel takes the first source in priority order that has data for the channel's ID. Use that to layer a good paid source over a free fallback.

Topicsepgxmltvoperations

Comments

Keep reading