alibabacloud-bailian-videoanalysis

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Bailian Video Analysis

百炼视频分析

This skill provides video analysis functionality based on Alibaba Cloud Bailian Video Analysis Light Application. It uses the Bailian (QuanMiaoLightApp) API for intelligent video comprehension, including shot analysis, ASR transcription, title generation, caption extraction, and mind mapping.
Architecture:
CLI (Credential Chain) + OSS (File Storage) + Bailian Workspace + Quanmiao Video Analysis Service + Python SDK Scripts

本Skill基于阿里云百炼视频分析轻应用提供视频分析功能,通过百炼(QuanMiaoLightApp)API实现智能视频理解,包括镜头分析、ASR转写、标题生成、字幕提取和思维导图生成等。
架构
CLI(凭证链) + OSS(文件存储) + 百炼工作区 + Quanmiao视频分析服务 + Python SDK脚本

Output Language Policy

输出语言规则

Detection Priority: User input language → Environment language → Default: Chinese (中文)
Apply to: All user-facing messages, summaries, error explanations, and interactive prompts.
Keep original language: Code snippets, API responses, file paths, technical identifiers, HTTP status codes.

检测优先级:用户输入语言 → 环境语言 → 默认:中文
适用范围:所有面向用户的消息、摘要、错误说明和交互式提示。
保留原语言:代码片段、API响应、文件路径、技术标识符、HTTP状态码。

Installation

安装

1. Python Dependencies

1. Python依赖

bash
python -m pip install -r scripts/requirements.txt
bash
python -m pip install -r scripts/requirements.txt

On some systems, use pyhon3 instead of python

在部分系统中,请使用python3替代python

undefined
undefined

2. Alibaba Cloud CLI

2. 阿里云CLI

Pre-check: Aliyun CLI >= 3.3.1 required Run
aliyun version
to verify >= 3.3.1. If not installed or version too low, see
references/cli-installation-guide.md
for installation instructions. Then [MUST] run
aliyun configure set --auto-plugin-install true
to enable automatic plugin installation.
AI-Mode Configuration for aliyun CLI
When using the aliyun CLI in this skill, you MUST configure AI-Mode settings:
bash
# Enable AI-Mode (required before using CLI commands)
aliyun configure ai-mode enable

# Set User-Agent for tracking (required)
aliyun configure ai-mode set-user-agent AlibabaCloud-Agent-Skills/alibabacloud-bailian-videoanalysis

# Update plugins to latest versions (recommended)
aliyun plugin update
Note: After completing your tasks, you can disable AI-Mode:
bash
aliyun configure ai-mode disable
预检查:要求Aliyun CLI >= 3.3.1 运行
aliyun version
验证版本是否≥3.3.1。若未安装或版本过低,请查看
references/cli-installation-guide.md
获取安装说明。 然后**[必须]**运行
aliyun configure set --auto-plugin-install true
启用自动插件安装。
Aliyun CLI的AI模式配置
在本Skill中使用Aliyun CLI时,必须配置AI模式设置:
bash
# 启用AI模式(使用CLI命令前必须执行)
aliyun configure ai-mode enable

# 设置用于追踪的User-Agent(必须)
aliyun configure ai-mode set-user-agent AlibabaCloud-Agent-Skills/alibabacloud-bailian-videoanalysis

# 更新插件至最新版本(推荐)
aliyun plugin update
注意:完成任务后,可禁用AI模式:
bash
aliyun configure ai-mode disable

3. Important Prerequisite: Activate Bailian and Video Analysis Service

3. 重要前置条件:激活百炼及视频分析服务

Before using this skill, you must first activate the Video Analysis service in the Alibaba Cloud Bailian console!
  1. Visit Bailian Video_Analysis page
  2. Click the "Paid activation" button
  3. Confirm activation and wait for the service to take effect (usually 1-2 minutes)
使用本Skill前,必须先在阿里云百炼控制台激活视频分析服务!
  1. 访问百炼视频分析页面
  2. 点击**"付费激活"**按钮
  3. 确认激活并等待服务生效(通常1-2分钟)

4. Important Prerequisite: Guide Users to Grant Permissions in Alibaba Cloud Access Control and Bailian

4. 重要前置条件:引导用户在阿里云访问控制和百炼中授予权限

Before using this skill, you must grant the following permissions to the previously configured AK, otherwise calls will fail and may cause 403 errors
使用本Skill前,必须为之前配置的AK授予以下权限,否则调用会失败并可能导致403错误

1) RAM Permission Grant

1) RAM权限授予

See references/ram-policies.md for the full list of required RAM permissions and authorization instructions.
[MUST] Permission Failure Handling: When any command or API call fails due to permission errors at any point during execution, follow this process:
  1. Read
    references/ram-policies.md
    to get the full list of permissions required by this SKILL
  2. Use
    ram-permission-diagnose
    skill to guide the user through requesting the necessary permissions
  3. Pause and wait until the user confirms that the required permissions have been granted
查看references/ram-policies.md获取完整的必填RAM权限列表及授权说明。
[必须] 权限失败处理:在执行过程中,若任何命令或API调用因权限错误失败,请遵循以下流程:
  1. 阅读
    references/ram-policies.md
    获取本SKILL所需的完整权限列表
  2. 使用
    ram-permission-diagnose
    Skill引导用户申请必要权限
  3. 暂停操作,等待用户确认所需权限已授予

2) Bailian Workspace Permission Grant

2) 百炼工作区权限授予

  1. Visit Alibaba Cloud Bailian Permission Management
  2. If the RAM user corresponding to the AK does not exist, click "Add User" in the upper right corner of the page, select the corresponding RAM user and click confirm to add.
  3. There is a 30s effective time after configuration, please wait patiently for a while.

  1. 访问阿里云百炼权限管理
  2. 若AK对应的RAM用户不存在,点击页面右上角的**"添加用户"**,选择对应的RAM用户并点击确认添加。
  3. 配置后有30秒生效时间,请耐心等待。

Authentication

身份验证

Pre-check: Alibaba Cloud Credentials Required
Security Rules:
  • NEVER read, echo, or print AK/SK values (e.g.,
    echo $ALIBABA_CLOUD_ACCESS_KEY_ID
    is FORBIDDEN)
  • NEVER ask the user to input AK/SK directly in the conversation or command line
  • NEVER use
    aliyun configure set
    with literal credential values
  • ONLY use
    aliyun configure list
    to check credential status
bash
aliyun configure list
Check the output for a valid profile (AK, STS, or OAuth identity).
If no valid profile exists, STOP here.
  1. Obtain credentials from Alibaba Cloud Console
  2. Configure credentials outside of this session (via
    aliyun configure
    in terminal or environment variables in shell profile)
  3. Return and re-run after
    aliyun configure list
    shows a valid profile

预检查:需阿里云凭证
安全规则
  • 禁止读取、回显或打印AK/SK值(例如
    echo $ALIBABA_CLOUD_ACCESS_KEY_ID
    是不允许的)
  • 禁止要求用户在对话或命令行中直接输入AK/SK
  • 禁止使用
    aliyun configure set
    传入明文凭证值
  • 仅可使用
    aliyun configure list
    检查凭证状态
bash
aliyun configure list
检查输出中是否有有效的配置文件(AK、STS或OAuth身份)。
若无有效配置文件,请在此处停止
  1. 阿里云控制台获取凭证
  2. 在本次会话外配置凭证(通过终端中的
    aliyun configure
    或Shell配置文件中的环境变量)
  3. aliyun configure list
    显示有效配置文件后,返回并重新运行

Parameter Confirmation

参数确认

IMPORTANT: Parameter Confirmation — Before executing any command or API call, confirm user-provided or customizable parameters (video source, OSS bucket, oss object key). System-auto-resolved parameters (workspace_id, default OSS bucket) do NOT require explicit confirmation unless the user wants to override them.
ParameterTypeDescriptionDefault / Resolution
video_source
RequiredLocal file path OR downloadable video URLN/A (user must provide)
workspace_id
Auto-resolvedBailian workspace IDAuto-detected(user may override)
ossBucket
OptionalOSS bucket name for file uploadAuto-detect from first available bucket; user may specify (e.g.
--ossBucket my-bucket
)
ossObjectKey
OptionalOSS object key for the uploaded file
/temp/quanmiao/YYYYMMDD/filename
expireSeconds
OptionalTemporary URL expiration time (seconds)
14400
(4 hours)
Confirmation Workflow:
  1. Auto-detection first: The skill will auto-detect
    workspace_id
    and
    ossBucket
    when possible
  2. User override: If user wants to specify custom values, confirm before using
  3. Local vs URL: Confirm whether user is providing a local file path or a public URL

