sethdeckard / m3u8 Goto Github PK
View Code? Open in Web Editor NEWParse and generate m3u8 playlists for Apple HTTP Live Streaming (HLS) in Ruby.
Home Page: https://tools.ietf.org/html/rfc8216
License: MIT License
Parse and generate m3u8 playlists for Apple HTTP Live Streaming (HLS) in Ruby.
Home Page: https://tools.ietf.org/html/rfc8216
License: MIT License
Hello,
I've tried parsing my file
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:1582061
#EXTINF:10, no desc
#EXT-X-PROGRAM-DATE-TIME:2016-01-01T18:22:09Z
20160321T150304_2_5560256_1582061.ts
#EXTINF:10, no desc
#EXT-X-PROGRAM-DATE-TIME:2016-01-01T18:22:19Z
20160321T150304_2_5560256_1582062.ts
I get a list of TimeItem which makes sens, but how can I get the filename (.ts) ? Does this lib support this format?
thanks
If a live stream finishes, the #EXT-X-ENDLIST tag must be included in the end
See 6.2.1. General Server Responsibilities
If the Media Playlist contains the final Media Segment of the
presentation then the Playlist file MUST contain the EXT-X-ENDLIST
tag; this allows clients to minimize unproductive Playlist reloads.
Had a few minutes of head scratching when I tried calling M3u8::Playlist.read
with a path before I realized I needed an IO object. Calling read
with a path doesn't throw an error and returns a playlist regardless
irb(main):002:0> M3u8::Playlist.read("~/Desktop/long_hls")
=> #<M3u8::Playlist:0x007fb77388de20 @version=nil, @sequence=0, @cache=nil, @target=10, @type=nil, @iframes_only=false, @independent_segments=false, @items=[]>
Hi,
would you consider a PR that would add the non-standard Name
attribute to #EXT-X-STREAM-INF
?
This is used by Wowza and JWPlayer to show a quality selector option in the player (see https://support.jwplayer.com/customer/portal/articles/1430240-hls-adaptive-streaming )
Thanks
Such as the files that iTunes outputs when exporting playlists.
It's understandable (and clearly necessary) to have a library that handles HLS m3u8 files, it would just also be nice to import these other standard files.
Recently I had a use case where I was looking to convert a M3u8::Playlist
to M3u8::PlaylistItem
. I was a bit surprised it's not supported by this gem, and that PlaylistItem instances need to be built from an options hash. This doesn't seem like a rare use case, especially when working with a master playlists, parsing media playlists they contain, working with them, and building a new master playlist as a result.
Here's a short example use case I'm imagining:
my_file = File.open('spec/fixtures/media_playlist-664.m3u8')
media_playlist = M3u8::Playlist.read(my_file)
playlist_item = M3u8::PlaylistItem.new(media_playlist)
My temporary workaround for this is to dump all of a Playlist's instance variables into a hash (excluding items
, etc.) and building a new PlaylistItem from that. If there's a more intuitive way to do this that I'm missing, please let me know.
A secondary solution could be to implement a Playlist#to_options
method that returns an options hash that allows for easy creation of a PlaylistItem:
my_file = File.open('spec/fixtures/media_playlist-664.m3u8')
media_playlist = M3u8::Playlist.read(my_file)
playlist_item = M3u8::PlaylistItem.new(media_playlist.to_options)
If you are on board with the feature request, I'll be happy to write the specs and open a PR.
Thanks!
Thanks for making this library!
Is there a built-in search feature, ie. find the item with the best video resolution? Or at least a less clunky way than:
item = m3u8.items.max_by { |e| (e.respond_to?(:height) && e.height) || 0 }
Wouldn't it be simpler and better if the object returned was a symbol hash rather than an object with methods?
Line 14 in 6e2a54b
It looks like when this gets rendered it's missing the #EXT-X-PROGRAM-DATE-TIME
, only rendering the time. I'm not sure if this was an intentional design decision or a bug? It looks like it's been in there for 5 years if it is a bug, so wanted to make sure before working on a PR.
Details:
...
playlist.items << M3u8::SegmentItem.new(program_date_time: Time.now, duration: 10, segment: 'http://example.com/segment-1.aac')
....
Expected:
#EXTINF:9.770667,
#EXT-X-PROGRAM-DATE-TIME: 2020-11-25 14:27:00 -0600
http://example.com/segment-1.aac
Actual:
#EXTINF:9.770667,
2020-11-25 14:27:00 -0600
http://example.com/segment-1.aac
the latter seems to cause players to try and request "2020-11-25 14:27:00 -0600" as a fragment url.
I worked around the issue for the timebeing by passing the "#EXT-X-PROGRAM-DATE-TIME: #{Time.now}",
as the program_date_time
attribute, which feels a little clunky unless I'm missing the reasoning for it being this way. Thoughts?
Is it possible to create an mp4 file from a given playlist url?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.