Prerequisites
- Python: Confirm
python --version≥ 3.6 - Dependencies: Script dependencies
python-dotenv
Parameter Passing Methods
All scripts support two JSON parameter passing methods:
- Inline JSON(suitable for simple parameters):
python script.py '{"key":"value"}' - File Reference(recommended, avoids shell escaping issues):
python script.py @params.json
@ The 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, with the field being
VCCreativeIdorTaskId. When delivering the final artifact to the user,you mustinclude the asynchronous task id - When displaying the final artifact link,it is prohibitedto arbitrarily modify the link content
- Give priority toproviding the artifact link to the user
Workflow
1) Identify the input video type (if necessary, upload first to obtain vid://...)
All subsequent processing scriptsprioritize using VOD-side resource references:
- Vid:
vid://vxxxx(or some scripts accept a barevxxxxand automatically prependvid://) - DirectUrl / FileName:
directurl://<vod_file_name>(for media-type tasks, when usingDirectUrl, it will requireFileName + SpaceName)
When the user provides one of the following inputs, you need to execute the upload logic first, obtain Vid , and then continue:
- Local file path: such as
/path/to/a.mp4 http/httpslink: such ashttps://example.com/a.mp4(will perform URL fetch 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 upload only allows 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 |
| Generate a video by connecting multiple images in sequence | image_to_video |
| Replace/overlay the background music of a video | compile |
| Only want the audio track from the video | extract_audio |
| Overlay and play multiple audio tracks simultaneously (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 enhancement (such as 720P→1080P) | super_resolution |
| Frame interpolation for low-frame-rate videos to improve smoothness (such as 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 to video (burn-in subtitles) | add_subtitle |
| Video scene segmentation/intelligent slicing | intelligent_slicing |
| Portrait matting/portrait segmentation | portrait_matting |
| Green screen keying/green screen chroma keying | green_screen |
| AI comic drama conversion (comic style/3D cartoon style) | comic_style |
| Short drama highlight editing/exciting 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/Derivative Creation) | drama_recap |
| AI Script Restoration (Video to Structured Script) | drama_script |
| Query Media Asset Information (Vid Details + Playback Address) | 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 Flipping | 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-Video Synthesis | 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 Style Transfer | 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 copied and executed directly.
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 detailed script 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 volcengine-ai-mediakit depends on, avoiding proactively expanding on billing details in ordinary editing/processing conversations.