All Projects → sethdeckard → m3u8

sethdeckard / m3u8

Licence: MIT License
Parse and generate m3u8 playlists for Apple HTTP Live Streaming (HLS) in Ruby.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to m3u8

mock-hls-server
Fake a live/event HLS stream from a VOD one. Useful for testing. Supports looping.
Stars: ✭ 61 (-36.46%)
Mutual labels:  playlist, hls, m3u8-playlist, m3u8, http-live-streaming
HJPlayer
A HTML5 Player, can play flv and hls by Media Source Extension, based on typescript.
Stars: ✭ 149 (+55.21%)
Mutual labels:  streaming, hls, http-live-streaming
M3u8
Parser and generator of M3U8-playlists for Apple HLS. Library for Go language. 🎦
Stars: ✭ 800 (+733.33%)
Mutual labels:  parsing, hls, m3u8
IPtv
A collection of private IPtv list as well as Third-party IPtv list. (not updated anymore)
Stars: ✭ 16 (-83.33%)
Mutual labels:  playlist, m3u8-playlist, m3u8
Hls.js
HLS.js is a JavaScript library that plays HLS in browsers with support for MSE.
Stars: ✭ 10,791 (+11140.63%)
Mutual labels:  streaming, hls, http-live-streaming
aws-clustered-video-streams
A clustered video stream is an AWS architecture that increases the quality and reliability of live events by providing seamless regional failover capabilities for live video steams. Operators can monitor the status of the clustered stream from a single pane of glass and dynamically control from which region the stream consumed by a player origin…
Stars: ✭ 35 (-63.54%)
Mutual labels:  playlist, hls, playlist-parser
Ffplayout Engine
python and ffmpeg based playout
Stars: ✭ 128 (+33.33%)
Mutual labels:  playlist, streaming, hls
hls-rip
Tool for ripping m3u8 playlists/segments.
Stars: ✭ 14 (-85.42%)
Mutual labels:  playlist, hls, m3u8
m3u8-downloader
Download the ts files according to the given m3u8 file.
Stars: ✭ 21 (-78.12%)
Mutual labels:  hls, m3u8
m3u8
m3u8 file downloader library and chrome & firefox extensions/add-on's
Stars: ✭ 67 (-30.21%)
Mutual labels:  m3u8-playlist, 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 (+65.63%)
Mutual labels:  hls, m3u8
hls-segment-reader
Node.js Readable for retrieving HLS segments.
Stars: ✭ 18 (-81.25%)
Mutual labels:  hls, m3u8
hls m3u8
HLS(RFC8216) m3u8 parser/generator
Stars: ✭ 40 (-58.33%)
Mutual labels:  hls, m3u8
CBPlayer
一个内置P2P的神奇播放器
Stars: ✭ 60 (-37.5%)
Mutual labels:  hls, m3u8
spotify-vibe-check
Spotify Vibe Checker Web App to vibe check your Spotify Playlists! (currently broken due to CORS)
Stars: ✭ 24 (-75%)
Mutual labels:  playlist, playlist-parser
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 (-59.37%)
Mutual labels:  hls, m3u8
node-m3u8parse
Structural parsing of Apple HTTP Live Streaming .m3u8 format
Stars: ✭ 24 (-75%)
Mutual labels:  m3u8-playlist, m3u8
tms
tms(toy media server) is a toy media server for myself learning media develop. Just for fun.
Stars: ✭ 29 (-69.79%)
Mutual labels:  streaming, hls
hls-live-thumbnails
A service which will generate thumbnails from a live HLS stream.
Stars: ✭ 49 (-48.96%)
Mutual labels:  playlist, hls
useetv-playlist
No description or website provided.
Stars: ✭ 41 (-57.29%)
Mutual labels:  m3u8-playlist, m3u8

Gem Version Build Status Coverage Status Code Climate Dependency Status security

m3u8

