Token导航 LogoToken导航TokenDH.com
开发敏感数据github未标认证来源可访问许可证需确认审计通过

byted-tos-video-process字节跳动 tos 视频流程

Agent Skill

用于辅助视频生成、动画合成、脚本化剪辑或 Remotion 等视频项目开发。它适合让 Agent 组织镜头、生成素材说明、维护合成代码或排查渲染问题。使用时需要确认分辨率、时长、素材路径和导出格式;涉及外部素材、人物肖像或商业发布时,应先核对版权授权和内容审核要求。

总安装

318

周安装

13

GitHub Stars

325

下载量

103
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:byted-tos-video-process(字节跳动 tos 视频流程)
来源仓库:https://github.com/bytedance/agentkit-samples
仓库路径:skills/byted-tos-video-process
安装命令:
npx skills add https://github.com/bytedance/agentkit-samples --skill byted-tos-video-process
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/bytedance/agentkit-samples --skill byted-tos-video-process

简介

用于视频生成、动画合成及 Remotion 项目开发。

  • 可组织镜头、生成素材说明、维护合成代码或排查渲染问题。
  • 需确认分辨率、时长、素材路径和导出格式。byted-tos-video-process 属于开发类 Skill,可作为该场景下的辅助能力补充。
  • 安装方式:通过 npx 从 GitHub 仓库添加技能。
  • 注意:使用外部素材或商业发布前应核对版权与内容审核要求。

SKILL.md

Bytedance TOS Video Process Skill

This skill provides essential video processing functions for video files stored in Bytedance's TOS (TeraObjectStore). It allows you to retrieve video metadata and perform single-frame or multi-frame snapshots directly using the Volcengine TOS SDK.

Quick Start

1. Client Initialization

The following Python snippet demonstrates how to initialize the TosClientV2 from environment variables.

import os
import tos
from tos.exceptions import TosClientError, TosServerError

def create_client() -> tos.TosClientV2:
    """Initializes a TosClientV2 using AK/SK (and optional STS token) from environment variables."""
    try:
        ak = os.getenv('TOS_ACCESS_KEY')
        sk = os.getenv('TOS_SECRET_KEY')
        endpoint = os.getenv('TOS_ENDPOINT')
        region = os.getenv('TOS_REGION')
        security_token = os.getenv('TOS_SECURITY_TOKEN') # Optional, for STS

        if not all([ak, sk, endpoint, region]):
            raise ValueError("Required environment variables are missing (AK, SK, Endpoint, Region).")

        return tos.TosClientV2(
            ak=ak,
            sk=sk,
            endpoint=endpoint,
            region=region,
            security_token=security_token,
        )
    except (ValueError, ImportError) as e:
        print(f"Error initializing client: {e}")
        # Handle initialization failure
        return None

# Create the client
client = create_client()

2. Basic Workflow

# (Assumes 'client' is initialized and 'bucket_name', 'object_key' are set)

# 1. Get Video Info
try:
    response = client.get_object(bucket_name, object_key, process="video/info")
    info_data = response.read()
    print("Video Info:", info_data.decode('utf-8'))
except TosServerError as e:
    print(f"Error getting video info: {e}")

# 2. Take a Single Snapshot and save locally
try:
    client.get_object_to_file(
        bucket_name,
        object_key,
        "snapshot_1000ms.jpg",
        process="video/snapshot,t_1000,f_jpg,w_720"
    )
    print("Snapshot saved to snapshot_1000ms.jpg")
except TosServerError as e:
    print(f"Error taking snapshot: {e}")

# 3. Take a Snapshot and save back to TOS
try:
    response = client.get_object(
        bucket_name,
        object_key,
        process="video/snapshot,t_5000,f_jpg",
        save_bucket=bucket_name,
        save_object="processed/snapshot_5000ms.jpg"
    )
    save_result = response.read()
    print("Snapshot saved to TOS:", save_result.decode('utf-8'))
except TosServerError as e:
    print(f"Error saving snapshot to TOS: {e}")

Core Operations

All video processing is achieved via the process parameter in the get_object or get_object_to_file SDK methods.

1. Get Video Info (videoInfo)

Retrieves metadata of a video file, such as resolution, duration, and format.

SDK Method: client.get_object(..., process="video/info")

# 'client', 'bucket_name', and 'object_key' must be defined
try:
    response = client.get_object(bucket_name, object_key, process="video/info")
    # The response body is a JSON string
    video_metadata = response.read().decode('utf-8')
    print(video_metadata)
except TosServerError as e:
    print(f"Server Error: {e.code} - {e.message}")

2. Take a Single Snapshot (videoSnapshot)

Captures a single frame from a video. It supports various parameters for customization and can either return the image data or save the result directly back to TOS.

SDK Method: client.get_object_to_file(..., process="video/snapshot,...") for local save. SDK Method: client.get_object(..., process="video/snapshot,...", save_bucket=..., save_object=...) for saving to TOS.

# Example: Take a snapshot at 10 seconds, resize to 720p width, and save locally
try:
    client.get_object_to_file(
        bucket_name,
        object_key,
        file_path="local_snapshot.jpg",
        process="video/snapshot,t_10000,w_720,f_jpg"
    )
    print("Snapshot saved successfully to local_snapshot.jpg")
except (TosClientError, TosServerError) as e:
    print(f"An error occurred: {e}")

3. Take Multiple Snapshots (videoSnapshots)

This is a client-side orchestration pattern. You loop through a series of timestamps and make multiple calls to the videoSnapshot operation. The scripts/video_snapshots.py provides a reference implementation for parallel execution.

# (Assumes 'client', 'bucket_name', 'object_key' are set)
timestamps = [1000, 5000, 10000]  # In milliseconds

for i, ts in enumerate(timestamps):
    output_filename = f'snapshot_{i+1}_at_{ts}ms.jpg'
    process_rule = f"video/snapshot,t_{ts},w_720,f_jpg"
    try:
        client.get_object_to_file(
            bucket_name,
            object_key,
            output_filename,
            process=process_rule
        )
        print(f"Saved snapshot to {output_filename}")
    except (TosClientError, TosServerError) as e:
        print(f"Failed for timestamp {ts}: {e}")

Authorization

Authentication is handled directly by the tos.TosClientV2 constructor. Provide credentials via environment variables.

Required Environment Variables

  • TOS_ACCESS_KEY: Your Access Key ID.
  • TOS_SECRET_KEY: Your Secret Access Key.
  • TOS_ENDPOINT: The endpoint for the TOS service (e.g., https://tos-cn-beijing.volces.com).
  • TOS_REGION: The region for the TOS service (e.g., cn-beijing).

Optional for STS

  • TOS_SECURITY_TOKEN: If using a temporary token (STS), provide the session token here. The client will automatically use it if present.

Best Practices

  • Error Handling: Always wrap SDK calls in try...except blocks to handle TosClientError and TosServerError.
  • Parameter Validation: Validate parameters like time, width, and height on the client side before making an API call to prevent unnecessary errors.
  • Batch Operations: For videoSnapshots, use a thread pool (like ThreadPoolExecutor) to perform multiple snapshot requests in parallel for better performance. See scripts/video_snapshots.py for an example.
  • Credentials Management: Use a secure method to manage and refresh credentials, especially when using short-lived STS tokens.

Additional Resources

  • For detailed parameters of each operation, see REFERENCE.md.
  • For common end-to-end examples, see WORKFLOWS.md.
  • For executable Python examples, see the scripts/ directory.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.32%
按下载量换算36

Claude

32.41%
按下载量换算33

Cursor

19.68%
按下载量换算20

Gemini CLI

10.07%
按下载量换算10

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills