One-stop video processing through Alibaba Cloud Media Processing Service (MPS), including cover generation, multi-resolution transcoding, content moderation, and more.
Pre-check: Aliyun CLI >= 3.3.3 required Run
aliyun versionto verify >= 3.3.3. If not installed or version too low, runcurl -fsSL https://aliyuncli.alicdn.com/setup.sh | bashto update, or seereferences/cli-installation-guide.mdfor installation instructions.
Pre-check: Aliyun CLI plugin update required [MUST] run
aliyun configure set --auto-plugin-install trueto enable automatic plugin installation. [MUST] runaliyun plugin updateto ensure that any existing plugins are always up-to-date.
Pre-check: AI-Mode Configuration required [MUST] Before using aliyun CLI commands, configure AI-Mode:
Pre-check: Python >= 3.10 required Run
python3 --versionto verify.
Pre-check: Alibaba Cloud Credentials Required
Run
aliyun configure listto check credential status. If no valid profile, configure viaaliyun configure. See references/security-guidelines.md for credential security rules.
Easiest Way - One-click video processing:
bash
# 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.mp4
bash
python scripts/video_workflow.py \
--input my_video.mov \
--preset 720p \
--generate-cover \
--scenes porn terrorism ad
bash
python scripts/mps_audit.py --oss-object /input/user_uploaded.mp4
bash
python scripts/mps_transcode.py \
--oss-object /input/course_video.mp4 \
--preset multi \
--output-prefix output/course_2024/
This skill supports video distribution scenarios:
text
OSS Bucket + MPS Pipeline + Transcoding Templates + Moderation Service
Components:
Target Users: Video platforms, content creators, corporate training, education platforms
See references/capability-overview.md for detailed feature tree and automatic pipeline management.
Required environment variables:
ALIBABA_CLOUD_REGION - Service region (default: cn-shanghai)ALIBABA_CLOUD_OSS_BUCKET - OSS Bucket nameALIBABA_CLOUD_OSS_ENDPOINT - OSS endpointALIBABA_CLOUD_MPS_PIPELINE_ID - MPS Pipeline ID (optional, auto-selected if not set)Security Note: Credentials are managed via the Alibaba Cloud default credential chain. Configure credentials using
aliyun configurecommand. NEVER handle AK/SK directly in scripts or commands.
See references/security-guidelines.md for complete security guidelines and credential management best practices.
See references/sdk-installation.md for detailed installation guide and troubleshooting.
Run
python3 --versionto verify. Some scripts may fail with older Python versions.
[MUST] RAM Permission Pre-check: Verify that the current user has the following RAM permissions before execution. See
references/ram-policies.mdfor complete permission list and details.
[MUST] Permission Failure Handling: When any command or API call fails due to permission errors at any point during execution, follow this process:
- Read
references/ram-policies.mdto get the full list of permissions required by this SKILL- Use
ram-permission-diagnoseskill to guide the user through requesting the necessary permissions- 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.
ParameterRequired/OptionalDescriptionDefaultinput-urlRequiredInput video URL or local path-output-bucketOptionalOutput OSS BucketEnvironment variable valueoutput-pathOptionalOutput path prefixoutput/template-idOptionalTranscoding template IDSystem preset templateresolutionsOptionalTranscoding resolution list720p,1080pauditOptionalWhether to perform content moderationtruepipeline-idOptionalMPS Pipeline IDAuto-select
Complete workflow: User provides video → Upload to OSS → Media info probe → Cover generation (snapshot) → Multi-resolution transcoding → Content moderation → Summary results (with download links)
This skill supports automatic pipeline management, typically no manual Pipeline ID configuration needed. Scripts automatically select appropriate pipelines based on task type.
To manually specify:
bash
# 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)
bash
source .venv/bin/activate
python scripts/oss_upload.py --local-file /path/to/video.mp4 --oss-key input/video.mp4
bash
python scripts/mps_mediainfo.py --oss-object /input/video.mp4
Use snapshot function to generate video cover at specified time:
bash
python scripts/mps_snapshot.py --oss-object /input/video.mp4 --mode normal --time 5000
bash
# 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 multi
bash
python scripts/mps_audit.py --oss-object /input/video.mp4
bash
python scripts/poll_task.py --job-id <job-id-from-step-4> --job-type transcode --region cn-shanghai
bash
# 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.mp4
Execute transcoding only, without snapshot and moderation:
bash
source .venv/bin/activate
python scripts/mps_transcode.py \
--oss-object /input/video.mp4 \
--preset 1080p \
--template-id "your-template-id"
Execute content moderation only:
bash
source .venv/bin/activate
python scripts/mps_audit.py \
--oss-object /input/video.mp4 \
--scenes porn terrorism ad
After video processing, check results:
oss_download.py)Notes on Artifact Retrieval:
oss_download.py to download results locally--sign-url parameter to generate temporary pre-signed URLbash
# 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
See references/troubleshooting.md for comprehensive troubleshooting guide.
Intermediate files and output files from this skill are stored in OSS. To clean up:
bash
# 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-run
Note: Delete operations are irreversible. Confirm before executing. Use
--dry-runto preview first.
ScriptDescriptionscripts/load_env.pyEnvironment variable loader, auto-scan and load Alibaba Cloud credentialsscripts/poll_task.pyMPS async task poller, query task statusscripts/oss_upload.pyUpload local file to OSSscripts/oss_download.pyDownload file from OSS to localscripts/oss_list.pyList files in OSS Bucketscripts/oss_delete.pyDelete OSS files or directories (supports recursive delete)scripts/mps_mediainfo.pyGet media file info (resolution, bitrate, duration, etc.)scripts/mps_snapshot.pySnapshot and sprite sheet generation (supports normal/sprite mode)scripts/mps_transcode.pyVideo transcoding (supports adaptive Narrowband HD, multi-resolution presets, custom parameters)scripts/mps_audit.pyContent safety moderation (supports multiple moderation scenarios)scripts/mps_pipeline.pyPipeline list query and auto-selection (get Pipeline ID)
python scripts/load_env.py --check-only at the start of each sessionpoll_task.py to auto-poll status after submitting jobsDocumentDescriptionreferences/ram-policies.mdComplete RAM permission policy listreferences/params.mdScript parameter documentationreferences/scripts-detail.mdDetailed script usage examplesreferences/verification-method.mdSuccess verification methodsreferences/related-commands.mdRelated CLI commandsreferences/cli-installation-guide.mdAliyun CLI installation guidereferences/acceptance-criteria.mdTesting acceptance criteria
[MUST] AI-Mode Setup for Aliyun CLI — Before using
aliyunCLI commands, you must configure AI-Mode to enable proper tracking and plugin management.
Enable AI-Mode for enhanced functionality:
bash
aliyun configure ai-mode enable
Set the User-Agent for proper skill identification:
bash
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-video-forge"
Disable AI-Mode when no longer needed:
bash
aliyun configure ai-mode disable
Note: AI-Mode must be enabled before executing any
aliyunCLI commands to ensure proper functionality tracking and plugin compatibility.
Important: User-Agent is automatically applied via AI-Mode configuration. After running
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-video-forge", all subsequentaliyunCLI commands will include the correct User-Agent automatically. No need to add--user-agentparameter to each command.