tensorslab-video

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

TensorsLab Video Generation

TensorsLab 视频生成

Overview

概述

This skill enables AI-powered video generation through TensorsLab's API, supporting both text-to-video and image-to-video workflows. Video generation is a time-intensive process - tasks typically take several minutes to complete.
本Skill通过TensorsLab的API实现AI驱动的视频生成,支持文本转视频和图片转视频两种工作流。视频生成是一个耗时的过程——任务通常需要几分钟才能完成。

Authentication Check

身份验证检查

Before any video generation, verify the API key is configured:
bash
undefined
在进行任何视频生成操作前,请先验证API密钥是否已配置:
bash
undefined

Check if API key is set

检查API密钥是否已设置

echo $TENSORSLAB_API_KEY

If not set, display this friendly message:
您好!要生成高质量的内容,您需要先进行简单的配置:
  1. 访问 https://tensorslab.tensorslab.com/ 登录并订阅。
  2. 在控制台中获取您的专属 API Key。
  3. 将其保存为环境变量:
    • Windows (PowerShell): $env:TENSORSLAB_API_KEY="您的Key"
    • Mac/Linux: export TENSORSLAB_API_KEY="您的Key"
undefined
echo $TENSORSLAB_API_KEY

如果未设置,请显示以下友好提示:
您好!要生成高质量的内容,您需要先进行简单的配置:
  1. 访问 https://tensorslab.tensorslab.com/ 登录并订阅。
  2. 在控制台中获取您的专属 API Key。
  3. 将其保存为环境变量:
    • Windows (PowerShell): $env:TENSORSLAB_API_KEY="您的Key"
    • Mac/Linux: export TENSORSLAB_API_KEY="您的Key"
undefined

Models

模型

ModelDescriptionBest ForMax Duration
seedancev2Latest, highest qualityGeneral purpose, cinematic content15s
seedancev15proPro qualityHigh-end productions10s
seedancev1profastFast generationQuick previews10s
seedancev1Standard liteBasic videos10s
Default:
seedancev1profast
模型描述适用场景最长时长
seedancev2最新版本,画质最高通用场景、影视内容创作15s
seedancev15pro专业级画质高端制作10s
seedancev1profast生成速度快快速预览10s
seedancev1标准轻量版基础视频制作10s
默认模型:
seedancev1profast

Workflow

工作流

1. Text-to-Video Generation

1. 文本转视频生成

User request: "做一段 10 秒钟横屏的宇宙飞船穿梭星际的视频"
Agent processing:
  1. Extract parameters:
    duration=10
    ,
    ratio="16:9"
  2. Enhance prompt with cinematic details, camera movements, scene descriptions
  3. Call API with enriched prompt
  4. Monitor progress with heartbeat updates (every 60 seconds)
  5. Download to
    ./tensorslab_output/
Example enhanced prompt:
Cinematic wide shot of a spaceship rapidly flying through space, passing glowing
nebulae and distant stars, lens flares, dramatic camera movement, epic scale,
movie-quality visual effects, smooth 24fps motion
用户请求:"做一段 10 秒钟横屏的宇宙飞船穿梭星际的视频"
Agent 处理流程:
  1. 提取参数:
    duration=10
    ratio="16:9"
  2. 为提示词添加影视细节、镜头运动、场景描述等增强内容
  3. 调用API并传入增强后的提示词
  4. 通过心跳更新(每60秒一次)监控进度
  5. 将视频下载至
    ./tensorslab_output/
    目录
增强后的提示词示例:
Cinematic wide shot of a spaceship rapidly flying through space, passing glowing
nebulae and distant stars, lens flares, dramatic camera movement, epic scale,
movie-quality visual effects, smooth 24fps motion

2. Image-to-Video Generation

2. 图片转视频生成

User request: "让这张人物合影 family.jpg 动起来" or "让风景照动起来"
Agent processing:
  1. Extract image file paths (1-2 images supported)
  2. Enhance prompt with motion instructions
  3. Monitor progress with heartbeat updates
  4. Download results
