One-click video translation powered by Alibaba Cloud IMS, supporting subtitle-level and speech-level translation.
IMPORTANT: Different APIs use different address formats!
APIAddress FormatExampleSubmitIProductionJob (subtitle extraction)oss:// formatoss://my-bucket/videos/test.mp4``SubmitVideoTranslationJob (video translation)HTTP URL formathttps://my-bucket.oss-cn-shanghai.aliyuncs.com/videos/test.mp4
Key: Subtitle extraction uses
oss://, video translation uses HTTP URL!
User Input TypeProcessing MethodHTTP URL formatUse directly for video translation; convert to oss:// if subtitle extraction neededoss:// formatUse directly for subtitle extraction; convert to HTTP URL for video translationLocal videoMUST ask for OSS upload path, save both formats after upload
text
oss:// format ⇄ HTTP URL format
oss://my-bucket/videos/test.mp4
⇄
https://my-bucket.oss-cn-shanghai.aliyuncs.com/videos/test.mp4
Conversion Formula:
oss://<bucket>/<path> → https://<bucket>.oss-<region>.aliyuncs.com/<path>text
User provides local video path
│
├─ AskUserQuestion: "Please provide OSS upload path (format: oss://<bucket>/<path>/<filename>.mp4)"
│
├─ User specifies upload path
│ ├─ Check if Bucket exists
│ ├─ Upload file: aliyun oss cp <local_path> <oss_path>
│ ├─ Save oss:// format → for subtitle extraction
│ └─ Save HTTP URL format → for video translation
│
└─ User does not specify path → STOP, user MUST provide upload path
Upload Command:
bash
aliyun oss cp <local_path> oss://<bucket>/<path>/<filename>.mp4
Save both formats after upload:
text
Local: /Users/demo/videos/test.mp4
Uploaded to: oss://my-bucket/videos/test.mp4
├─ oss:// format: oss://my-bucket/videos/test.mp4 (for subtitle extraction)
└─ HTTP URL: https://my-bucket.oss-cn-shanghai.aliyuncs.com/videos/test.mp4 (for video translation)
Strict Requirement: Agent MUST execute in phase order, cannot proceed without passing current phase!
Check ItemCommandPass ConditionFailure HandlingCLI versionaliyun version>= 3.3.1STOP, see cli-installation-guide.mdCredential statusaliyun configure listValid statusSTOP, guide configurationPlugin installationaliyun configure set --auto-plugin-install trueSetAuto-set
HARD-GATE: Cannot proceed with any subsequent operations without passing!
text
AskUserQuestion: "Do you need subtitle translation (translate subtitles only) or speech translation (translate subtitles + replace voiceover)?"
┌─ Subtitle translation → NeedSpeechTranslate: false
└─ Speech translation → NeedSpeechTranslate: true
⚠️ No reply received → STOP, cannot proceed!
DO NOT infer translation mode from input type!
text
AskUserQuestion: "Do you need to erase original subtitles from the video? Do you need to burn-in translated subtitles?"
⚠️ No reply received → STOP, cannot proceed!
Parameter Mapping:
FeatureParameterValueErase original subtitlesDetextArea``"Auto" / coordinates / not set (no erasure)Burn-in new subtitlesSubtitleConfigconfig object / not set (no burn-in)
ConditionProcessing MethodUser explicitly specifiesUse user's pathUser does not specifyUse default path and inform user
Default Output Rules:
{source}_translated_{random8}.mp4oss://bucket/videos/demo.mp4 → oss://bucket/videos/demo_translated_a1b2c3d4.mp4DO NOT use shell variables, use Python:
python3 -c "import random; print(''.join(random.choices('abcdefghijkmnpqrstuvwxyz23456789', k=8)))"
Trigger ConditionProcessing MethodUser chooses to review subtitlesBLOCKING, MUST wait for user confirmation of review resultUser does not need reviewNon-blocking, proceed
CRITICAL: After subtitle extraction, MUST output content as-is for user review, DO NOT change format!
Key Points:
- When user inputs local video, MUST first upload to OSS and get HTTP URL
- When user does not provide subtitle, MUST ask if subtitle extraction and review is needed
text
User inputs video
│
├─ Local video?
│ └─ Yes → AskUserQuestion: "Please provide OSS upload path"
│ ├─ User provides path → Upload to OSS → Convert to HTTP URL → Continue
│ └─ User does not provide → STOP
│
├─ oss:// format?
│ └─ Yes → Inform user to convert to HTTP URL format
│
└─ HTTP URL format? → Continue
│
├─ User provides SRT file?
│ ├─ Yes → Input type = with_subtitle
│ │ ├─ Translation mode = speech → 【Scenario 4】 ⚠️ MUST ask CustomSrtType
│ │ └─ Translation mode = subtitle → 【Scenario 3】
│ │
│ └─ No → Input type = only_video ⚠️ MUST ask if review needed
│ │
│ ├─ AskUserQuestion: "Do you need to extract subtitles for review first, or translate directly?"
│ │
│ ├─ Need review → 【Scenario 2】 ⚠️ Phase 4 blocking
│ │
│ └─ Direct translation → 【Scenario 1】 (TextSource=OCR_ASR)
ScenarioNameBlocking PointTextSourceFlow0Local video uploadOSS upload path inquiry-Upload→HTTP URL→Subsequent scenario1Direct translationPhase 1, 2OCR_ASRSubmit translation directly2Subtitle reviewPhase 1, 2, Subtitle review inquiry, Phase 4SubtitleFileExtract subtitle→Review→Translate3Subtitle translation + user subtitlePhase 1, 2SubtitleFileUse user SRT to translate directly4Speech translation + user subtitlePhase 1, 2 + CustomSrtType confirmationSubtitleFileConfirm subtitle language then translate
Scenario 0 (Local video) detailed flow:
- AskUserQuestion: "Please provide OSS upload path (format: oss:////.mp4)"
- After user specifies path, execute
aliyun oss cp <local_path> <oss_path>- Convert to HTTP URL:
https://<bucket>.oss-<region>.aliyuncs.com/<path>/<filename>.mp4- Continue with subsequent scenario flow
Scenario 2 detailed flow:
- Ask for subtitle detection region (roi parameter)
- Call
CaptionExtractionto extract subtitles, input and output use oss:// format- Output subtitle content as-is for user review
- After user confirmation, use reviewed SRT to submit translation
Decision Rules: Clearly define handling for each parameter, DO NOT assume arbitrarily!
ParameterTrigger ConditionHandling MethodDefault ValueProhibited BehaviorNeedSpeechTranslateAlwaysMUST askNoneDO NOT infer from inputNeedFaceTranslateAlwaysFixed valuefalseDO NOT set to trueDetextAreaUser chooses erasureMUST askNoneDO NOT set to Auto arbitrarilySubtitleConfigUser chooses burn-inCan use defaultStandard styleDO NOT skip confirmationTextSourceScenario decidesScenario rulesSee scenario mappingDO NOT choose arbitrarilyCustomSrtTypeScenario 4MUST askNoneDO NOT infer arbitrarilyOutputConfig.MediaURLOutput pathCan use defaultDefault rulesDO NOT use shell variablesJobParams.roiSubtitle extractionMUST ask[[0.5,1],[0,1]]DO NOT set default arbitrarilySourceLanguageUser specifies or inferableCan use defaultAuto detectUse zh for Chinese onlyTargetLanguageUser specifiesCan use defaultenAsk for other languages
TextSource Scenario Mapping:
ScenarioValueDescription1OCR_ASRAuto-detect subtitles2SubtitleFileReviewed SRT3, 4SubtitleFileUser-provided SRT
CustomSrtType Trigger Rules:
ConditionValueCaptionExtraction extractedSourceSrtUser provides subtitle (Scenario 4)MUST ask: SourceSrt / TargetSrt
HARD-GATE: After speech translation fails, DO NOT auto-switch to subtitle translation!
ErrorCodeHandling ActionForbidden.SubscriptionRequiredSee ram-policies.mdInvalidParameterSee api-parameters.mdInputConfig.Subtitle is invalidSee troubleshooting.mdJobFailedRecord JobId, ask user if retry needed
text
Detect empty subtitle entries → Delete empty entries → Renumber → Upload repaired file → Inform user
See troubleshooting.md for details.
IMPORTANT: Before submitting API, MUST reference api-parameters.md to confirm parameter format!
See cli-commands.md for details.
Core Commands:
bash
# Register media asset
aliyun ice register-media-info --input-url "oss://<bucket>/<object>" --media-type video --user-agent AlibabaCloud-Agent-Skills
# Submit subtitle extraction (use OSS path)
aliyun ice submit-iproduction-job \
--function-name CaptionExtraction \
--input "Media=oss://<bucket>/<object> Type=OSS" \
--biz-output "Media=oss://<bucket>/<output>.srt Type=OSS" \
--job-params '{"lang":"ch","roi":[[0.5,1],[0,1]]}' \
--force \
--user-agent AlibabaCloud-Agent-Skills
# Submit video translation
aliyun ice submit-video-translation-job \
--user-agent AlibabaCloud-Agent-Skills
CLI Format Key Points:
- Subtitle extraction uses command name
submit-iproduction-job(lowercase,-separator)--inputand--biz-outputformat: space-separated string"Media=... Type=OSS", NOT JSON--job-paramsformat: JSON string- MUST add
--forceto skip plugin parameter validation- All ICE commands MUST add
--user-agent AlibabaCloud-Agent-Skills
DocumentContentworkflow-details.mdDetailed execution flow for 4 scenarioscli-commands.mdCLI command template librarytroubleshooting.mdError handling detailsapi-parameters.mdComplete API parameter documentationram-policies.mdRAM permission requirementscli-installation-guide.mdCLI installation guide
--user-agent AlibabaCloud-Agent-Skillsoss:// formatNeedFaceTranslate MUST be falseSpeechTranslate and SubtitleTranslate are mutually exclusiveInputConfig.Subtitle MUST use HTTPS format, DO NOT use oss://SpeechTranslate.CustomSrtTypeMandatory: MUST continuously poll task status until completion (
State=Finished) or failure (State=Failed), DO NOT exit early!
Task TypeQuery CommandIntervalTimeoutSubtitle extractionQueryIProductionJob30 seconds5 minutesVideo translationget-smart-handle-job30 seconds30 minutes
Polling Logic:
text
Loop polling until:
- State == "Finished" → Return result
- State == "Failed" → Report error
- Exceeds 30 minutes → Report TimeoutError
Prohibited: Return after single query / Skip polling and return JobId directly
Time Reference (3-minute video):
bash
# Get media asset info
aliyun ice get-media-info --media-id "<MediaId>"
# Generate signed URL (for private Bucket)
aliyun oss sign oss://<bucket>/<object> --timeout 3600
End of Document