M3U8Parser 2.0.0

dotnet add package M3U8Parser --version 2.0.0
                    
NuGet\Install-Package M3U8Parser -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="M3U8Parser" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="M3U8Parser" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="M3U8Parser" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add M3U8Parser --version 2.0.0
                    
#r "nuget: M3U8Parser, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=M3U8Parser&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=M3U8Parser&version=2.0.0
                    
Install as a Cake Tool

M3U8 HLS Parser C#

Installation

Package NuGet : https://www.nuget.org/packages/M3U8Parser/

dotnet add package M3U8Parser

Documentation

M3U8Parser makes it easy to read, edit and create a m3u8 file.

  • M3U8Parser does not try to validate your file, it's your responsability to follow RFC.
  • Require .netstandard2.0 / .net6

Usage:

Read a file and edit it

    // Load a file
    var masterPlaylist = MasterPlaylist.LoadFromFile("master.m3u8");

    // Example, list all stream uri
    foreach(var stream in masterPlaylist.Streams)
    {
        Console.WriteLine("Uri:" + stream.Uri);
    }
    
    // Delete CLOSED-CAPTIONS type EXT-X-MEDIA
    masterPlaylist.Medias.RemoveAll(m => m.Type.Equals(MediaType.CloseCaptions));

Or your can create a master file

    var masterPlaylist = new MasterPlaylist(hlsVersion: 4);

    // Add EXT-X-MEDIA
    masterPlaylist.Medias.Add(new Media
    {
        Default = true,
        AutoSelect = true,
        Language = "eng",
        Name = "English",
        Type = MediaType.Audio,
        GroupId = "audio"
    });

    // Add another EXT-X-MEDIA but from text, yes it works!

    var mediaWithDv = new Media("#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio\",NAME=\"English DV\",LANGUAGE=\"eng\",AUTOSELECT=YES,DEFAULT=NO");
    mediaWithDv.Characteristics = "public.accessibility.describes-video";

    masterPlaylist.Medias.Add(mediaWithDv);

    // Add EXT-X-STREAM
    masterPlaylist.Stream.Add(new StreamInf()
    {
        Codecs = "avc1.4d401f,mp4a.40.2",
        Bandwidth = 900000,
        Uri = "v0.m3u8"
    });
    
    masterPlaylist.Stream.Add(new StreamInf()
    {
        Codecs = "avc1.4d401f,mp4a.40.2",
        Bandwidth = 1000000,
        Uri = "v1.m3u8"
    });

This code should produce the following master playlist:

#EXTM3U
#EXT-X-VERSION:4

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="English",LANGUAGE="eng",AUTOSELECT=YES,DEFAULT=YES
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="English DV",LANGUAGE="eng",AUTOSELECT=YES,DEFAULT=NO,CHARACTERISTICS="public.accessibility.describes-video"

#EXT-X-STREAM-INF:BANDWIDTH=900000,CODECS="avc1.4d401f,mp4a.40.2"
v0.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1000000,CODECS="avc1.4d401f,mp4a.40.2"
v1.m3u8

Supported tags

The following tags should be fully supported:

Basics

TAGS
EXTM3U
EXT-X-VERSION

Master Playlist Tags

TAGS ATTRIBUTE
EXT-X-MEDIA GROUP-ID, AUTOSELECT, DEFAULT, LANGUAGE, NAME, TYPE, URI, CHARACTERISTICS, INSTREAM-ID
EXT-X-STREAM-INF AVERAGE-BANDWIDTH, BANDWIDTH, CODECS, HDCP-LEVEL, RESOLUTION, URI, AUDIO, VIDEO, CLOSED-CAPTIONS, SUBTITLES, VIDEO-RANGE, FRAME-RATE
EXT-X-I-FRAME-STREAM-INF AVERAGE-BANDWIDTH, BANDWIDTH, CODECS, HDCP-LEVEL, RESOLUTION, URI, VIDEO, VIDEO-RANGE

Media Playlist Tags

TAGS ATTRIBUTE
EXT-INDEPENDENT-SEGMENTS
EXT-X-PLAYLIST-TYPE EVENT, VOD
EXT-X-I-FRAMES-ONLY
EXT-X-MAP URI
EXT-X-MEDIA-SEQUENCE
EXT-X-TARGETDURATION
EXTINF
EXT-X-ENDLIST
EXT-X-KEY METHOD (NONE, AES-128, SAMPLE-AES), URI
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 468 4/19/2025
2.0.0-beta1 244 10/27/2024
1.0.5 6,245 8/4/2024
1.0.4 1,412 6/30/2024
1.0.3 3,872 6/1/2024
1.0.2 8,431 8/25/2023
1.0.1 3,744 4/24/2023
1.0.0 883 3/6/2023
1.0.0-alpha04 242 1/21/2023 1.0.0-alpha04 is deprecated.
1.0.0-alpha03 230 1/20/2023 1.0.0-alpha03 is deprecated.
1.0.0-alpha02 224 1/20/2023 1.0.0-alpha02 is deprecated.
1.0.0-alpha01 221 1/18/2023 1.0.0-alpha01 is deprecated.
0.0.5 326 2/4/2023
0.0.4 314 1/31/2023
0.0.3 336 1/31/2023
0.0.2 334 1/30/2023
0.0.1 338 1/21/2023