Skip to content

Quick Start

import { MediaPipelineSDK } from "mediapipeline-sdk";
async function main() {
const sdk = new MediaPipelineSDK(
{
storage: {
type: "local",
baseDir: "./output",
},
},
["1080", "720", "480"],
);
const result = await sdk.processLocal("./samples/input.mp4");
console.log(result.variants[0].path);
}
main().catch(console.error);

The generated output will be written into a per-run UUID folder under your configured baseDir.

import { MediaPipelineSDK } from "mediapipeline-sdk";
async function main() {
const sdk = new MediaPipelineSDK(
{
storage: {
type: "cloudinary",
baseDir: "./output",
credentials: {
cloudName: "your-cloud-name",
apiKey: "your-api-key",
apiSecret: "your-api-secret",
},
},
},
["720", "480", "360"],
);
const masterUrl = await sdk.processCloudinary("./samples/input.mp4");
console.log(masterUrl);
}
main().catch(console.error);
import { MediaPipelineSDK } from "mediapipeline-sdk";
async function main() {
const sdk = new MediaPipelineSDK(
{
storage: {
type: "s3",
baseDir: "./output",
credentials: {
accessKeyId: "your-access-key-id",
secretAccessKey: "your-secret-access-key",
region: "your-region",
bucket: "your-bucket",
folderName: "mediapipeline",
},
},
},
["720", "480", "360"],
);
const playbackUrl = await sdk.processS3("./samples/input.mp4");
console.log(playbackUrl);
}
main().catch(console.error);
  • processLocal() returns a ProcessResult and an internal output directory used during the run.
  • processCloudinary() returns the secure_url for master.m3u8 only.
  • processS3() returns a signed playback URL for signed/master.m3u8.

Pass a string array of output levels when constructing the SDK:

["1080", "720", "480", "360"];

If you pass an empty array, the SDK defaults to "720".