transloadit-media-processing

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Transloadit Media Processing

Transloadit媒体处理

Process, transform, and encode media files using Transloadit's cloud infrastructure. Supports video, audio, images, and documents with 86+ specialized processing robots.
借助Transloadit的云基础设施处理、转换和编码媒体文件。支持视频、音频、图片和文档,配备86+个专用处理机器人。

When to Use This Skill

何时使用该工具

Use this skill when you need to:
  • Encode video to HLS, MP4, WebM, or other formats
  • Generate thumbnails or animated GIFs from video
  • Resize, crop, watermark, or optimize images
  • Convert between image formats (JPEG, PNG, WebP, AVIF, HEIF)
  • Extract or transcode audio (MP3, AAC, FLAC, WAV)
  • Concatenate video or audio clips
  • Add subtitles or overlay text on video
  • OCR documents (PDF, scanned images)
  • Run speech-to-text or text-to-speech
  • Apply AI-based content moderation or object detection
  • Build multi-step media pipelines that chain operations together
当你需要完成以下操作时,可使用本工具:
  • 将视频编码为HLS、MP4、WebM或其他格式
  • 从视频中生成缩略图或动态GIF
  • 调整图片大小、裁剪、添加水印或优化图片
  • 在不同图片格式间转换(JPEG、PNG、WebP、AVIF、HEIF)
  • 提取或转码音频(MP3、AAC、FLAC、WAV)
  • 拼接视频或音频剪辑
  • 为视频添加字幕或叠加文字
  • 对文档(PDF、扫描图片)进行OCR识别
  • 运行语音转文字或文字转语音
  • 应用基于AI的内容审核或目标检测
  • 构建可串联多个操作的多步骤媒体处理流程

Setup

设置步骤

Option A: MCP Server (recommended for Copilot)

选项A:MCP服务器(推荐给Copilot使用)

Add the Transloadit MCP server to your IDE config. This gives the agent direct access to Transloadit tools (
create_template
,
create_assembly
,
list_assembly_notifications
, etc.).
VS Code / GitHub Copilot (
.vscode/mcp.json
or user settings):
json
{
  "servers": {
    "transloadit": {
      "command": "npx",
      "args": ["-y", "@transloadit/mcp-server", "stdio"],
      "env": {
        "TRANSLOADIT_KEY": "YOUR_AUTH_KEY",
        "TRANSLOADIT_SECRET": "YOUR_AUTH_SECRET"
      }
    }
  }
}
将Transloadit MCP服务器添加到你的IDE配置中。这将让Agent可以直接访问Transloadit工具(
create_template
create_assembly
list_assembly_notifications
等)。
VS Code / GitHub Copilot
.vscode/mcp.json
或用户设置):
json
{
  "servers": {
    "transloadit": {
      "command": "npx",
      "args": ["-y", "@transloadit/mcp-server", "stdio"],
      "env": {
        "TRANSLOADIT_KEY": "YOUR_AUTH_KEY",
        "TRANSLOADIT_SECRET": "YOUR_AUTH_SECRET"
      }
    }
  }
}

Option B: CLI

选项B:CLI

If you prefer running commands directly:
bash
npx -y @transloadit/node assemblies create \
  --steps '{"encoded": {"robot": "/video/encode", "use": ":original", "preset": "hls-1080p"}}' \
  --wait \
  --input ./my-video.mp4
如果你偏好直接运行命令:
bash
npx -y @transloadit/node assemblies create \
  --steps '{"encoded": {"robot": "/video/encode", "use": ":original", "preset": "hls-1080p"}}' \
  --wait \
  --input ./my-video.mp4

Core Workflows

核心工作流程

Encode Video to HLS (Adaptive Streaming)

将视频编码为HLS(自适应流)

json
{
  "steps": {
    "encoded": {
      "robot": "/video/encode",
      "use": ":original",
      "preset": "hls-1080p"
    }
  }
}
json
{
  "steps": {
    "encoded": {
      "robot": "/video/encode",
      "use": ":original",
      "preset": "hls-1080p"
    }
  }
}

Generate Thumbnails from Video

从视频生成缩略图

json
{
  "steps": {
    "thumbnails": {
      "robot": "/video/thumbs",
      "use": ":original",
      "count": 8,
      "width": 320,
      "height": 240
    }
  }
}
json
{
  "steps": {
    "thumbnails": {
      "robot": "/video/thumbs",
      "use": ":original",
      "count": 8,
      "width": 320,
      "height": 240
    }
  }
}

Resize and Watermark Images

调整图片大小并添加水印

