All Projects → grafov → M3u8

grafov / M3u8

Licence: bsd-3-clause
Parser and generator of M3U8-playlists for Apple HLS. Library for Go language. 🎦

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to M3u8

m3u8
Parse and generate m3u8 playlists for Apple HTTP Live Streaming (HLS) in Ruby.
Stars: ✭ 96 (-88%)
Mutual labels:  parsing, hls, m3u8
hls m3u8
HLS(RFC8216) m3u8 parser/generator
Stars: ✭ 40 (-95%)
Mutual labels:  hls, m3u8
p2p-cdn-sdk-android
Free p2p cdn android github sdk to reduce video streaming costs of live and on demand video using webrtc by upto 90% and improve scalability by 6x - 🚀 Vadootv 🚀
Stars: ✭ 39 (-95.12%)
Mutual labels:  hls, m3u8
JT1078Gateway
基于Pipeline实现的JT1078Gateway支持TCP/UDP,目前只支持http-flv、ws-flv、hls三种拉流方式
Stars: ✭ 50 (-93.75%)
Mutual labels:  hls, m3u8
hls-segment-reader
Node.js Readable for retrieving HLS segments.
Stars: ✭ 18 (-97.75%)
Mutual labels:  hls, m3u8
m3u8-downloader
Download the ts files according to the given m3u8 file.
Stars: ✭ 21 (-97.37%)
Mutual labels:  hls, m3u8
cordova-plugin-tencent-liteav
A cordova plugin for video playing with Tencent's LiteAV SDK. Support RTMP/HLS/FLV/MP4.
Stars: ✭ 24 (-97%)
Mutual labels:  hls, m3u8
Android-hls
最近公司产品需要,调研hls(m3u8) aes-128 解密播放 . 分析 51Cto, 慕课
Stars: ✭ 73 (-90.87%)
Mutual labels:  hls, m3u8
Libmqtt
MQTT v3.1.1/5.0 library in Go
Stars: ✭ 290 (-63.75%)
Mutual labels:  library, lib
Hlsdl
C program to download VoD HLS (.m3u8) files
Stars: ✭ 361 (-54.87%)
Mutual labels:  m3u8, hls
M3u8 Downloader
M3U8-Downloader 支持多线程、断点续传、加密视频下载缓存。
Stars: ✭ 369 (-53.87%)
Mutual labels:  m3u8, hls
CBPlayer
一个内置P2P的神奇播放器
Stars: ✭ 60 (-92.5%)
Mutual labels:  hls, m3u8
hls-rip
Tool for ripping m3u8 playlists/segments.
Stars: ✭ 14 (-98.25%)
Mutual labels:  hls, m3u8
smart rtmpd
RTMP server, smart, compact, high performance(c, c++), high concurrency, easy to maintain, easy to deploy, (supports multiple operating systems Windows and Linux, ARM, FreeBSD)
Stars: ✭ 159 (-80.12%)
Mutual labels:  hls, m3u8
mock-hls-server
Fake a live/event HLS stream from a VOD one. Useful for testing. Supports looping.
Stars: ✭ 61 (-92.37%)
Mutual labels:  hls, m3u8
Android Hot Libraries
收集总结 Android 项目中值得推荐的优秀开源项目
Stars: ✭ 755 (-5.62%)
Mutual labels:  library, lib
M3u8
A mini M3U8 downloader written in Golang for downloading and merging TS(Transport Stream) files. 一个迷你 M3U8 视频下载工具。
Stars: ✭ 215 (-73.12%)
Mutual labels:  m3u8, hls
hls-downloader
Download all video files from HLS (HTTP Live Streaming) VoD (Video on Demand) m3u8 playlist for local playback
Stars: ✭ 121 (-84.87%)
Mutual labels:  hls, m3u8
SharpGrabber
Download from YouTube, Vimeo, PornHub, HLS (M3U8 files) with .NET and JavaScript, Library and desktop app for downloading high quality media
Stars: ✭ 138 (-82.75%)
Mutual labels:  hls, m3u8
Lal
🔥 Golang live stream lib/client/server. support RTMP/RTSP/HLS/HTTP[S]-FLV/HTTP-TS, H264/H265/AAC, relay, cluster, record, HTTP API/Notify, GOP cache. 官方文档见 https://pengrl.com/lal
Stars: ✭ 480 (-40%)
Mutual labels:  m3u8, hls

M3U8

This is the most complete opensource library for parsing and generating of M3U8 playlists used in HTTP Live Streaming (Apple HLS) for internet video translations.

M3U8 is simple text format and parsing library for it must be simple too. It does not offer ways to play HLS or handle playlists over HTTP. So library features are:

  • Support HLS specs up to version 5 of the protocol.
  • Parsing and generation of master-playlists and media-playlists.
  • Autodetect input streams as master or media playlists.
  • Offer structures for keeping playlists metadata.
  • Encryption keys support for use with DRM systems like Verimatrix etc.
  • Support for non standard Google Widevine tags.

The library covered by BSD 3-clause license. See LICENSE for the full text. Versions 0.8 and below was covered by GPL v3. License was changed from the version 0.9 and upper.

See the list of the library authors at AUTHORS file.

Install

go get github.com/grafov/m3u8

or get releases from https://github.com/grafov/m3u8/releases

Documentation Go Walker GoDoc

Package online documentation (examples included) available at:

Supported by the HLS protocol tags and their library support explained in M3U8 cheatsheet.

Examples

Parse playlist:

	f, err := os.Open("playlist.m3u8")
	if err != nil {
		panic(err)
	}
	p, listType, err := m3u8.DecodeFrom(bufio.NewReader(f), true)
	if err != nil {
		panic(err)
	}
	switch listType {
	case m3u8.MEDIA:
		mediapl := p.(*m3u8.MediaPlaylist)
		fmt.Printf("%+v\n", mediapl)
	case m3u8.MASTER:
		masterpl := p.(*m3u8.MasterPlaylist)
		fmt.Printf("%+v\n", masterpl)
	}

Then 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). For media playlist parser returns MediaPlaylist structure with slice of Segments. Each segment is of MediaSegment type. See structure.go or full documentation (link below).

You may use API methods to fill structures or create them manually to generate playlists. Example of media playlist generation:

	p, e := m3u8.NewMediaPlaylist(3, 10) // with window of size 3 and capacity 10
	if e != nil {
		panic(fmt.Sprintf("Creating of media playlist failed: %s", e))
	}
	for i := 0; i < 5; i++ {
		e = p.Append(fmt.Sprintf("test%d.ts", i), 6.0, "")
		if e != nil {
			panic(fmt.Sprintf("Add segment #%d to a media playlist failed: %s", i, e))
		}
	}
	fmt.Println(p.Encode().String())

Custom Tags

M3U8 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.

Library structure

Library has compact code and bundled in three files:

  • structure.go — declares all structures related to playlists and their properties
  • reader.go — playlist parser methods
  • writer.go — playlist generator methods

Each file has own test suite placed in *_test.go accordingly.

Related links

Library usage

This library was successfully used in streaming software developed for company where I worked several years ago. It was tested then in generating of VOD and Live streams and parsing of Widevine Live streams. Also the library used in opensource software so you may look at these apps for usage examples:

Project status Go Report Card

Build Status Build Status Coverage Status

DeepSource

Code coverage: https://gocover.io/github.com/grafov/m3u8

Project maintainers:

Roadmap

To version 1.0:

  • Support all M3U8 tags up to latest version of specs.
  • Code coverage by unit tests up to 90%

FYI M3U8 parsing/generation in other languages

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].