tensorslab-video
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTensorsLab 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
undefinedCheck if API key is set
检查API密钥是否已设置
echo $TENSORSLAB_API_KEY
If not set, display this friendly message:
您好!要生成高质量的内容,您需要先进行简单的配置:
- 访问 https://tensorslab.tensorslab.com/ 登录并订阅。
- 在控制台中获取您的专属 API Key。
- 将其保存为环境变量:
- Windows (PowerShell): $env:TENSORSLAB_API_KEY="您的Key"
- Mac/Linux: export TENSORSLAB_API_KEY="您的Key"
undefinedecho $TENSORSLAB_API_KEY
如果未设置,请显示以下友好提示:
您好!要生成高质量的内容,您需要先进行简单的配置:
- 访问 https://tensorslab.tensorslab.com/ 登录并订阅。
- 在控制台中获取您的专属 API Key。
- 将其保存为环境变量:
- Windows (PowerShell): $env:TENSORSLAB_API_KEY="您的Key"
- Mac/Linux: export TENSORSLAB_API_KEY="您的Key"
undefinedModels
模型
| Model | Description | Best For | Max Duration |
|---|---|---|---|
| seedancev2 | Latest, highest quality | General purpose, cinematic content | 15s |
| seedancev15pro | Pro quality | High-end productions | 10s |
| seedancev1profast | Fast generation | Quick previews | 10s |
| seedancev1 | Standard lite | Basic videos | 10s |
Default:
seedancev1profast| 模型 | 描述 | 适用场景 | 最长时长 |
|---|---|---|---|
| seedancev2 | 最新版本,画质最高 | 通用场景、影视内容创作 | 15s |
| seedancev15pro | 专业级画质 | 高端制作 | 10s |
| seedancev1profast | 生成速度快 | 快速预览 | 10s |
| seedancev1 | 标准轻量版 | 基础视频制作 | 10s |
默认模型:
seedancev1profastWorkflow
工作流
1. Text-to-Video Generation
1. 文本转视频生成
User request: "做一段 10 秒钟横屏的宇宙飞船穿梭星际的视频"
Agent processing:
- Extract parameters: ,
duration=10ratio="16:9" - Enhance prompt with cinematic details, camera movements, scene descriptions
- Call API with enriched prompt
- Monitor progress with heartbeat updates (every 60 seconds)
- 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 处理流程:
- 提取参数:,
duration=10ratio="16:9" - 为提示词添加影视细节、镜头运动、场景描述等增强内容
- 调用API并传入增强后的提示词
- 通过心跳更新(每60秒一次)监控进度
- 将视频下载至目录
./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 motion2. Image-to-Video Generation
2. 图片转视频生成
User request: "让这张人物合影 family.jpg 动起来" or "让风景照动起来"
Agent processing:
- Extract image file paths (1-2 images supported)
- Enhance prompt with motion instructions
- Monitor progress with heartbeat updates
- Download results
Parameters for image-to-video:
- : Array of image files (1-2 images max)
sourceImage - : Comma-separated URLs of source images
imageUrl - : Description of desired motion/animation
prompt
用户请求:"让这张人物合影 family.jpg 动起来" 或 "让风景照动起来"
Agent 处理流程:
- 提取图片文件路径(支持1-2张图片)
- 为提示词添加运动指令增强内容
- 通过心跳更新监控进度
- 下载生成结果
图片转视频参数:
- : 图片文件数组(最多1-2张)
sourceImage - : 源图片的URL,用逗号分隔
imageUrl - : 期望的运动/动画描述
prompt
3. Resolution and Aspect Ratio
3. 分辨率与宽高比
Aspect ratios:
- - Vertical (TikTok, Reels, Shorts) - default
9:16 - - Horizontal (YouTube, standard video)
16:9 - Other ratios available depending on model
Resolutions:
- - SD quality, faster generation
480p - - HD quality - default
720p - - Full HD
1080p - - 2K quality (seedancev2 only)
1440p
宽高比:
- - 竖屏(TikTok、Reels、Shorts)- 默认
9:16 - - 横屏(YouTube、标准视频)
16:9 - 其他宽高比取决于所选模型
分辨率:
- - 标清画质,生成速度更快
480p - - 高清画质 - 默认
720p - - 全高清
1080p - - 2K画质(仅seedancev2支持)
1440p
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支持)
| Feature | Parameter | Description |
|---|---|---|
| Audio Generation | | Generate soundtrack with video |
| Last Frame | | Also return final frame as image |
| 功能 | 参数 | 描述 |
|---|---|---|
| 音频生成 | | 生成视频时同步生成配乐 |
| 输出最后一帧 | | 同时输出视频的最后一帧图片 |
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
undefinedText-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
undefinedpython scripts/tensorslab_video.py "a sunset timelapse" --output-dir ./my_videos
undefinedTask Status Flow
任务状态流程
| Status | Code | Meaning |
|---|---|---|
| Pending | 1 | Task waiting in queue |
| Processing | 2 | Currently generating |
| Completed | 3 | Done, video ready |
| Failed | 4 | Error occurred |
| Uploading | 5 | Uploading generated video |
| 状态 | 代码 | 含义 |
|---|---|---|
| 待处理 | 1 | 任务在队列中等待 |
| 处理中 | 2 | 正在生成视频 |
| 已完成 | 3 | 生成完成,视频已就绪 |
| 失败 | 4 | 发生错误 |
| 上传中 | 5 | 正在上传生成的视频 |
Error Handling
错误处理
Translate API errors to user-friendly messages:
| Error Code | Meaning | User Message |
|---|---|---|
| 9000 | Insufficient credits | "亲,积分用完啦,请前往 https://tensorslab.tensorslab.com/ 充值" |
| 9999 | General error | Show the specific error message |
将API错误转换为用户友好的提示信息:
| 错误代码 | 含义 | 用户提示 |
|---|---|---|
| 9000 | 积分不足 | "亲,积分用完啦,请前往 https://tensorslab.tensorslab.com/ 充值" |
| 9999 | 通用错误 | 显示具体的错误信息 |
Output
输出
All videos are saved to output directory with naming pattern:
- Default: (current working directory)
./tensorslab_output/ - Custom: Use or
--output-dirto specify a different path-o - Naming: - e.g.,
{task_id}_{index}.mp4abcd_1234567890_0.mp4
After completion, inform user:
🎉 您的视频处理完毕!已存放于 ./tensorslab_output/{filename}所有视频都会保存到指定的输出目录,命名规则如下:
- 默认目录:(当前工作目录)
./tensorslab_output/ - 自定义目录:使用或
--output-dir参数指定其他路径-o - 命名格式:- 例如:
{task_id}_{index}.mp4abcd_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文档