Loading...
Loading...
Alibaba Cloud Media Processing Service (MPS) one-stop video processing skill. Use when users need video processing, transcoding, snapshot generation, content moderation, or video upload. For video distribution scenarios, complete video upload, snapshot, multi-resolution transcoding, and content moderation in a single workflow for efficient standardized video asset production.
npx skill4agent add aliyun/alibabacloud-aiops-skills alibabacloud-video-forge# Method 1: Use end-to-end workflow script (Recommended)
python scripts/video_workflow.py --input /path/to/video.mp4
# Method 2: Check environment first
python scripts/health_check.py
# Method 3: Execute steps manually
python scripts/oss_upload.py --local-file video.mp4 --oss-key input/video.mp4
python scripts/mps_transcode.py --oss-object input/video.mp4 --preset multi
python scripts/mps_audit.py --oss-object input/video.mp4python scripts/video_workflow.py \
--input my_video.mov \
--preset 720p \
--generate-cover \
--scenes porn terrorism adpython scripts/mps_audit.py --oss-object /input/user_uploaded.mp4python scripts/mps_transcode.py \
--oss-object /input/course_video.mp4 \
--preset multi \
--output-prefix output/course_2024/OSS Bucket + MPS Pipeline + Transcoding Templates + Moderation ServicePre-check: Aliyun CLI >= 3.3.1 required Runto verify >= 3.3.1. If not installed, seealiyun version. Then [MUST] runreferences/cli-installation-guide.mdto enable automatic plugin installation.aliyun configure set --auto-plugin-install true
Pre-check: Python >= 3.10 required Runto verify.python3 --version
Pre-check: Alibaba Cloud Credentials RequiredRunto check credential status. If no valid profile, configure viaaliyun configure list. See references/security-guidelines.md for credential security rules.aliyun configure
ALIBABA_CLOUD_REGIONALIBABA_CLOUD_OSS_BUCKETALIBABA_CLOUD_OSS_ENDPOINTALIBABA_CLOUD_MPS_PIPELINE_IDSecurity Note: Credentials are managed via the Alibaba Cloud default credential chain. Configure credentials usingcommand. NEVER handle AK/SK directly in scripts or commands.aliyun configure
Runto verify. Some scripts may fail with older Python versions.python3 --version
[MUST] RAM Permission Pre-check: Verify that the current user has the following RAM permissions before execution. Seefor complete permission list and details.references/ram-policies.md
[MUST] Permission Failure Handling: When any command or API call fails due to permission errors at any point during execution, follow this process:
- Read
to get the full list of permissions required by this SKILLreferences/ram-policies.md- Use
skill to guide the user through requesting the necessary permissionsram-permission-diagnose- Pause and wait until the user confirms that the required permissions have been granted
IMPORTANT: Parameter Confirmation — Before executing any command or API call, ALL user-customizable parameters (e.g., input video path, output bucket, template ID, etc.) MUST be confirmed with the user. Do NOT assume or use default values without explicit user approval.
| Parameter | Required/Optional | Description | Default |
|---|---|---|---|
| input-url | Required | Input video URL or local path | - |
| output-bucket | Optional | Output OSS Bucket | Environment variable value |
| output-path | Optional | Output path prefix | output/ |
| template-id | Optional | Transcoding template ID | System preset template |
| resolutions | Optional | Transcoding resolution list | 720p,1080p |
| audit | Optional | Whether to perform content moderation | true |
| pipeline-id | Optional | MPS Pipeline ID | Auto-select |
# Method 1: Set environment variable (highest priority)
export ALIBABA_CLOUD_MPS_PIPELINE_ID="your-pipeline-id"
# Method 2: Command line parameter
python scripts/mps_transcode.py --oss-object /input/video.mp4 --pipeline-id your-pipeline-id
# Method 3: Use script auto-selection
export ALIBABA_CLOUD_MPS_PIPELINE_ID=$(python scripts/mps_pipeline.py --select)source .venv/bin/activate
python scripts/oss_upload.py --local-file /path/to/video.mp4 --oss-key input/video.mp4python scripts/mps_mediainfo.py --oss-object /input/video.mp4python scripts/mps_snapshot.py --oss-object /input/video.mp4 --mode normal --time 5000# Adaptive mode: Auto-detect source video resolution, select best quality, use Narrowband HD template
python scripts/mps_transcode.py --oss-object /input/video.mp4
# Or manually specify multi-stream transcoding
python scripts/mps_transcode.py \
--oss-object /input/video.mp4 \
--preset multipython scripts/mps_audit.py --oss-object /input/video.mp4python scripts/poll_task.py --job-id <job-id-from-step-4> --job-type transcode --region cn-shanghai# 1. Activate virtual environment
source .venv/bin/activate
# 2. Upload video
python scripts/oss_upload.py --local-file ./my_video.mp4 --oss-key input/my_video.mp4
# 3. Get media info
python scripts/mps_mediainfo.py --oss-object /input/my_video.mp4
# 4. Cover generation (snapshot at 5 seconds)
python scripts/mps_snapshot.py --oss-object /input/my_video.mp4 --mode normal --time 5000
# 5. Submit transcoding job (adaptive mode: auto-select best resolution)
python scripts/mps_transcode.py \
--oss-object /input/my_video.mp4
# Save the returned job-id
# 6. Poll transcoding job status
python scripts/poll_task.py --job-id <job-id> --job-type transcode --region cn-shanghai --interval 10
# 7. Content moderation
python scripts/mps_audit.py --oss-object /input/my_video.mp4
# 8. Download processed video to local
python scripts/oss_download.py --oss-key output/transcode/transcoded.mp4 --local-file ./output_video.mp4source .venv/bin/activate
python scripts/mps_transcode.py \
--oss-object /input/video.mp4 \
--preset 1080p \
--template-id "your-template-id"source .venv/bin/activate
python scripts/mps_audit.py \
--oss-object /input/video.mp4 \
--scenes porn terrorism adoss_download.pyoss_download.py--sign-url# Verify transcoding success
python scripts/poll_task.py --job-id <job-id> --job-type transcode --region cn-shanghai
# Expected output: Status: Success
# Verify moderation result
python scripts/mps_audit.py --query-job-id <audit-job-id>
# Expected output: Moderation passed, no violations# Delete single file
python scripts/oss_delete.py --oss-key output/transcode/video.mp4
# Delete all files under directory (recursive delete)
python scripts/oss_delete.py --prefix output/ --recursive
# Force delete (skip confirmation, for script automation)
python scripts/oss_delete.py --oss-key output/video.mp4 --force
# Preview mode (view files to be deleted without actually deleting)
python scripts/oss_delete.py --prefix output/ --recursive --dry-runNote: Delete operations are irreversible. Confirm before executing. Useto preview first.--dry-run
| Script | Description |
|---|---|
| Environment variable loader, auto-scan and load Alibaba Cloud credentials |
| MPS async task poller, query task status |
| Upload local file to OSS |
| Download file from OSS to local |
| List files in OSS Bucket |
| Delete OSS files or directories (supports recursive delete) |
| Get media file info (resolution, bitrate, duration, etc.) |
| Snapshot and sprite sheet generation (supports normal/sprite mode) |
| Video transcoding (supports adaptive Narrowband HD, multi-resolution presets, custom parameters) |
| Content safety moderation (supports multiple moderation scenarios) |
| Pipeline list query and auto-selection (get Pipeline ID) |
python scripts/load_env.py --check-onlypoll_task.py| Document | Description |
|---|---|
| references/ram-policies.md | Complete RAM permission policy list |
| references/params.md | Script parameter documentation |
| references/scripts-detail.md | Detailed script usage examples |
| references/verification-method.md | Success verification methods |
| references/related-commands.md | Related CLI commands |
| references/cli-installation-guide.md | Aliyun CLI installation guide |
| references/acceptance-criteria.md | Testing acceptance criteria |
Important: If usingCLI commands, all commands MUST include thealiyunparameter. Example:--user-agent AlibabaCloud-Agent-Skillsaliyun mts search-pipeline --PageNumber 1 --PageSize 10 --user-agent AlibabaCloud-Agent-Skills