重要提示:参数确认 — 在执行任何命令或API调用前,请确认用户提供的或可自定义的参数(视频源、OSS存储桶、OSS对象键)。系统自动解析的参数(workspace_id、默认OSS存储桶)无需显式确认,除非用户想要覆盖。
参数名称类型描述默认值/解析方式
video_source
必填本地文件路径或可下载的视频URL无(用户必须提供)
workspace_id
自动解析百炼工作区ID自动检测(用户可覆盖)
ossBucket
可选用于文件上传的OSS存储桶名称自动检测第一个可用存储桶;用户可指定(例如
--ossBucket my-bucket
ossObjectKey
可选上传文件的OSS对象键
/temp/quanmiao/YYYYMMDD/filename
expireSeconds
可选临时URL过期时间(秒)
14400
(4小时)
确认流程
  1. 先自动检测:Skill会尽可能自动检测
    workspace_id
    ossBucket
  2. 用户覆盖:若用户想要指定自定义值,使用前需确认
  3. 本地文件 vs URL:确认用户提供的是本地文件路径还是公共URL

Core Workflow

核心工作流程

⚠️ CRITICAL: Cloud API Mandatory — This skill MUST use Bailian (QuanMiaoLightApp) API for video analysis. Local tools (ffmpeg, whisper, OpenCV, ffprobe, mediainfo, etc.) are FORBIDDEN. If API calls fail due to credentials or permissions, follow Permission Failure Handling process — DO NOT fall back to local analysis.
⚠️ 关键要求:必须使用云API — 本Skill必须使用百炼(QuanMiaoLightApp)API进行视频分析。禁止使用本地工具(ffmpeg、whisper、OpenCV、ffprobe、mediainfo等)。若因凭证或权限问题导致API调用失败,请遵循权限失败处理流程 — 切勿 fallback 到本地分析。

Step 1: Environment Check

步骤1:环境检查

Run
python scripts/check_env.py
to verify:
  • Python packages are installed
  • Credentials are configured via default credential chain
If check_env.py fails or returns {"ready": false}:
  • Packages missing → Run
    python -m pip install -r scripts/requirements.txt
  • Credentials missing or invalid → Follow Permission Failure Handling process:
    1. Read
      references/ram-policies.md
      to get required permissions
    2. Use
      ram-permission-diagnose
      skill to guide user through permission request
    3. Wait for user confirmation before proceeding
    4. DO NOT proceed with local analysis tools
Expected output:
{"ready": true}
indicates environment is properly configured.
运行
python scripts/check_env.py
验证:
  • Python包已安装
  • 凭证已通过默认凭证链配置
若check_env.py失败或返回{"ready": false}
  • 缺少包 → 运行
    python -m pip install -r scripts/requirements.txt
  • 凭证缺失或无效 → 遵循权限失败处理流程
    1. 阅读
      references/ram-policies.md
      获取所需权限
    2. 使用
      ram-permission-diagnose
      Skill引导用户申请权限
    3. 等待用户确认后再继续
    4. 切勿使用本地分析工具
预期输出
{"ready": true}
表示环境已正确配置。

Step 2: Get Workspace ID

步骤2:获取工作区ID

Do not ask the user for workspace_id upfront. Always auto-fetch available workspaces first:
bash
aliyun modelstudio list-workspaces --user-agent AlibabaCloud-Agent-Skills/alibabacloud-bailian-videoanalysis
Workspace selection logic:
  • Single workspace returned → use it directly, no need to prompt the user
  • Multiple workspaces returned → display a numbered list and proceed with the following:
    1. Default behavior: Use the first workspace in the list automatically to avoid unnecessary interaction
    2. User explicitly requests selection: If the user says "let me choose workspace", "show me the workspace list", or similar, present the full list and ask them to pick one
  • No workspaces returned → inform the user that no Bailian workspace is available, guide them to create one at the Bailian Console
  • Record user selection in the session to avoid repeated inquiries
不要直接向用户索要workspace_id。始终先自动获取可用工作区:
bash
aliyun modelstudio list-workspaces --user-agent AlibabaCloud-Agent-Skills/alibabacloud-bailian-videoanalysis
工作区选择逻辑
  • 返回单个工作区 → 直接使用,无需提示用户
  • 返回多个工作区 → 显示编号列表并按以下方式处理:
    1. 默认行为:自动使用列表中的第一个工作区,避免不必要的交互
    2. 用户明确要求选择:若用户说"让我选择工作区"、"显示工作区列表"或类似内容,展示完整列表并让用户选择
  • 未返回工作区 → 告知用户无可用百炼工作区,引导用户在百炼控制台创建
  • 记录用户选择在会话中,避免重复询问

Step 3: Upload File(video_source) to OSS

步骤3:上传文件(video_source)至OSS

Based on the input resource type from Input Resource Validation:
Case A: User provided a downloadable URL → Verify URL accessibility: Test if the URL is downloadable using appropriate method for your OS → Skip this step. Use the video_source as
file_url
in Step 4.
Case B: User provided a local file path → Auto-detects OSS bucket、Upload local file to OSS and get a temporary URL(file_url) for Step 4:
  • (1) Auto-detect or use user-specified OSS bucket:
    • If user specifies
      --ossBucket <bucket_name>
      , attempt to use that bucket
    • If the specified bucket returns 403 AccessDenied or BucketAlreadyExists: DO NOT switch to another bucket automatically. Instead:
      1. Inform the user that the specified bucket is not accessible
      2. Follow the Permission Failure Handling process in RAM Policy section
      3. Guide user to grant OSS bucket access permissions or specify an alternative bucket they own
      4. Wait for user confirmation before proceeding
    • If no bucket specified, auto-detect from first available bucket
bash
aliyun ossutil ls --user-agent AlibabaCloud-Agent-Skills/alibabacloud-bailian-videoanalysis
  • (2) Upload file to OSS: Generate a unique key(oss_object_key) for the uploaded file.
IMPORTANT - Upload Path Restriction:
  • Default path: MUST use
    /temp/quanmiao/YYYYMMDD/filename
    format (auto-generated with current date)
  • Custom path: ONLY if user explicitly specifies a custom oss_object_key, otherwise always use default path
  • Security rule: NEVER upload files outside
    /temp/quanmiao/
    prefix unless user explicitly requests it
bash
aliyun ossutil cp <video_source> oss://{oss_bucket}/{oss_object_key} --user-agent AlibabaCloud-Agent-Skills/alibabacloud-bailian-videoanalysis --region {oss_region}
  • (3) Generate temporary URL: Generate a temporary URL for the uploaded file using the
    ossutil sign
    command.
    • --expireSeconds
      : Default 14400s (4 hours), confirm if different value needed
bash
aliyun ossutil sign oss://{oss_bucket}/{oss_object_key} --expires-duration {expire_seconds} --user-agent AlibabaCloud-Agent-Skills/alibabacloud-bailian-videoanalysis --region {oss_region}
  • (4) Verify URL accessibility: Test if the generated URL is downloadable using appropriate method for your OS
    • Note: Prefer GET request over HEAD request for verification, as some OSS signature versions may reject HEAD requests.
Recommended validation URL downloadable methods:
  • macOS/Linux:
    curl -L --connect-timeout 10 --max-time 30 -o /dev/null -w "%{http_code}" <file_url>
    (returns HTTP status code)
  • Windows:
    Invoke-WebRequest -Uri <file_url> -Method Head -TimeoutSec 30
    (PowerShell)
Validation criteria:
  • HTTP 200 → URL is valid and accessible, proceed to Step 4
  • HTTP 403/404 → URL expired or invalid, regenerate with
    ossutil sign
  • Other errors → Check network or OSS permissions
根据输入资源验证的结果,分情况处理:
情况A:用户提供可下载的URL → 验证URL可访问性:使用适合您操作系统的方法测试URL是否可下载 → 跳过本步骤。在步骤4中直接将video_source作为
file_url
使用。
情况B:用户提供本地文件路径 → 自动检测OSS存储桶、将本地文件上传至OSS并获取临时URL(file_url)用于步骤4:
  • (1) 自动检测或使用用户指定的OSS存储桶
    • 若用户指定
      --ossBucket <bucket_name>
      ,尝试使用该存储桶
    • 若指定存储桶返回403 AccessDenied或BucketAlreadyExists:请勿自动切换到其他存储桶。而是:
      1. 告知用户指定的存储桶无法访问
      2. 遵循RAM策略部分的权限失败处理流程
      3. 引导用户授予OSS存储桶访问权限或指定其拥有的其他存储桶
      4. 等待用户确认后再继续
    • 若未指定存储桶,自动检测第一个可用存储桶
bash
aliyun ossutil ls --user-agent AlibabaCloud-Agent-Skills/alibabacloud-bailian-videoanalysis
  • (2) 上传文件至OSS:为上传的文件生成唯一的键(oss_object_key)。
重要提示 - 上传路径限制
  • 默认路径:必须使用
    /temp/quanmiao/YYYYMMDD/filename
    格式(自动生成当前日期)
  • 自定义路径:仅当用户明确指定自定义oss_object_key时使用,否则始终使用默认路径
  • 安全规则:除非用户明确要求,否则切勿将文件上传到
    /temp/quanmiao/
    前缀以外的路径
bash
aliyun ossutil cp <video_source> oss://{oss_bucket}/{oss_object_key} --user-agent AlibabaCloud-Agent-Skills/alibabacloud-bailian-videoanalysis --region {oss_region}
  • (3) 生成临时URL:使用
    ossutil sign
    命令为上传的文件生成临时URL。
    • --expireSeconds
      :默认14400秒(4小时),若需不同值请确认
bash
aliyun ossutil sign oss://{oss_bucket}/{oss_object_key} --expires-duration {expire_seconds} --user-agent AlibabaCloud-Agent-Skills/alibabacloud-bailian-videoanalysis --region {oss_region}
  • (4) 验证URL可访问性:使用适合您操作系统的方法测试生成的URL是否可下载
    • 注意:优先使用GET请求而非HEAD请求进行验证,因为部分OSS签名版本可能拒绝HEAD请求。
推荐的URL可下载性验证方法
  • macOS/Linux
    curl -L --connect-timeout 10 --max-time 30 -o /dev/null -w "%{http_code}" <file_url>
    (返回HTTP状态码)
  • Windows
    Invoke-WebRequest -Uri <file_url> -Method Head -TimeoutSec 30
    (PowerShell)
验证标准
  • HTTP 200 → URL有效且可访问,继续步骤4
  • HTTP 403/404 → URL过期或无效,使用
    ossutil sign
    重新生成
  • 其他错误 → 检查网络或OSS权限

Step 4: Submit Video Analysis Task

步骤4:提交视频分析任务

⚠️ MANDATORY API CALL — You MUST call SubmitVideoAnalysisTask on QuanMiaoLightApp product (version 2024-08-01). Do NOT use videorecog, Mts, or any other product. Do NOT attempt local analysis.
API Selection Checklist — Before calling, verify:
  • ✅ Product: QuanMiaoLightApp (NOT videorecog, NOT Mts)
  • ✅ Version: 2024-08-01
  • ✅ Action: SubmitVideoAnalysisTask
  • ✅ Parameters: workspace_id, file_url
bash
python scripts/quanmiao_submit_videoAnalysis_task.py --workspace_id <workspace_id> --file_url <file_url>
Parameters requiring confirmation:
  • --workspace_id
    : From Step 2 (confirm with user)
  • --file_url
    : From Step 3 upload result or user-provided URL (confirm validity)
Error Handling:
  • If API returns 401 InvalidApiKey or 403 AccessDenied: STOP and follow Permission Failure Handling process
  • Do NOT attempt alternative APIs or local tools
  • Inform user: "Video analysis requires Bailian service activation and proper RAM permissions. Please follow the permission grant guide."
Returns
task_id
for polling.
⚠️ 必须调用API — 必须调用QuanMiaoLightApp产品(版本2024-08-01)的SubmitVideoAnalysisTask。禁止使用videorecog、Mts或其他任何产品。禁止尝试本地分析。
API选择检查清单 — 调用前请验证:
  • ✅ 产品:QuanMiaoLightApp(不是videorecog,不是Mts)
  • ✅ 版本:2024-08-01
  • ✅ 操作:SubmitVideoAnalysisTask
  • ✅ 参数:workspace_id、file_url
bash
python scripts/quanmiao_submit_videoAnalysis_task.py --workspace_id <workspace_id> --file_url <file_url>
需确认的参数
  • --workspace_id
    :来自步骤2(与用户确认)
  • --file_url
    :来自步骤3的上传结果或用户提供的URL(确认有效性)
错误处理
  • 若API返回401 InvalidApiKey或403 AccessDenied:停止并遵循权限失败处理流程
  • 切勿尝试替代API或本地工具
  • 告知用户:"视频分析需要激活百炼服务并配置正确的RAM权限,请遵循权限授予指南操作。"
返回
task_id
用于轮询。

Step 5: Poll for Task Result

步骤5:轮询任务结果

⚠️ MANDATORY API CALL — You MUST poll GetVideoAnalysisTask on QuanMiaoLightApp product (version 2024-08-01) until status is SUCCESSED. Do NOT generate summary from local tools or filename inference.
Video analysis is asynchronous. Poll until completion:
Task Status:
PENDING
RUNNING
SUCCESSED
|
FAILED
|
CANCELED
Variables:
  • result_json_path
    :
    ~/.quanmiao/videoanalysis/<video_filename_without_ext>_<task_id>.json
  • index_file
    :
    ~/.quanmiao/videoanalysis/index.jsonl
Polling Loop:
  1. Wait 10 seconds after submission
  2. Run:
    python scripts/quanmiao_get_videoAnalysis_task_result.py --workspace_id <workspace_id> --task_id <task_id> --save_path <result_json_path>
  3. Check the returned
    status
    field:
    • SUCCESSED
      → Script auto-saves JSON to
      result_json_path
      , append entry to
      index_file
      , display saved locations, then proceed to Step 6
    • FAILED
      or
      CANCELED
      → check error message, inform user, stop
    • PENDING
      or
      RUNNING
      → display any partial results available, wait 10s, repeat from step 2
  4. Max 180 retries (approximately 30 minutes)
When taskStatus = SUCCESSED:
  1. Append to index file (
    index_file
    ):
    json
    {"task_id": "<task_id>", "video_source": "<original_path_or_url>", "workspace_id": "<workspace_id>", "result_file": "<result_json_path>", "timestamp": "<ISO8601>"}
  2. Display saved locations:
✅ Files saved successfully:
- Raw JSON result: <result_json_path>
- Index updated: <index_file>
Parameters requiring confirmation:
  • --workspace_id
    : Same as Step 4 (confirm consistency)
  • --task_id
    : From Step 4 submission result (verify before polling)
⚠️ 必须调用API — 必须轮询QuanMiaoLightApp产品(版本2024-08-01)的GetVideoAnalysisTask,直到状态为SUCCESSED。禁止使用本地工具或文件名推断生成摘要。
视频分析是异步的,需轮询至完成:
任务状态
PENDING
RUNNING
SUCCESSED
|
FAILED
|
CANCELED
变量
  • result_json_path
    ~/.quanmiao/videoanalysis/<video_filename_without_ext>_<task_id>.json
  • index_file
    ~/.quanmiao/videoanalysis/index.jsonl
轮询循环
  1. 提交后等待10秒
  2. 运行:
    python scripts/quanmiao_get_videoAnalysis_task_result.py --workspace_id <workspace_id> --task_id <task_id> --save_path <result_json_path>
  3. 检查返回的
    status
    字段:
    • SUCCESSED
      → 脚本自动将JSON保存至
      result_json_path
      ,将条目追加至
      index_file
      ,显示保存位置,然后继续步骤6
    • FAILED
      CANCELED
      → 检查错误信息,告知用户,停止操作
    • PENDING
      RUNNING
      → 显示可用的部分结果,等待10秒,从步骤2重复
  4. 最多重试180次(约30分钟)
当taskStatus = SUCCESSED时
  1. 追加至索引文件
    index_file
    ):
    json
    {"task_id": "<task_id>", "video_source": "<original_path_or_url>", "workspace_id": "<workspace_id>", "result_file": "<result_json_path>", "timestamp": "<ISO8601>"}
  2. 显示保存位置
✅ 文件保存成功:
- 原始JSON结果:<result_json_path>
- 索引已更新:<index_file>
需确认的参数
  • --workspace_id
    :与步骤4一致(确认一致性)
  • --task_id
    :来自步骤4的提交结果(轮询前验证)

Step 6: Summarize Video Content

步骤6:总结视频内容

CRITICAL: Use the results from Step 5 directly. Do NOT call the API again. Do NOT re-execute any analysis.
Extract data from the SUCCESSED response obtained in Step 5 and summarize according to user requirements.
Case A: If the user has a specific analysis request (e.g., "analyze the speaker's body language", "extract key business insights", "compare two people in the video"), base your answer primarily on:
  • payload.output.videoGenerateResults
    — scene-by-scene analysis, descriptions, interpretations
  • payload.output.videoAnalysisResult.text
    — visual shot analysis, object/person recognition, action detection Combine these fields to construct a targeted answer. Supplement with other fields (captions, mind map, title) as context if relevant.
Case B: If no specific request, use the standard output format: Title → Outline → Summary → Captions → Shot Analysis → Timeline → Token Usage

关键要求:直接使用步骤5的结果。请勿再次调用API。请勿重新执行任何分析。
从步骤5获取的SUCCESSED响应中提取数据,并根据用户需求进行总结。
情况A:用户有特定分析请求(例如"分析演讲者的肢体语言"、"提取关键业务洞察"、"对比视频中的两个人"),主要基于以下内容构建答案:
  • payload.output.videoGenerateResults
    — 逐场景分析、描述、解读
  • payload.output.videoAnalysisResult.text
    — 视觉镜头分析、物体/人物识别、动作检测 结合这些字段构建针对性答案。若相关,可补充其他字段(字幕、思维导图、标题)作为上下文。
情况B:无特定请求,使用标准输出格式:标题 → 大纲 → 摘要 → 字幕 → 镜头分析 → 时间线 → Token使用情况

Important Constraints

重要约束

  • Cloud-only: No local fallbacks (ffmpeg, whisper, etc.). If cloud API fails, follow Permission Failure Handling process.
  • Violation Consequence: Using local tools instead of QuanMiaoLightApp API will result in task failure.
  • Security: Never expose credentials in logs or prompts
  • Permissions: On auth errors, see
    ram-policies.md
  • Caching: Check
    ~/.quanmiao/videoanalysis/index.jsonl
    before re-analyzing same video

  • 仅云服务:无本地 fallback(ffmpeg、whisper等)。若云API失败,请遵循权限失败处理流程。
  • 违规后果:使用本地工具而非QuanMiaoLightApp API将导致任务失败。
  • 安全:切勿在日志或提示中暴露凭证
  • 权限:遇到认证错误,请查看
    ram-policies.md
  • 缓存:重新分析同一视频前,请检查
    ~/.quanmiao/videoanalysis/index.jsonl

Success Verification

成功验证

See references/verification-method.md for step-by-step verification commands and expected outcomes.

查看references/verification-method.md获取分步验证命令及预期结果。

Cleanup

清理

To clean up resources created by this skill:
Delete uploaded OSS objects:
bash
aliyun ossutil rm oss://{oss_bucket}/{oss_object_key} --user-agent AlibabaCloud-Agent-Skills/alibabacloud-bailian-videoanalysis
Cleanup best practices:
  • Confirm bucket name and oss object key before deletion
  • Only delete objects with
    /temp/quanmiao/
    prefix to avoid accidental data loss
  • Cached results at
    ~/.quanmiao/videoanalysis/
    can be kept for future reference or deleted manually

清理本Skill创建的资源:
删除上传的OSS对象
bash
aliyun ossutil rm oss://{oss_bucket}/{oss_object_key} --user-agent AlibabaCloud-Agent-Skills/alibabacloud-bailian-videoanalysis
清理最佳实践
  • 删除前确认存储桶名称和OSS对象键
  • 仅删除带有
    /temp/quanmiao/
    前缀的对象,避免意外数据丢失
  • ~/.quanmiao/videoanalysis/
    下的缓存结果可保留供未来参考或手动删除

Best Practices

最佳实践

  1. Always verify environment first — run
    check_env.py
    before any other operation to catch missing dependencies or credentials early.
  2. Auto-detect workspace_id — always fetch workspaces via
    list-workspaces
    ; default to the first result, but present a selection list when the user explicitly asks to choose.
  3. Use default OSS settings — unless the user specifies a particular bucket, let the script auto-detect the bucket and generate the oss object key.
  4. Display partial results during polling — when task status is
    RUNNING
    , show available results (title, captions) to give the user real-time feedback.
  5. Save complete result for summary — when status becomes
    SUCCESSED
    , use the full result payload directly for Step 6 without re-calling the API.
  6. Respect URL expiration — temporary OSS URLs expire after
    expireSeconds
    (default 14400s); ensure the task is submitted before the URL expires.
  7. Handle permission errors gracefully — follow the Permission Failure Handling process in the RAM Policy section; never improvise credential fixes.

  1. 始终先验证环境 — 在执行任何其他操作前运行
    check_env.py
    ,尽早发现缺失的依赖项或凭证
  2. 自动检测workspace_id — 始终通过
    list-workspaces
    获取工作区;默认使用第一个结果,但当用户明确要求选择时展示选择列表
  3. 使用默认OSS设置 — 除非用户指定特定存储桶,否则让脚本自动检测存储桶并生成OSS对象键
  4. 轮询时显示部分结果 — 当任务状态为
    RUNNING
    时,展示可用结果(标题、字幕),为用户提供实时反馈
  5. 保存完整结果用于总结 — 当状态变为
    SUCCESSED
    时,直接使用完整结果负载进行步骤6,无需重新调用API
  6. 尊重URL过期时间 — 临时OSS URL在
    expireSeconds
    (默认14400秒)后过期;确保在URL过期前提交任务
  7. 优雅处理权限错误 — 遵循RAM策略部分的权限失败处理流程;切勿临时修改凭证

