DEV Community

Alan Allard for Eyevinn Video Dev-Team Blog

Posted on

Introducing hls-truncate, the new tool in our collection of VOD manipulators!

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);
});
Enter fullscreen mode Exit fullscreen mode

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.

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay