{"id":13615643,"url":"https://github.com/grafov/m3u8","last_synced_at":"2025-08-07T03:31:12.687Z","repository":{"id":6792198,"uuid":"8039629","full_name":"grafov/m3u8","owner":"grafov","description":"Parser and generator of M3U8-playlists for Apple HLS. Library for Go language. :cinema:","archived":false,"fork":false,"pushed_at":"2024-08-02T16:01:26.000Z","size":749,"stargazers_count":1237,"open_issues_count":68,"forks_count":319,"subscribers_count":39,"default_branch":"master","last_synced_at":"2024-12-03T00:05:32.792Z","etag":null,"topics":["golang","hls","http-live-streaming","lib","library","m3u8","m3u8-playlist","manifest","parsing","playlist-generator","playlist-parser","rfc-8216"],"latest_commit_sha":null,"homepage":"http://tools.ietf.org/html/draft-pantos-http-live-streaming","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grafov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-02-05T22:26:30.000Z","updated_at":"2024-12-02T07:24:02.000Z","dependencies_parsed_at":"2023-11-09T12:39:44.763Z","dependency_job_id":"671ee481-fc1a-424a-84d9-0c43138e6dc1","html_url":"https://github.com/grafov/m3u8","commit_stats":{"total_commits":328,"total_committers":39,"mean_commits":8.41025641025641,"dds":0.3140243902439024,"last_synced_commit":"30ce19210708083787e23763efe9a5287b44e429"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafov%2Fm3u8","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafov%2Fm3u8/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafov%2Fm3u8/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafov%2Fm3u8/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grafov","download_url":"https://codeload.github.com/grafov/m3u8/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228987010,"owners_count":18002227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","hls","http-live-streaming","lib","library","m3u8","m3u8-playlist","manifest","parsing","playlist-generator","playlist-parser","rfc-8216"],"created_at":"2024-08-01T20:01:16.134Z","updated_at":"2024-12-10T01:04:48.971Z","avatar_url":"https://github.com/grafov.png","language":"Go","funding_links":[],"categories":["Video","视频","Utility","HarmonyOS","Protocols \u0026 Transport","视频`视频和流媒体相关库`","Go"],"sub_categories":["HTTP Clients","Utility/Miscellaneous","实用程序/Miscellaneous","版本控制","Windows Manager","Adaptive Streaming","版本控制`版本控制相关库`","Fail injection"],"readme":"\u003c!--*- mode:markdown -*--\u003e\nM3U8 [![](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go#video)\n====\n\nProject status\n---------------\n\nProject support suspended and code moved to read only archive.\nhttps://github.com/grafov/m3u8/issues/225\n\nAbout\n-----\n\nThis is the most complete opensource library for parsing and generating of M3U8 playlists\nused in HTTP Live Streaming (Apple HLS) for internet video translations.\n\nM3U8 is simple text format and parsing library for it must be simple too. It does not offer\nways to play HLS or handle playlists over HTTP. So library features are:\n\n* Support HLS specs up to version 5 of the protocol.\n* Parsing and generation of master-playlists and media-playlists.\n* Autodetect input streams as master or media playlists.\n* Offer structures for keeping playlists metadata.\n* Encryption keys support for use with DRM systems like [Verimatrix](http://verimatrix.com) etc.\n* Support for non standard [Google Widevine](http://www.widevine.com) tags.\n\nThe library covered by BSD 3-clause license. See [LICENSE](LICENSE) for the full text.\nVersions 0.8 and below was covered by GPL v3. License was changed from the version 0.9 and upper.\n\nSee the list of the library authors at [AUTHORS](AUTHORS) file.\n\n\nInstall\n-------\n\n\tgo get github.com/grafov/m3u8\n\nor get releases from https://github.com/grafov/m3u8/releases\n\nDocumentation [![GoDoc](https://godoc.org/github.com/grafov/m3u8?status.svg)](https://pkg.go.dev/github.com/grafov/m3u8)\n-------------\n\nPackage online documentation (examples included) available at:\n\n* http://pkg.go.dev/github.com/grafov/m3u8\n\nSupported by the HLS protocol tags and their library support explained in [M3U8 cheatsheet](M3U8.md).\n\nExamples\n--------\n\nParse playlist:\n\n```go\n\tf, err := os.Open(\"playlist.m3u8\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tp, listType, err := m3u8.DecodeFrom(bufio.NewReader(f), true)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tswitch listType {\n\tcase m3u8.MEDIA:\n\t\tmediapl := p.(*m3u8.MediaPlaylist)\n\t\tfmt.Printf(\"%+v\\n\", mediapl)\n\tcase m3u8.MASTER:\n\t\tmasterpl := p.(*m3u8.MasterPlaylist)\n\t\tfmt.Printf(\"%+v\\n\", masterpl)\n\t}\n```\n\nThen you get filled with parsed data structures. For master playlists you get ``Master`` struct with slice consists of pointers to ``Variant`` structures (which represent playlists to each bitrate).\nFor media playlist parser returns ``MediaPlaylist`` structure with slice of ``Segments``. Each segment is of ``MediaSegment`` type.\nSee ``structure.go`` or full documentation (link below).\n\nYou may use API methods to fill structures or create them manually to generate playlists. Example of media playlist generation:\n\n```go\n\tp, e := m3u8.NewMediaPlaylist(3, 10) // with window of size 3 and capacity 10\n\tif e != nil {\n\t\tpanic(fmt.Sprintf(\"Creating of media playlist failed: %s\", e))\n\t}\n\tfor i := 0; i \u003c 5; i++ {\n\t\te = p.Append(fmt.Sprintf(\"test%d.ts\", i), 6.0, \"\")\n\t\tif e != nil {\n\t\t\tpanic(fmt.Sprintf(\"Add segment #%d to a media playlist failed: %s\", i, e))\n\t\t}\n\t}\n\tfmt.Println(p.Encode().String())\n```\n\nCustom Tags\n-----------\n\nM3U8 supports parsing and writing of custom tags. You must implement both the `CustomTag` and `CustomDecoder` interface for each custom tag that may be encountered in the playlist. Look at the template files in `example/template/` for examples on parsing custom playlist and segment tags.\n\nLibrary structure\n-----------------\n\nLibrary has compact code and bundled in three files:\n\n* `structure.go` — declares all structures related to playlists and their properties\n* `reader.go` — playlist parser methods\n* `writer.go` — playlist generator methods\n\nEach file has own test suite placed in `*_test.go` accordingly.\n\nRelated links\n-------------\n\n* http://en.wikipedia.org/wiki/M3U\n* http://en.wikipedia.org/wiki/HTTP_Live_Streaming\n* http://gonze.com/playlists/playlist-format-survey.html\n\nLibrary usage\n-------------\n\nThis library was successfully used in streaming software developed for company where I worked several\nyears ago. It was tested then in generating of VOD and Live streams and parsing of Widevine Live streams.\nAlso the library used in opensource software so you may look at these apps for usage examples:\n\n* [HLS downloader](https://github.com/kz26/gohls)\n* [Another HLS downloader](https://github.com/Makombo/hlsdownloader)\n* [HLS utils](https://github.com/archsh/hls-utils)\n* [M3U8 reader](https://github.com/jeongmin/m3u8-reader)\n\nProject status [![Go Report Card](https://goreportcard.com/badge/grafov/m3u8)](https://goreportcard.com/report/grafov/m3u8)\n--------------\n\n[![Build Status](https://travis-ci.org/grafov/m3u8.png?branch=master)](https://travis-ci.org/grafov/m3u8) [![Build Status](https://cloud.drone.io/api/badges/grafov/m3u8/status.svg)](https://cloud.drone.io/grafov/m3u8) [![Coverage Status](https://coveralls.io/repos/github/grafov/m3u8/badge.svg?branch=master)](https://coveralls.io/github/grafov/m3u8?branch=master)\n\n[![DeepSource](https://static.deepsource.io/deepsource-badge-light.svg)](https://deepsource.io/gh/grafov/m3u8/?ref=repository-badge)\n\nCode coverage: https://gocover.io/github.com/grafov/m3u8\n\nProject maintainers\n--------------------\n\nThank to all people who contrubuted to the code and maintain\nit. Especially thank to the maintainers who involved in the project\nactively in the past and helped to keep code actual:\n\n* Lei Gao @leikao\n* Bradley Falzon @bradleyfalzon\n\nNew maitainers are welcome.\n\nAlternatives\n-------------\n\nOn the project start in 2013 there was no any other libs in Go for m3u8. Later the alternatives came. Some of them may be more fit current standards.\n\n* https://github.com/hr8/rosso\n\nDrop a link in issue if you know other projects.\n\nFYI M3U8 parsing/generation in other languages\n------------------------------------------\n\n* https://github.com/globocom/m3u8 in Python\n* https://github.com/zencoder/m3uzi in Ruby\n* https://github.com/Jeanvf/M3U8Paser in Objective C\n* https://github.com/tedconf/node-m3u8 in Javascript\n* http://sourceforge.net/projects/m3u8parser/ in Java\n* https://github.com/karlll/erlm3u8 in Erlang\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafov%2Fm3u8","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrafov%2Fm3u8","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafov%2Fm3u8/lists"}