Prerequisites
- Python: confirm
python --version≥ 3.6 - environment variables(required; can also be configured via the
.envfile in the working directory, which the script will automatically load):VOLCENGINE_ACCESS_KEY— Volcengine Access KeyVOLCENGINE_SECRET_KEY— Volcengine Secret KeyVOD_SPACE_NAME— VOD space name
- Dependencies: the script depends on
python-dotenv
Parameter Input Methods
All scripts support two ways of passing JSON parameters:
- Inline JSON(suitable for simple parameters):
python script.py '{"key":"value"}' - File reference(recommended, avoids shell escaping issues):
python script.py @params.json
@ prefix indicates reading JSON content from a file; the file path is relative to the current working directory.
Result Delivery Rules
- After successfully submitting an asynchronous task, an asynchronous task id will be returned; the field is
VCCreativeIdorTaskId. When delivering the final artifact to the user,you mustinclude the asynchronous task id - When displaying the final artifact link,you must notmodify the link content arbitrarily
- Preferto provide the artifact link to the user
Workflow
1) Identify the input video type (if necessary, upload first to get vid://...)
All subsequent processing scriptsprefer using VOD-side resource references:
- Vid:
vid://vxxxx(or some scripts accept a barevxxxxand automatically fill invid://) - DirectUrl / FileName:
directurl://<vod_file_name>(for media tasks, when usingDirectUrl, it will requireFileName + SpaceName)
When the user provides one of the following inputs, you need to execute the upload logic first, get Vid , and then continue:
- Local file path: e.g.,
/path/to/a.mp4 http/httpslink: e.g.,https://example.com/a.mp4(will use URL pull upload and poll the upload result)
Uniformly use scripts/upload_media.py:
python <SKILL_DIR>/scripts/upload_media.py "<local_file_path_or_http_url>" [space_name]
In the script output, the Source field is vid://..., which can be directly used as input for subsequent processing.
Security restriction: local file uploads are only allowed for files under the workspace/, userdata/, and /tmp directories.
2) Identify user intent → select the corresponding processing script
Based on user needs, select a script according to the following decision tree:
| User intent | Script |
|---|---|
| Combine multiple videos/audios into one (sequential concatenation) | stitching |
| Extract a certain time segment from a video/audio | clipping |
| Speed up/slow down/change speed | speedup |
| Mirror/flip vertically/flip horizontally | flip |
| Concatenate multiple images to generate a video | image_to_video |
| Replace/overlay the video's background music | compile |
| Only the audio track in the video | extract_audio |
| Multiple audio tracks playing simultaneously overlaid (mixing) | mix_audios |
| Separate vocals and accompaniment/background sound | voice_separation |
| Remove environmental noise/electrical noise/wind noise | noise_reduction |
| Blurry/low-quality video restoration (compression artifacts/noise/scratches) | quality_enhance |
| Low-resolution video upscaling (e.g., 720P→1080P) | super_resolution |
| Frame interpolation for low-frame-rate videos to improve smoothness (e.g., 30fps→60fps) | interlacing |
| Speech recognition/ASR/extract text dialogue from video | asr_speech_to_text |
| OCR text extraction/recognize on-screen text in video | ocr_text_extract |
| Erase hard subtitles from video | subtitle_removal |
| Add/embed subtitles into video (burn subtitles) | add_subtitle |
| Video scene segmentation/intelligent clipping | intelligent_slicing |
| Portrait matting/portrait segmentation | portrait_matting |
| Green screen keying/green screen keying | green_screen |
| AI comic drama conversion (comic style/3D cartoon style) | comic_style |
| Short drama highlight editing/highlight clip extraction | highlight |
| AI video translation (subtitle/voice/face translation) | video_translation |
| Query translation project status/restart translation polling | poll_translation |
| Query translation project list | list_translation |
| AI commentary video generation (short drama commentary/secondary creation) | drama_recap |
| AI script restoration (video to structured script) | drama_script |
| Query media asset information (Vid details + playback URL) | get_media_info |
3) Construct parameters and execute
Video editing category
| Script | Purpose | Detailed parameters |
|---|---|---|
stitching.py '<json>' |
Video/audio concatenation | references/01-stitching.md |
clipping.py '<json>' |
Video/audio trimming | references/02-clipping.md |
flip.py '<json>' |
Video flip | references/03-flip.md |
speedup.py video '<json>' |
Video speed change | references/04-speedup.md |
speedup.py audio '<json>' |
Audio speed change | references/04-speedup.md |
image_to_video.py '<json>' |
Image to video | references/05-image-to-video.md |
compile.py '<json>' |
Audio and video compositing | references/06-compile.md |
extract_audio.py '<json>' |
Extract audio track | references/07-extract-audio.md |
mix_audios.py '<json>' |
Audio mixing | references/08-mix-audios.md |
Media processing category
| Script | Purpose | Detailed parameters |
|---|---|---|
voice_separation.py '<json>' |
Vocal separation | references/10-voice-separation.md |
noise_reduction.py '<json>' |
Audio noise reduction | references/11-noise-reduction.md |
quality_enhance.py '<json>' |
Comprehensive image quality restoration | references/12-quality-enhance.md |
super_resolution.py '<json>' |
AI super-resolution | references/13-super-resolution.md |
interlacing.py '<json>' |
Intelligent frame interpolation | references/14-interlacing.md |
AI content analysis category
| Script | Purpose | Detailed parameters |
|---|---|---|
asr_speech_to_text.py '<json>' |
Speech recognition ASR | references/15-asr-speech-to-text.md |
ocr_text_extract.py '<json>' |
OCR text extraction | references/16-ocr-text-extract.md |
subtitle_removal.py '<json>' |
Hard subtitle removal | references/17-subtitle-removal.md |
add_subtitle.py '<json>' |
Add embedded subtitles | references/18-add-subtitle.md |
intelligent_slicing.py '<json>' |
Intelligent scene segmentation | references/19-intelligent-slicing.md |
portrait_matting.py '<json>' |
Portrait matting | references/20-portrait-matting.md |
green_screen.py '<json>' |
Green screen keying | references/21-green-screen.md |
highlight.py '<json>' |
Short drama highlight editing | references/23-highlight.md |
get_media_info.py '<json>' |
Media asset information query | references/27-get-media-info.md |
AI content generation category
| Script | Purpose | Detailed parameters |
|---|---|---|
comic_style.py '<json>' |
AI comic drama conversion | references/22-comic-style.md |
video_translation.py '<json>' |
AI video translation | references/24-video-translation.md |
drama_recap.py '<json>' |
AI commentary video generation | references/25-drama-recap.md |
drama_script.py '<json>' |
AI script restoration | references/26-drama-script.md |
Restart polling
| Script | Purpose |
|---|---|
poll_vcreative.py <task_id> |
Restart editing category task polling |
poll_media.py <task_type> <RunId> |
Restart media processing category task polling |
poll_translation.py <ProjectId> |
Restart translation task polling |
In the timeout response, the resume_hint.command field contains a restart command that can be directly copied and executed.
Example
# 本地文件先上传拿到 vid(后续脚本统一用 vid://... 作为输入)
python <SKILL_DIR>/scripts/upload_media.py "/path/to/local.mp4" my_space
# 拼接两个视频,加转场
python <SKILL_DIR>/scripts/stitching.py \
'{"type":"video","videos":["vid://v0001","vid://v0002"],"transitions":["1182359"]}'
# 使用 @file.json 传参(推荐,避免转义问题)
python <SKILL_DIR>/scripts/stitching.py @params.json
# 人声分离(注意 type 首字母大写)
python <SKILL_DIR>/scripts/voice_separation.py '{"type":"Vid","video":"v0310abc"}'
# 超分到 1080P
python <SKILL_DIR>/scripts/super_resolution.py '{"type":"Vid","video":"v0310xyz","Res":"1080p"}'
# ASR 语音识别
python <SKILL_DIR>/scripts/asr_speech_to_text.py '{"type":"Vid","video":"v0310abc"}'
# 短剧高光剪辑
python <SKILL_DIR>/scripts/highlight.py '{"Vids":["v023xxx","v024xxx"]}'
# AI 视频翻译(中文→英文)
python <SKILL_DIR>/scripts/video_translation.py '{"Vid":"v0d225gxxx","SourceLanguage":"zh","TargetLanguage":"en"}'
# AI 漫剧转绘(漫画风 720p)
python <SKILL_DIR>/scripts/comic_style.py '{"Vid":"v0d012xxxx","Style":"漫画风","Resolution":"720p"}'
# AI 解说视频(自动生成解说词)
python <SKILL_DIR>/scripts/drama_recap.py '{"Vids":["v023xxx"],"AutoGenerateRecapText":true}'
# AI 剧本还原
python <SKILL_DIR>/scripts/drama_script.py '{"Vids":["v023xxx","v024xxx"]}'
# 查询媒资信息
python <SKILL_DIR>/scripts/get_media_info.py '{"vids":"v001,v002"}'
# 超时后重启编辑类轮询
python <SKILL_DIR>/scripts/poll_vcreative.py <异步智剪任务ID> my_space
# 超时后重启媒体类轮询
python <SKILL_DIR>/scripts/poll_media.py videSuperResolution run_yyy my_space
# 超时后重启翻译轮询
python <SKILL_DIR>/scripts/poll_translation.py <ProjectId> my_space
Error output
All errors use a unified format:{"error": "说明"}
Timeout output (including restart command):
{
"error": "轮询超时(360 次 × 5s),任务仍在处理中",
"resume_hint": {
"description": "任务尚未完成,可用以下命令重启轮询",
"command": "python <SKILL_DIR>/scripts/poll_media.py videSuperResolution run_yyy my_space"
}
}
Constraints
- Before calling the scriptmustview the script's detailed parameter description
Billing description
Only when the user proactively asks about fees or billing rules, refer to the billing description in references/00-billing-instructions.md and briefly explain to the user the billing composition of the VOD resources that byted-vod-process-tools depends on, avoiding proactively expanding on billing details in ordinary editing/processing conversations.