json
{
  "steps": {
    "resized": {
      "robot": "/image/resize",
      "use": ":original",
      "width": 1200,
      "height": 800,
      "resize_strategy": "fit"
    },
    "watermarked": {
      "robot": "/image/resize",
      "use": "resized",
      "watermark_url": "https://example.com/logo.png",
      "watermark_position": "bottom-right",
      "watermark_size": "15%"
    }
  }
}
json
{
  "steps": {
    "resized": {
      "robot": "/image/resize",
      "use": ":original",
      "width": 1200,
      "height": 800,
      "resize_strategy": "fit"
    },
    "watermarked": {
      "robot": "/image/resize",
      "use": "resized",
      "watermark_url": "https://example.com/logo.png",
      "watermark_position": "bottom-right",
      "watermark_size": "15%"
    }
  }
}

OCR a Document

对文档进行OCR识别

json
{
  "steps": {
    "recognized": {
      "robot": "/document/ocr",
      "use": ":original",
      "provider": "aws",
      "format": "text"
    }
  }
}
json
{
  "steps": {
    "recognized": {
      "robot": "/document/ocr",
      "use": ":original",
      "provider": "aws",
      "format": "text"
    }
  }
}

Concatenate Audio Clips

拼接音频剪辑

json
{
  "steps": {
    "imported": {
      "robot": "/http/import",
      "url": ["https://example.com/clip1.mp3", "https://example.com/clip2.mp3"]
    },
    "concatenated": {
      "robot": "/audio/concat",
      "use": "imported",
      "preset": "mp3"
    }
  }
}
json
{
  "steps": {
    "imported": {
      "robot": "/http/import",
      "url": ["https://example.com/clip1.mp3", "https://example.com/clip2.mp3"]
    },
    "concatenated": {
      "robot": "/audio/concat",
      "use": "imported",
      "preset": "mp3"
    }
  }
}

Multi-Step Pipelines

多步骤处理流程

Steps can be chained using the
"use"
field. Each step references a previous step's output:
json
{
  "steps": {
    "resized": {
      "robot": "/image/resize",
      "use": ":original",
      "width": 1920
    },
    "optimized": {
      "robot": "/image/optimize",
      "use": "resized"
    },
    "exported": {
      "robot": "/s3/store",
      "use": "optimized",
      "bucket": "my-bucket",
      "path": "processed/${file.name}"
    }
  }
}
可通过
"use"
字段将多个步骤串联起来。每个步骤可引用上一个步骤的输出:
json
{
  "steps": {
    "resized": {
      "robot": "/image/resize",
      "use": ":original",
      "width": 1920
    },
    "optimized": {
      "robot": "/image/optimize",
      "use": "resized"
    },
    "exported": {
      "robot": "/s3/store",
      "use": "optimized",
      "bucket": "my-bucket",
      "path": "processed/${file.name}"
    }
  }
}

Key Concepts

核心概念

  • Assembly: A single processing job. Created via
    create_assembly
    (MCP) or
    assemblies create
    (CLI).
  • Template: A reusable set of steps stored on Transloadit. Created via
    create_template
    (MCP) or
    templates create
    (CLI).
  • Robot: A processing unit (e.g.,
    /video/encode
    ,
    /image/resize
    ). See full list at https://transloadit.com/docs/transcoding/
  • Steps: JSON object defining the pipeline. Each key is a step name, each value configures a robot.
  • :original
    : Refers to the uploaded input file.
  • Assembly:单个处理任务。可通过
    create_assembly
    (MCP)或
    assemblies create
    (CLI)创建。
  • Template:存储在Transloadit上的可复用步骤集合。可通过
    create_template
    (MCP)或
    templates create
    (CLI)创建。
  • Robot:处理单元(例如
    /video/encode
    /image/resize
    )。完整列表请访问https://transloadit.com/docs/transcoding/
  • Steps:定义处理流程的JSON对象。每个键为步骤名称,对应的值用于配置机器人。
  • :original
    :指代上传的输入文件。

Tips

小贴士

  • Use
    --wait
    with the CLI to block until processing completes.
  • Use
    preset
    values (e.g.,
    "hls-1080p"
    ,
    "mp3"
    ,
    "webp"
    ) for common format targets instead of specifying every parameter.
  • Chain
    "use": "step_name"
    to build multi-step pipelines without intermediate downloads.
  • For batch processing, use
    /http/import
    to pull files from URLs, S3, GCS, Azure, FTP, or Dropbox.
  • Templates can include
    ${variables}
    for dynamic values passed at assembly creation time.
  • 在CLI中使用
    --wait
    参数,可阻塞等待处理完成。
  • 针对常见格式目标,使用
    preset
    值(例如
    "hls-1080p"
    "mp3"
    "webp"
    ),而非手动指定所有参数。
  • 通过
    "use": "step_name"
    串联步骤,无需下载中间文件即可构建多步骤流程。
  • 如需批量处理,可使用
    /http/import
    从URL、S3、GCS、Azure、FTP或Dropbox拉取文件。
  • 模板可包含
    ${variables}
    变量,用于在创建Assembly时传入动态值。