Encore Callback Listener

Encore Callback Listener (serviceId eyevinn-encore-callback-listener) is an HTTP server that receives SVT Encore job callbacks and posts the job ID and output URL of successful jobs to a Redis queue. In Eyevinn Open Source Cloud (OSC) it is a long-running service instance. License: MIT.

What it can do

  • Receive progress callbacks from SVT Encore transcoding jobs.
  • On a successful job, post jobId and url to a configured Redis queue so downstream services (such as a packager) can pick up the work.
  • Act as a building block in automated encode-and-package pipelines on SVT Encore.

Creating an instance

Create the dependencies first and confirm they are running: * Valkey (valkey-io-valkey), the Redis-compatible queue. Read its address from describe-service-instance; the URL has the form redis://<host>:<port> (include the password if you set one). * SVT Encore (encore). Note the instance URL.

Optionally store the URLs as secrets with create-service-secret (serviceId eyevinn-encore-callback-listener), for example redisurl and encoreurl. Then create the instance with create-service-instance using serviceId: "eyevinn-encore-callback-listener". The name must be alphanumeric and at most 20 characters.

{
  "name": "mycallback",
  "RedisUrl": "{{secrets.redisurl}}",
  "EncoreUrl": "{{secrets.encoreurl}}",
  "RedisQueue": "packaging-queue"
}

OSC CLI form: osc create eyevinn-encore-callback-listener mycallback -o RedisUrl="redis://<IP>:<PORT>" -o EncoreUrl="https://<encore-url>" -o RedisQueue="packaging-queue".

Options

Option Required Type Meaning
name Yes string Name of the instance. Letters, digits and underscore only, at most 20 characters.
RedisUrl Yes string, sensitive URL of the Redis/Valkey server to post to, for example redis://<host>:6379 (REDIS_URL).
EncoreUrl Yes string URL of the SVT Encore instance, for example https://<encore-instance-url> (ENCORE_URL).
RedisQueue No string Name of the Redis queue to post completed jobs to (REDIS_QUEUE). Default packaging-queue.

RedisUrl is sensitive; store it as a secret and reference it as {{secrets.NAME}}, which only works as the entire field value.

Using the instance

Set the callback URL in your Encore job submissions to the listener's instance URL:

curl -X POST https://<encore-url>/encoreJobs \
  -H "Content-Type: application/json" \
  -d '{
    "profile": "program",
    "outputFolder": "s3://mybucket/output/",
    "baseName": "myjob",
    "inputs": [{"uri": "s3://mybucket/input/video.mp4", "copyTs": true}],
    "progressCallbackUri": "https://<callback-listener-url>/callbacks"
  }'

When Encore completes the job it calls back to the listener, which posts the result to the Redis queue. A downstream packaging service can read the queue:

import Redis from 'ioredis';

const redis = new Redis('redis://<IP>:<PORT>');

async function processQueue() {
  while (true) {
    const [, item] = await redis.blpop('packaging-queue', 0);
    const job = JSON.parse(item);
    console.log('Packaging job:', job.jobId, job.url);
    // trigger your packager here
  }
}

processQueue();

Resources