Convert m3u8 to xml

Convert M3U8 to XML

Convert an M3U8 playlist to XSPF or schema-specific XML with local tools.

Convert M3U8 files online

We don’t have a dedicated online converter for M3U8 to XML yet, but you can convert M3U8 files online to these formats:

How to convert m3u8 to xml file

A media catalog, device, or editing application may require an XML playlist instead of an HLS manifest. Converting the playlist can also make entries easier to archive, inspect, or edit, but the required XML structure is determined by the receiving application.

What the M3U8 format is

M3U8 is a UTF-8 encoded variant of the M3U playlist format, most commonly used for HTTP Live Streaming (HLS). It is a plain-text manifest containing directives such as #EXTINF, media-segment URLs, variant-stream URLs, encryption details, codecs, subtitles, and stream settings.

Streaming servers, Apple HLS tools, FFmpeg, VLC, IPTV systems, browser-based video services, and recording applications use M3U8 files. An HLS manifest normally references many .ts or fragmented MP4 segments; it does not contain the video itself.

What XML provides

XML stores hierarchical, named data in a format that applications can parse, edit, namespace, and validate against an XSD schema. It is used for configuration, catalogs, metadata, RSS, and playlist formats such as XSPF.

XML has no universal playlist vocabulary. One application may require <track> and <location>, another may require an IPTV-specific schema, and another may accept XSPF. A file can be well-formed XML and still be unusable if its elements, attributes, namespaces, or ordering do not match the target schema.

Convert it to XML with VLC

For a playlist that VLC can read, save it as XSPF, an XML-based playlist format:

  1. Open VLC and load the M3U8 through Media → Open File, or add it to the playlist.
  2. Open the playlist with View → Playlist.
  3. Choose Media → Save Playlist to File.
  4. Select XSPF playlist, if VLC presents a format choice, and save with an .xspf extension.

XSPF is not a generic XML conversion. It may preserve playable locations and basic track metadata while discarding HLS-specific directives, segment relationships, encryption data, and variant-stream information. Rename the extension only if the receiving program explicitly accepts XSPF content under .xml.

Create a local structured XML file

For a simple, application-independent representation, use Python’s standard library. This preserves directives as text and maps each URI to a track element with any preceding #EXTINF duration and title:

import sys
import xml.etree.ElementTree as ET

source, destination = sys.argv[1], sys.argv[2]
root = ET.Element('playlist', {'source': source})
pending = None

with open(source, encoding='utf-8-sig') as stream:
    for raw in stream:
        line = raw.strip()
        if not line:
            continue
        if line.startswith('#EXTINF:'):
            value = line[len('#EXTINF:'):]
            duration, title = value.split(',', 1) if ',' in value else (value, '')
            pending = (duration, title)
        elif line.startswith('#'):
            directive = ET.SubElement(root, 'directive')
            directive.text = line
        else:
            track = ET.SubElement(root, 'track')
            if pending is not None:
                duration, title = pending
                track.set('duration', duration)
                if title:
                    ET.SubElement(track, 'title').text = title
                pending = None
            ET.SubElement(track, 'uri').text = line

ET.indent(root, space='  ')
ET.ElementTree(root).write(destination, encoding='utf-8', xml_declaration=True)

Run it with:

python m3u8_to_xml.py input.m3u8 output.xml

This creates well-formed XML using a custom playlist, track, title, uri, and directive vocabulary. It is not automatically compatible with VLC, IPTV software, or another application. Rename the elements and attributes to match the recipient’s documentation or XSD. ET.indent requires Python 3.9 or later; omit that line on older versions.

Convert for a specific XML schema

Obtain an example XML file or XSD from the target application before converting. Map #EXTINF duration and title to the schema’s corresponding fields, map each following URI to its required URL or location element, and decide how to represent directives, variants, subtitles, keys, and segment lists. Oxygen XML Editor or another schema-aware XML editor can validate the result against an XSD, but no editor can infer an unknown playlist schema automatically.

Online conversion and compatibility limits

There is no universal, trustworthy one-click M3U8-to-XML service because the target XML vocabulary is undefined. An online converter is suitable only when it names the exact output schema required by the receiving program; upload a local, non-sensitive manifest, download the result, and validate it before use. Do not submit private, paid, tokenized, or temporary streaming URLs to an online service. A local Python script or desktop XML editor is safer for those files.

Relative URLs remain relative after conversion and must be resolved against the original manifest location. Converting the manifest does not download, decrypt, join, or re-encode its referenced media. Variant playlists, encryption keys, byte ranges, initialization sections, codecs, subtitles, and media-segment relationships may be lost unless the destination schema has fields for them.

M3U8 vs XML: format comparison

How the M3U8 and XML formats compare on the properties that matter most for this conversion.

Comparison of the M3U8 and XML file formats
Property .M3U8 HTTP Live Streaming playlist .XML Extensible Markup Language
Open standard Partly open Yes
Compression Uncompressed Uncompressed
Typical file size Very small Small
Opens in a web browser No Yes, natively
Further editing Easy Easy
Metadata support Basic Basic
Plain-text readable Yes Yes
Best used for Streaming Data exchange
Introduced 2009 1998
Developer Apple Inc. W3C
MIME type application/vnd.apple.mpegurl application/xml