Service: Shaka Packager - EyevinnOSC/community GitHub Wiki

Shaka Packager

Shaka Packager (serviceId eyevinn-shaka-packager-s3, license MIT) creates a streaming package (HLS and DASH) from an ABR bundle stored on S3 and uploads the result to another bucket or folder. In Eyevinn Open Source Cloud (OSC) it is a job service: each instance runs the packaging once and then finishes. It is VOD only: it processes pre-encoded files from S3 input and has no live ingest.

What it can do

  • Package pre-encoded ABR renditions (audio and video MP4 files) into HLS and DASH for CDN origin delivery.
  • Read from and write to S3-compatible storage such as MinIO using an endpoint URL.
  • Accept Shaka Packager CLI options (--dash-only, --hls-only, --segment-duration, --segment-single-file, --ts-output and others) through cmdLineArgs.

Creating an instance

Prerequisite: an ABR bundle on a storage bucket. It can be created with SVT Encore and stored in MinIO (minio-minio). Store the MinIO user name and password as service secrets with create-service-secret (serviceId eyevinn-shaka-packager-s3), for example accesskeyid and secretkey. See How to work with secrets.

Call create-service-instance with serviceId: "eyevinn-shaka-packager-s3":

{
  "name": "guide",
  "cmdLineArgs": "-s s3://output/tutorial -d s3://output/tutorial/vod/ -i a:audio=tutorial_STEREO.mp4 -i v:324=tutorial_x264_324.mp4 -i v:806=tutorial_x264_806.mp4 -i v:1312=tutorial_x264_1312.mp4 -i v:2069=tutorial_x264_2069.mp4 -i v:3100=tutorial_x264_3100.mp4",
  "awsAccessKeyId": "{{secrets.accesskeyid}}",
  "awsSecretAccessKey": "{{secrets.secretkey}}",
  "s3EndpointUrl": "<minio-endpoint-url>"
}

The cmdLineArgs in this example:

  • -s: source folder URL
  • -d: destination folder URL
  • -i: input in the form [a|v|t]:<key>=<filename>[:hlsName]

Check the job with get-instance-status and get-logs-for-instance. The result can be listed with the AWS CLI, for example aws s3 --endpoint-url=<minio-endpoint-url> ls s3://output/tutorial/vod/, which shows index.m3u8, manifest.mpd, per-rendition playlists and audio/, video-<bitrate>/ folders.

Equivalent OSC CLI usage:

% npx -y @osaas/cli create eyevinn-shaka-packager-s3 guide \
  -o cmdLineArgs="-s s3://output/tutorial -d s3://output/tutorial/vod/ -i a:audio=tutorial_STEREO.mp4 -i v:324=tutorial_x264_324.mp4" \
  -o awsAccessKeyId="{{secrets.accesskeyid}}" \
  -o awsSecretAccessKey="{{secrets.secretkey}}" \
  -o s3EndpointUrl="<minio-endpoint-url>"

Options

Option Required Type Meaning
name Yes string Name of the job. Letters, digits and underscore (^\w+$); OSC limits names to 20 characters.
cmdLineArgs Yes string Command line arguments for the packager, as in the upstream CLI: -s/--source-folder, -i/--input, -d/--destination-folder, --dash-only, --hls-only, --segment-single-file, --segment-duration, --ts-output and others. At least input and destination are needed. Example: -s s3://source-bucket/folder -d s3://output-bucket/folder -i a:1=audio.mp4 -i v:1=video.mp4. See the shaka-packager-s3 repository for the full list.
awsAccessKeyId No string, sensitive Access key ID (env AWS_ACCESS_KEY_ID). Needed when S3 is used as input or output; for OSC MinIO it is the MinIO user name.
awsSecretAccessKey No string, sensitive Secret access key (env AWS_SECRET_ACCESS_KEY). Needed when S3 is used as input or output; for OSC MinIO it is the MinIO password.
s3EndpointUrl No string S3 endpoint URL (CLI --endpoint-url, env S3_ENDPOINT_URL), used for S3-compatible storage other than AWS S3, for example a MinIO instance URL. Associated with minio-minio.

Pass the credentials as {{secrets.NAME}}, which must be the entire field value.

Using the instance

Play the result

To verify the package, give <minio-endpoint-url>/output/tutorial/vod/index.m3u8 to a streaming video player such as the Eyevinn web player. The folder must be publicly readable and CORS must allow the player's origin. With the MinIO client:

% mc anonymous set download encore/output/tutorial/vod/
% mc admin config set encore/output api cors_allow_origin="*"

Playing the packaged stream in a web player

Limitations

  • VOD only; no live ingest.
  • If you get 403 Forbidden accessing the package, check that public access is allowed on the folder where the package was written.

Resources

⚠️ **GitHub.com Fallback** ⚠️