Parameters for image-to-video:
  • sourceImage
    : Array of image files (1-2 images max)
  • imageUrl
    : Comma-separated URLs of source images
  • prompt
    : Description of desired motion/animation
用户请求:"让这张人物合影 family.jpg 动起来" 或 "让风景照动起来"
Agent 处理流程:
  1. 提取图片文件路径(支持1-2张图片)
  2. 为提示词添加运动指令增强内容
  3. 通过心跳更新监控进度
  4. 下载生成结果
图片转视频参数:
  • sourceImage
    : 图片文件数组(最多1-2张)
  • imageUrl
    : 源图片的URL,用逗号分隔
  • prompt
    : 期望的运动/动画描述

3. Resolution and Aspect Ratio

3. 分辨率与宽高比

Aspect ratios:
  • 9:16
    - Vertical (TikTok, Reels, Shorts) - default
  • 16:9
    - Horizontal (YouTube, standard video)
  • Other ratios available depending on model
Resolutions:
  • 480p
    - SD quality, faster generation
  • 720p
    - HD quality - default
  • 1080p
    - Full HD
  • 1440p
    - 2K quality (seedancev2 only)
宽高比:
  • 9:16
    - 竖屏(TikTok、Reels、Shorts)- 默认
  • 16:9
    - 横屏(YouTube、标准视频)
  • 其他宽高比取决于所选模型
分辨率:
  • 480p
    - 标清画质,生成速度更快
  • 720p
    - 高清画质 - 默认
  • 1080p
    - 全高清
  • 1440p
    - 2K画质(仅seedancev2支持)

4. Duration Options

4. 时长选项

  • seedancev2: 5-15 seconds
  • Other models: 5-10 seconds
Longer videos take proportionally more time to generate.
  • seedancev2: 5-15秒
  • 其他模型: 5-10秒
视频时长越长,生成所需时间相应越长。

5. Special Features (seedancev2 only)

5. 特殊功能(仅seedancev2支持)

FeatureParameterDescription
Audio Generation
generate_audio=1
Generate soundtrack with video
Last Frame
return_last_frame=1
Also return final frame as image
功能参数描述
音频生成
generate_audio=1
生成视频时同步生成配乐
输出最后一帧
return_last_frame=1
同时输出视频的最后一帧图片

Progress Tracking

进度跟踪

Video generation takes several minutes. Keep users informed:
⏳ Waiting for video generation to complete...
   (This may take several minutes - please be patient)
🔄 Status: Processing (elapsed: 45s)
🚀 正在渲染电影级大片,已耗时 60 秒,请稍安勿躁...
🚀 正在渲染电影级大片,已耗时 120 秒,请稍安勿躁...
✅ Task completed!
Heartbeat interval: Print encouraging message every 60 seconds.
视频生成需要几分钟时间。请及时向用户反馈进度:
⏳ 正在等待视频生成完成...
   (此过程可能需要几分钟,请耐心等待)
🔄 状态:处理中(已耗时:45秒)
🚀 正在渲染电影级大片,已耗时 60 秒,请稍安勿躁...
🚀 正在渲染电影级大片,已耗时 120 秒,请稍安勿躁...
✅ 任务完成!
心跳间隔: 每60秒打印一次鼓励性提示。

Using the Script

使用脚本

Execute the Python script directly:
bash
undefined
直接执行Python脚本:
bash
undefined

Text-to-video (default 5s, vertical 9:16)

文本转视频(默认5秒,竖屏9:16)

python scripts/tensorslab_video.py "a spaceship flying through space"
python scripts/tensorslab_video.py "a spaceship flying through space"

10 second horizontal video

10秒横屏视频

python scripts/tensorslab_video.py "sunset over ocean waves" --duration 10 --ratio 16:9
python scripts/tensorslab_video.py "sunset over ocean waves" --duration 10 --ratio 16:9

Image-to-video

图片转视频

python scripts/tensorslab_video.py "make this photo come alive" --source portrait.jpg
python scripts/tensorslab_video.py "make this photo come alive" --source portrait.jpg

Fast preview

快速预览

python scripts/tensorslab_video.py "abstract flowing colors" --model seedancev1profast
python scripts/tensorslab_video.py "abstract flowing colors" --model seedancev1profast

High quality with audio

带音频的高质量视频

python scripts/tensorslab_video.py "epic mountain timelapse" --resolution 1440p --duration 10 --audio
python scripts/tensorslab_video.py "epic mountain timelapse" --resolution 1440p --duration 10 --audio

Custom output directory

自定义输出目录

python scripts/tensorslab_video.py "a sunset timelapse" --output-dir ./my_videos
undefined
python scripts/tensorslab_video.py "a sunset timelapse" --output-dir ./my_videos
undefined

Task Status Flow

任务状态流程

StatusCodeMeaning
Pending1Task waiting in queue
Processing2Currently generating
Completed3Done, video ready
Failed4Error occurred
Uploading5Uploading generated video
状态代码含义
待处理1任务在队列中等待
处理中2正在生成视频
已完成3生成完成,视频已就绪
失败4发生错误
上传中5正在上传生成的视频

Error Handling

错误处理

Translate API errors to user-friendly messages:
Error CodeMeaningUser Message
9000Insufficient credits"亲,积分用完啦,请前往 https://tensorslab.tensorslab.com/ 充值"
9999General errorShow the specific error message
将API错误转换为用户友好的提示信息:
错误代码含义用户提示
9000积分不足"亲,积分用完啦,请前往 https://tensorslab.tensorslab.com/ 充值"
9999通用错误显示具体的错误信息

Output

输出

All videos are saved to output directory with naming pattern:
  • Default:
    ./tensorslab_output/
    (current working directory)
  • Custom: Use
    --output-dir
    or
    -o
    to specify a different path
  • Naming:
    {task_id}_{index}.mp4
    - e.g.,
    abcd_1234567890_0.mp4
After completion, inform user:
🎉 您的视频处理完毕!已存放于 ./tensorslab_output/{filename}
所有视频都会保存到指定的输出目录,命名规则如下:
  • 默认目录:
    ./tensorslab_output/
    (当前工作目录)
  • 自定义目录:使用
    --output-dir
    -o
    参数指定其他路径
  • 命名格式:
    {task_id}_{index}.mp4
    - 例如:
    abcd_1234567890_0.mp4
生成完成后,通知用户:
🎉 您的视频处理完毕!已存放于 ./tensorslab_output/{filename}

Tips for Better Results

优化生成结果的技巧

Text-to-Video

文本转视频

  • Include cinematic terms: "wide shot", "close-up", "pan", "dolly"
  • Describe motion: "flying rapidly", "slowly drifting", "zooming in"
  • Specify style: "cinematic", "documentary style", "dreamy"
  • 加入影视术语:"wide shot(广角镜头)"、"close-up(特写)"、"pan(摇镜头)"、"dolly(推拉镜头)"
  • 描述运动状态:"快速飞行"、"缓慢漂移"、"镜头拉近"
  • 指定风格:"影视级"、"纪录片风格"、"梦幻风"

Image-to-Video

图片转视频

  • Describe the desired motion: "gentle sway", "subtle movement"
  • For landscapes: "clouds moving", "water flowing", "leaves rustling"
  • 描述期望的运动效果:"轻微晃动"、"细微移动"
  • 针对风景照:"云朵飘动"、"水流流动"、"树叶摇曳"

Resources

资源

  • scripts/tensorslab_video.py: Main API client with full CLI support
  • references/api_reference.md: Detailed API documentation
  • scripts/tensorslab_video.py: 完整支持CLI的主API客户端
  • references/api_reference.md: 详细的API文档