Getting Started

Trim Media is a media processing function that cuts video files to a specific time range. It reads a source video from an S3-compatible bucket, applies the trim operation using FFmpeg, and writes the output back to S3. It is built as an on-demand API service — you send a request with the source URL and trim parameters and the service returns the result or a link to the output file.

Trim Media is part of the Eyevinn media functions family alongside Scene Detect and other video processing utilities.

Prerequisites

  • An OSC account (sign up here)
  • An S3-compatible bucket containing your source video. See Service: MinIO if you need object storage on OSC.

Step 1: Store S3 credentials as secrets

Navigate to the Trim Media service page, go to the Service Secrets tab, and click New Secret for each value:

Secret name Value
accesskeyid Your S3/MinIO access key ID
secretaccesskey Your S3/MinIO secret access key

See the Working with Secrets guide for full instructions.

Step 2: Create an instance

Go to the My mediafunctions tab and click Create mediafunction. Fill in:

  • Name: a unique name for your instance (alphanumeric only, e.g. mytrim)
  • awsRegion: the AWS region of your S3 bucket (e.g. us-east-1). For MinIO on OSC, use us-east-1.
  • awsAccessKeyId: {{secrets.accesskeyid}}
  • awsSecretAccessKey: {{secrets.secretaccesskey}}

Click Create and wait for the instance to start.

Step 3: Trim a video

Once the instance is running, send a POST request to the service endpoint with the source video URL and the desired start and end times:

curl -X POST "https://<instance-url>/trim" \
  -H "Content-Type: application/json" \
  -d '{
    "source": "s3://mybucket/input.mp4",
    "start": "00:00:10",
    "end": "00:00:30",
    "dest": "s3://mybucket/output.mp4"
  }'

The service reads the source file from S3, trims it to the specified time range, and writes the result to the destination path.

CLI usage

osc create eyevinn-function-trim mytrim \
  -o awsRegion="us-east-1" \
  -o awsAccessKeyId="{{secrets.accesskeyid}}" \
  -o awsSecretAccessKey="{{secrets.secretaccesskey}}"

Resources