DEV Community

Oscar Nord for Eyevinn Video Dev-Team Blog

Posted on • Updated on

Locally transcode VOD content with Eyevinn Ingest Application Framework and SVT Encore

In a previous post I described how to utilise AWS MediaConvert and MediaPackage to transcode VOD content.

AWS is great for this kind of applications but if you want to be able to do the video transcoding locally an alternative to AWS MediaConvert is SVT Encore which is a open source video transcoder build on FFmpeg and Redis and is developed by Swedish Television.

The IAF Plugins

To make it a bit easier to automate the process of using SVT Encore together with AWS services like S3 and MediaPackage we here at Eyevinn have developed an IAF plugin for local video transcoding with SVT Encore that we have made available as open source.

The general idea is that it should be as easy to use this plugin together with the other IAF plugins, and to chain them together as we did with the IAF AWS MediaConvert plugin in the previous post to push local VOD content to AWS.

The plugin interacts with a local or remote instance of Encore via Encore's API/endpoints which makes it easy to expand upon in the future.

IAF plugins and AWS diagram

The quickest way to get a local instance of Encore up and running:

  1. Clone Encore and follow the install instructions.
  2. Navigate to encore/src copy the profile folder from encore/src/test/resource to encore/src/main/resource.
  3. Open encore/src/main/resources/application-local.yml and update it with the content below. (We are currently only using the default profiles defined in profiles.yml to test things with)
service:
  name: encore-local

spring:
  redis:
    host: localhost
    port: 6379

profile:
  location: classpath:profile/profiles.yml

encore-settings:
  concurrency: 3
  local-temporary-encode: false
  poll-initial-delay: 1s
  poll-delay: 1s

  audio-mix-presets:
    default:
      pan-mapping:
        6:
          2: stereo|c0=1.0*c0+0.707*c2+0.707*c4|c1=1.0*c1+0.707*c2+0.707*c5
Enter fullscreen mode Exit fullscreen mode

Now run $ SPRING_PROFILES_ACTIVE=local ./gradlew clean bootRun in the Encore root folder.
You should now have a local copy of Encore running to test with.

To use the IAF Encore plugin in an IAF setup it should look something like this:

// other imports
import { EncoreUploadModule } from "@eyevinn/iaf-plugin-encore-local";

const encoreUploader = new EncoreUploadModule(/** args **/);
const fileWatcher = /** initialize your file watcher of choice**/

fileWatcher.onAdd(encoreUploader.onFileAdd);
Enter fullscreen mode Exit fullscreen mode

The IAF Encore plugin will generate a SMIL file when the transcoding job have finished.
To be able to upload this content to an S3 bucket as we did in the MediaConvert example we need another newly developed IAF plugin to upload files as they have been transcoded.

The IAF AWS S3 plugin's fileWatcher will in this case monitor the Encore output folder for files and upload these when added. The MediaPackage plugin can be injected via the fileUploadedDelegate callback function in the same way as when we chain the MediaConvert and MediaPackage plugins together.

We can now create the resource name for the SMIL-file in the S3 bucket and provide that to the IAF MediaPackage plugin

MPUploadModule.onFileAdd("arn:aws:s3:::AWS_BUCKET/file.smil", null);
Enter fullscreen mode Exit fullscreen mode

The MediaPackage plugin will if succeeded return the endpoints that we then can use to stream the content.

Conclusion

As mentioned in the Eyevinn Ingest Application Framework articles previously the IAF is still a work in progress and we encourage readers to keep an eye on the website for changes and news. We hope that the IAF will be able to help developers build their own ingest applications faster, and remove some of the complexity from the process.

If you need assistance in the development and implementation of this, our team of video developers are happy to help you out. If you have any questions or comments just drop a line in the comments section to this post.

Discussion (0)