Over the last year or so, we at Eyevinn Technology have been developing a series of tools for the manipulation of HLS files. There is an increasing interest for presenting VOD content as live channels. That approach makes it possible for companies to provide themed channels and fixed schedules based on existing video material. Among other things, this can be a way to make use of older content in new packaging that interests consumers.
We have built several open source tools to provide every aspect of delivering a livestream from pre-existing content. As we develop these tools further, we often see that a need arises for convenient helper utilities. A previous example was hls-repeat which takes a HLS VOD as an input and outputs a new VOD that is repeated the required number of times. This can be useful when working dynamically with slates, for example, for display during schedule gaps. Another example, hls-splice is discussed in one of our previous articles.
Last week we released hls-truncate, a similar tool which also takes a HLS VOD as an input. In this case, it shortens the VOD in question to the nearest segment, providing that as the output. Again, this has proven to be useful for adjusting slate lengths on-the-fly for customers.
Wherever one wishes to use a VOD, it's as simple as making a call to create the new VOD:
const hlsVod = new HLSTruncateVod('http://testcontent.eyevinn.technology/slates/30seconds/playlist.m3u8', 4);
hlsVod.load()
.then(() => {
const mediaManifest = hlsVod.getMediaManifest(3496000);
console.log(mediaManifest);
});
Now all bandwidths are available at the truncated length. This all simplifies a code base considerably and has the added advantage of you knowing that a number of fiddly edge cases are taken care of and backed up by a good suite of tests, that can be developed in isolation over time.
Read more on our repo
Release 0.1.0 is up on npm now: @eyevinn/hls-truncate
If you need assistance in the development and implementation of this, our team of video developers are happy to help out. If you have any questions or comments just drop us a line in the comments section to this post.
Top comments (0)