Skip to content

A m3u8 Parser for HTTP Live Streaming (HLS) stream written in Go

License

Notifications You must be signed in to change notification settings

globocom/go-m3u8

Repository files navigation

go-m3u8

Work in Progress!

There isn't a stable version for now. As this is currently a WIP, the API may have changes.

go-m3u8

Parser for m3u8 to facilitate manifest manipulation.

We currently only support Live Streaming manifests.

1. Doubly Linked List

The m3u8 is represented by a doubly linked list. This data structure allows us to access the manifest in a sorted manner and apply operations (modify, add, remove) to its content.

Examples of Useful Operations

  • Add discontinuity tag for SSAI segments manipulation
  • Change discontinuity sequence tag count
  • Remove DRM for SSAI segments manipulation by adding the tag #EXT-X-KEY:METHOD=NONE
  • Add SGAI at DateRange tags
  • Remove packager comment lines

2. Tags

To guarantee scalibility, our lib considers a data structure for the HLS elements that follows the RFC documentation.

The tags package separates HLS elements into sub-packages according to the Playlist Tags section on the RFC.

(The tags listed below are the ones currently supported by the lib.)

  1. basic - Basic Tags (Section 4.4.1).
  • #EXTM3U
  • #EXT-X-VERSION
  1. exclusive - Media or Multivariant Playlist Tags (Section 4.4.2).
  • #EXT-X-INDEPENDENT-SEGMENTS
  1. media - Media Playlist, Metada and Segment Tags (Sections 4.4.3 to 4.4.5).
  • #EXT-X-DATERANGE
  1. multivariant - Multivariant Playlist Tags (Section 4.4.6).
  • #EXT-X-TARGETDURATION
  • #EXT-X-MEDIA-SEQUENCE
  • #EXTINF
  • #EXT-X-DISCONTINUITY
  • #EXT-X-PROGRAM-DATE-TIME
  1. others - The tags in this section are "non-official" and are not listed in the RFC, e.g. tags added to the manifest by the packaging service.
  • #EXT-X-CUE-OUT
  • #EXT-X-CUE-IN
  • In-manifest comments (begin with # and are NOT tags).

Getting started

go install github.com/globocom/go-m3u8