Connecting Eyevinn Channel Engine with AWS MediaPackage

Eyevinn Technology
6 min readDec 16, 2021

--

Our open sourced VOD2Live channel engine can be connected to an AWS MediaPackage channel and we can utilize some of the just-in-time video packaging features that AWS MediaPackage offers.

A screenshot of the vod2live demo page
Using AWS MediaPackage to provide CMAF output and DVR window for timeshifted viewing

This VOD2Live Channel Engine is limited to only provide Apple HLS output and does not offer DRM encryption, DVR window or HLS with CMAF chunks. We can overcome these limitations by connecting an VOD2Live Channel Engine output to AWS MediaPackage. AWS MediaPackage is a just-in-time video packaging and origination service that runs in the Amazon Web Services cloud. Example of use cases we can solve are:

  • Giving the viewer the ability to pause the VOD2Live stream and continue watching from that point in time.
  • Giving the viewer the ability to start to watch the VOD2Live stream from a point in time earlier than “now” (time shifted).
  • The VOD2Live stream can be encrypted and protected with DRM.
  • Compatibility with the latest streaming formats such as Apple HLS with CMAF media segments.

The use cases to be able to pause and time shifted viewing have become more relevant now where we can mix in a “true” live event in a VOD2Live channel.

VOD2Live Channel Engine

Before we continue let us recap what the VOD2Live Channel Engine does. The VOD2Live Channel Engine uses HLS manifest manipulation to provide a pseudo live linear HLS stream from a library of already transcoded and HLS packaged content available on a CDN. One of the benefits is that the already transcoded programs does not have to pass through a live transcoder again. That gives us the possibility to provide a linear channel with higher quality as the VOD transcoding process is not real-time dependent in the same way as live transcoding is. Another benefit is that as no video transcoding is necessary to produce a channel the resources utilization is extremely low compared to a real-time transcoded linear stream. Which can be considered a waste when replaying non-live program. As the resource utilization is this low you can create hundreds of channels to the equivalent of one real-time transcoded channel. This opens up the possibility to create very niched channels or even channels on a per-user basis. A channel tailored to each individual viewer’s preference.

Connecting the Channel Engine with AWS MediaPackage

The Channel Engine is an origin service which means that a video player, either directly or through a CDN, pulls the HLS content from the Channel Engine service. To get HLS content uploaded to an AWS MediaPackage you would push the HLS content to one (or both) of the ingest endpoints the AWS MediaPackage channel provides. As the Channel Engine is an origin service it does not offers the functionality to push the content to another origin such as the AWS MediaPackage origin. This is intentional as the Channel Engine service is designed to not only handle static channels but also session based channels. A session based channel is where a channel is created on request.

To connect these two origin services we have developed and open sourced another service. This service can fetch (pull) HLS from one source and upload (push) it to another origin. It is a service component that is modular where different type of outputs can be supported by developing output plugins. It currently has an output plugin that works with AWS MediaPackage but we intend to support other origins in the future. We also welcome contributions here in the form of output plugins.

const pullPushService = new HLSPullPush();const outputPlugin = new MediaPackageOutput();
pullPushService.registerPlugin("mediapackage", outputPlugin);
pullPushService.listen(process.env.PORT || 8080);

The Pull/Push service provides an API to control the “fetchers” running. You can also programmatically create and start a fetcher.

const outputDest = outputPlugin.createOutputDestination({
ingestUrls: [ {
url: <MEDIAPACKAGE_INGEST_URL>,
username: <MEDIAPACKAGE_USERNAME>,
password: <MEDIAPACKAGE_PASSWORD>,
}]
}, pullPushService.getLogger());
const source = new URL("https://demo.vc.eyevinn.technology/channels/demo/master.m3u8");const sessionId = pullPushService.startFetcher({
name: "demo",
url: source.href,
destPlugin: outputDest,
destPluginName: "mediapackage"
});
outputDest.attachSessionId(sessionId);

The above snippet will pull HLS from the VOD2Live channel https://demo.vc.eyevinn.technology/channels/demo/master.m3u8 and push to an AWS MediaPackage channel. Ingest URL and credentials are available in the AWS MediaPackage console.

Now once you have HLS pushing to AWS MediaPackage you can configure different outputs. Create an output / endpoint for HLS and specify a startover window for the DVR functionality.

You can also configure the output to include an I-frame only stream that is useful when trick playing or scrubbing. When the VOD2Live channel has ad markers you probably want to pass through to for example to use with an SSAI service.

The endpoints are now available for playback.

For example you can try the HLS with DVR window here:

Demo Architecture

The system architecture for this demo can be illustrated by the diagram below.

  • Schedule Service is based on the open sourced Eyevinn Schedule Service with one module that automatically creates channel schedules based of the contents of an MRSS.
  • MRSS Generator is a Lambda function that reads from a Dynamo DB database containing the test content we have uploaded. This DB is updated by our test content uploader (not in the diagram).
  • Demo Channel Engine is based on the mentioned VOD2Live Channel Engine and uses a schedule adapter built for the Schedule Service. It provides the VOD2Live channel HLS endpoint.
  • The MRSS Generator can provide two types of MRSS feeds. One where house ads are included in the HLS VOD. To provide HLS VOD with the house ads inserted, another Lambda function, HLS Stitch, is being used.
  • The HLS Pull Push service fetches HLS from the Channel Engine and pushes to AWS MediaPackage using the MediaPackage output plugin.
  • AWS MediaPackage then provides HLS endpoints with the DVR functionality and AWS MediaTailor to replace the house ads in the stream with just-in-time decided ads. Ad requests for MediaTailor are provided by our test adserver.

Conclusion

To conclude the benefits of using this solution is that you can offer your viewers a linear TV channel with higher quality by using a transcoding without realtime constraints, channel is protected with DRM and the viewer can pause and watch the channel in a timeshift mode.

All of the components in the architecture above that is not provided by AWS is available under open source. We would be super-happy if you would drop us a line if you are using one of them!

--

--

Eyevinn Technology

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