Open Source Newsletter #003

Eyevinn Technology
3 min readJan 18, 2022

--

In the monthly Eyevinn Open Source Newsletter we present the latest updates and additions to our libraries, tools and components that we have made available as open source.

HLS Pull / Push Library

This is a NodeJs library based on the HLS Recorder Library to pull HLS from a source and push to another origin. One use case is to pull the HLS from a VOD2Live engine and push to a just-in-time origin packager such as AWS MediaPackage. It is a modular library where support for different outputs will be added on demand. Up next is an output plugin for using AWS S3 storage as destination. Contributions by adding new output plugins are welcome.

One use case and how to use this library is described in this blog post on our developer blog, and how to connect our Channel Engine (VOD2Live) with AWS MediaPackage based on this library is described here.

Container to push an RTSP stream as HLS to AWS MediaPackage

The rtsphls container is a Docker container that takes an RTSP video feed, transcode to HLS and push to AWS MediaPackage origin (optional). It is a container based on ffmpeg and the HLS pull push library described above. One use case is to take the feed from a relatively cheap home security wifi camera and push HLS to AWS MediaPackage origin for Internet distribution.

Simply run the following command to start the container:

docker run --rm -e RTSP=rtsp://<username>:<password>@10.0.0.10/stream1 \ 
-e MEDIAPACKAGE_URL=<ingesturl> \
-e MEDIAPACKAGE_USERNAME=<username> \
-e MEDIAPACKAGE_PASSWORD=<password> \
-p 8000:8000 eyevinntechnology/rtsphls

Tiny MSE video and audio DRM detection library

The is-drm-supported library is a tiny MSE video and audio DRM detection library. It is used for example to determine what DRM a web browser supports.

import { isFairplaySupported } from "@eyevinn/is-drm-supported";

const isSupported = await isFairplaySupported();

Library to concatenate a list of VODs

Node library to concatenate a list of HLS VODs into a new HLS VOD. With this library you can build a service that uses HLS manifest manipulation to create an HLS VOD from a sequence of HLS VODs. For example:

import { HLSVod, IPlaylistEntry } from "@eyevinn/hls-vodtovod";const bw = event.queryStringParameters.bw;
const encodedMrssUri = event.queryStringParameters.mrss;
const playlist: IPlaylistEntry[] = await createPlaylistFromMRSS(new URL(decodeURIComponent(encodedMrssUri)));
const hlsVod = new HLSVod(playlist);
await hlsVod.load();
return generateManifestResponse(hlsVod.getVariant(bw).toString());

Library to append query params on segment URLs

Node library to append query params on each media segment URL in a media playlist. One use case for this library is when providing a service to intercept an HLS manifest and media playlist request and update it with signed URLs as described in this developer blog post.

const { HLSMultiVariant, HLSMediaPlaylist } = require("@eyevinn/hls-query");
const params = new URLSearchParams({ token: "TOKEN" });
const multiVariant = new HLSMultiVariant({
url: new URL("https://lab.cdn.eyevinn.technology/sto-slate.mp4/manifest.m3u8")
}, params);
await multiVariant.fetch();

const mediaPlaylist = new HLSMediaPlaylist({ url: multiVariant.streamURLs[0] }, params);
// multiVariant.streamURLs[0].href === "https://lab.cdn.eyevinn.technology/sto-slate.mp4/manifest_1.m3u8?token=TOKEN"
await mediaPlaylist.fetch();

console.log(mediaPlaylist.toString());
// #EXTM3U
// #EXT-X-VERSION:3
// #EXT-X-TARGETDURATION:10
// #EXT-X-MEDIA-SEQUENCE:1
// #EXT-X-PLAYLIST-TYPE:VOD
// #EXTINF:10.0000,
// manifest_1_00001.ts?token=TOKEN
// #EXT-X-ENDLIST

Lambda helper classes

This library contains helper classes when developing AWS Lambda functions. For example to setup a local endpoint to emulate ELB triggered events.

const { LambdaELB } = require("@eyevinn/dev-lambda");

const handler = async (event) => {
console.log(event);
return { statusCode: 204 };
}

(new LambdaELB({ handler })).run();

Eyevinn Technology is leading specialists in video technology and media distribution, and proud organizer of the yearly nordic conference Streaming Tech Sweden.

--

--

Eyevinn Technology
Eyevinn Technology

Written by Eyevinn Technology

We are consultants sharing the passion for the technology for a media consumer of the future.

No responses yet