Service: FFmpeg - EyevinnOSC/community GitHub Wiki

FFmpeg

FFmpeg is the open source tool for processing video and audio. On Eyevinn Open Source Cloud (OSC) the eyevinn-ffmpeg-s3 service (source, serviceId eyevinn-ffmpeg-s3, https://app.osaas.io/dashboard/service/eyevinn-ffmpeg-s3) runs an FFmpeg command as a job: it runs once and exits. Both input and output can be S3 URLs. License: MIT.

What it can do

  • Cut, crop, repackage (for example HLS to MP4) and convert media (for example video to animated GIF) without hosting your own infrastructure.
  • Read input from S3 (s3://bucket/key) or from an HTTP URL, and write the output directly to an S3-compatible bucket.
  • Work with any S3-compatible storage such as MinIO on OSC, using s3EndpointUrl.

Creating an instance

Create a storage bucket first, for example with the MinIO service (minio-minio), and wait until it is running. Store the storage access credentials as secrets with create-service-secret (serviceId eyevinn-ffmpeg-s3), for example accesskeyid and secretaccesskey (see Working with Secrets). Then call create-service-instance with serviceId: "eyevinn-ffmpeg-s3":

{
  "name": "example1",
  "awsAccessKeyId": "{{secrets.accesskeyid}}",
  "awsSecretAccessKey": "{{secrets.secretaccesskey}}",
  "s3EndpointUrl": "https://<tenant>-<minio-instance>.minio-minio.auto.prod-se.osaas.io",
  "cmdLineArgs": "-i s3://input/VINN.mp4 -ss 0 -t 30 -c:v copy -c:a copy s3://output/example1/trailer-30sec.mov"
}

The job runs the command and ends. Check state with get-instance-status and read FFmpeg's output with get-logs-for-instance. Verify the result in the bucket (for example with the MinIO client).

Options

Option Required Type Meaning
name Yes string Name of the job. Letters, digits and underscore only (^\w+$), at most 20 characters.
cmdLineArgs Yes string FFmpeg command line arguments including input and output, for example -i s3://input/VINN.mp4 -c:v copy -c:a copy s3://output/demo/trailer.mov. S3 URLs are supported for both source and destination.
awsAccessKeyId No string, sensitive Access key id for S3 operations. Needed when using S3 URLs for input or output.
awsSecretAccessKey No string, sensitive Secret access key for S3 operations. Needed when using S3 URLs.
awsSessionToken No string, sensitive Session token for temporary credentials (IAM roles or STS).
awsRegion No string Region of the S3 buckets.
s3EndpointUrl No string Endpoint URL of an S3-compatible service other than AWS, such as MinIO. Associated with the minio-minio service (internal routing).

Store the sensitive options as service secrets and pass them as {{secrets.NAME}} (whole field value only).

Using the instance

The examples use the OSC CLI; set your personal access token in OSC_ACCESS_TOKEN first (see Finding Your API Token). The same options can be passed in the config object of create-service-instance.

Extract first 30 seconds of a video

% npx -y @osaas/cli create eyevinn-ffmpeg-s3 example1 \
  -o awsAccessKeyId="{{secrets.accesskeyid}}" \
  -o awsSecretAccessKey="{{secrets.secretaccesskey}}" \
  -o s3EndpointUrl="https://eyevinnlab-birme.minio-minio.auto.prod-se.osaas.io" \
  -o cmdLineArgs="-i s3://input/VINN.mp4 -ss 0 -t 30 -c:v copy -c:a copy s3://output/example1/trailer-30sec.mov"

The source file is on the bucket called input on the MinIO instance with the address https://eyevinnlab-birme.minio-minio.auto.prod-se.osaas.io. The output is stored in the bucket called output on the same MinIO instance.

Once completed the 30 first seconds of the file VINN.mp4 is available in the bucket and folder as specified. Here verified using the MinIO client.

% mc ls birme/output/example1/
[2025-06-29 15:45:44 CEST] 7.6MiB STANDARD trailer-30sec.mov

Repackage the content from HLS to a MP4 container

This example downloads an HLS package and repackage that into one MP4 video file.

% npx -y @osaas/cli create eyevinn-ffmpeg-s3 example2 \
  -o awsAccessKeyId="{{secrets.accesskeyid}}" \
  -o awsSecretAccessKey="{{secrets.secretaccesskey}}" \
  -o s3EndpointUrl="https://eyevinnlab-birme.minio-minio.auto.prod-se.osaas.io" \
  -o cmdLineArgs="-i https://vod.demo.osaas.io/osc-reel-9dd16/index.m3u8 -c:v copy -c:a copy s3://output/example2/osc-reel.mp4"

And let us verify the output, again with the MinIO client.

% mc ls birme/output/example2/
[2025-06-29 15:50:59 CEST]  24MiB STANDARD osc-reel.mp4

Crop a video

Here's an example command cropping a video to a width of 640 pixels, a height of 640 pixels, and starting the crop from coordinates 900 pixels across and 50 pixels down:

% npx -y @osaas/cli create eyevinn-ffmpeg-s3 example3 \
  -o awsAccessKeyId="{{secrets.accesskeyid}}" \
  -o awsSecretAccessKey="{{secrets.secretaccesskey}}" \
  -o s3EndpointUrl="https://eyevinnlab-birme.minio-minio.auto.prod-se.osaas.io" \
  -o cmdLineArgs="-i https://vod.demo.osaas.io/osc-reel-9dd16/index.m3u8 -filter:v "crop=640:640:900:50" s3://output/example3/osc-reel-cropped.mp4"

Convert video to GIF

In this example we convert the OSC reel to an animated GIF.

% npx -y @osaas/cli create eyevinn-ffmpeg-s3 example4 \
  -o awsAccessKeyId="{{secrets.accesskeyid}}" \
  -o awsSecretAccessKey="{{secrets.secretaccesskey}}" \
  -o s3EndpointUrl="https://eyevinnlab-birme.minio-minio.auto.prod-se.osaas.io" \
  -o cmdLineArgs="-i https://vod.demo.osaas.io/osc-reel-9dd16/index.m3u8 -vf "fps=10,scale=320:-1:flags=lanczos" -c:v gif  s3://output/example4/osc-reel.gif"

Limitations

  • Referring to a secret that does not exist gives no immediate feedback; make sure every {{secrets.NAME}} reference exists before creating the job.

Resources

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