m3u8 provides easy generation and parsing of m3u8 playlists defined in the HTTP Live Streaming (HLS) Internet Draft published by Apple.

  • The library completely implements version 20 of the HLS Internet Draft.
  • Provides parsing of an m3u8 playlist into an object model from any File, StringIO, or string.
  • Provides ability to write playlist to a File or StringIO or expose as string via to_s.
  • Distinction between a master and media playlist is handled automatically (single Playlist class).
  • Optionally, the library can automatically generate the audio/video codecs string used in the CODEC attribute based on specified H.264, AAC, or MP3 options (such as Profile/Level).

Installation

Add this line to your application's Gemfile:

gem 'm3u8'

And then execute:

$ bundle

Or install it yourself as:

$ gem install m3u8

Usage (creating playlists)

Create a master playlist and add child playlists for adaptive bitrate streaming:

require 'm3u8'
playlist = M3u8::Playlist.new

Create a new playlist item with options:

options = { width: 1920, height: 1080, profile: 'high', level: 4.1,
            audio_codec: 'aac-lc', bandwidth: 540, uri: 'test.url' }
item = M3u8::PlaylistItem.new(options)
playlist.items << item

Add alternate audio, camera angles, closed captions and subtitles by creating MediaItem instances and adding them to the Playlist:

hash = { type: 'AUDIO', group_id: 'audio-lo', language: 'fre',
         assoc_language: 'spoken', name: 'Francais', autoselect: true,
         default: false, forced: true, uri: 'frelo/prog_index.m3u8' }
item = M3u8::MediaItem.new(hash)
playlist.items << item

Create a standard playlist and add MPEG-TS segments via SegmentItem. You can also specify options for this type of playlist, however these options are ignored if playlist becomes a master playlist (anything but segments added):

options = { version: 1, cache: false, target: 12, sequence: 1 }
playlist = M3u8::Playlist.new(options)

item = M3u8::SegmentItem.new(duration: 11, segment: 'test.ts')
playlist.items << item

You can pass an IO object to the write method:

require 'tempfile'
file = Tempfile.new('test')
playlist.write(file)

You can also access the playlist as a string:

playlist.to_s

M3u8::Writer is the class that handles generating the playlist output.

Alternatively you can set codecs rather than having it generated automatically:

options = { width: 1920, height: 1080, codecs: 'avc1.66.30,mp4a.40.2',
            bandwidth: 540, uri: 'test.url' }
item = M3u8::PlaylistItem.new(options)

Usage (parsing playlists)

file = File.open 'spec/fixtures/master.m3u8'
playlist = M3u8::Playlist.read(file)
playlist.master?
# => true

Access items in playlist:

playlist.items.first
#  => #<M3u8::PlaylistItem:0x007fa569bc7698 @program_id="1", @resolution="1920x1080", 
#  @codecs="avc1.640028,mp4a.40.2", @bandwidth="5042000", 
#  @playlist="hls/1080-7mbps/1080-7mbps.m3u8">

Create a new playlist item with options:

options = { width: 1920, height: 1080, profile: 'high', level: 4.1,
            audio_codec: 'aac-lc', bandwidth: 540, uri: 'test.url' }
item = M3u8::PlaylistItem.new(options)
#add it to the top of the playlist
playlist.items.unshift(item)

M3u8::Reader is the class handles parsing if you want more control over the process.

Usage (misc)

Generate the codec string based on audio and video codec options without dealing a playlist instance:

options = { profile: 'baseline', level: 3.0, audio_codec: 'aac-lc' }
codecs = M3u8::Playlist.codecs(options)
# => "avc1.66.30,mp4a.40.2"
  • Values for audio_codec (codec name): aac-lc, he-aac, mp3
  • Values for profile (H.264 Profile): baseline, main, high.
  • Values for level (H.264 Level): 3.0, 3.1, 4.0, 4.1.

Not all Levels and Profiles can be combined and validation is not currently implemented, consult H.264 documentation for further details.

Roadmap

  • Implement validation of all tags, attributes, and values per HLS I-D.
  • Perhaps support for different versions of HLS I-D, defaulting to latest.

Contributing

  1. Fork it ( https://github.com/sethdeckard/m3u8/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Run the specs, make sure they pass and that new features are covered. Code coverage should be 100%.
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request

License

MIT License - See LICENSE.txt for details.

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