Command Tables

命令表

See references/related-commands.md for the full list of available scripts and their parameters.

查看references/related-commands.md获取完整的可用脚本及其参数列表。

Reference Links

参考链接

ReferencePurpose
references/cli-installation-guide.md
Installing and upgrading Aliyun CLI
references/ram-policies.md
RAM permission checklist and authorization guide
references/acceptance-criteria.md
Acceptance criteria and correct/incorrect usage patterns
references/related-commands.md
Available scripts and CLI command reference
references/verification-method.md
Step-by-step success verification commands

参考文档用途
references/cli-installation-guide.md
安装和升级Aliyun CLI
references/ram-policies.md
RAM权限清单及授权指南
references/acceptance-criteria.md
验收标准及正确/错误使用模式
references/related-commands.md
可用脚本及CLI命令参考
references/verification-method.md
分步成功验证命令

Troubleshooting

故障排除

Common scenarios:
  • Permission denied → See ram-policies.md
  • CLI not found → See cli-installation-guide.md
  • Workspace not found → Create at Bailian Console
  • Upload failed → Check OSS bucket permissions
  • Task timeout → Video too large or network issues

常见场景
  • 权限被拒绝 → 查看ram-policies.md
  • 未找到CLI → 查看cli-installation-guide.md
  • 未找到工作区 → 在百炼控制台创建
  • 上传失败 → 检查OSS存储桶权限
  • 任务超时 → 视频过大或网络问题