《阿里云AI产品必知必会系列电子书》——阿里云视觉智能开放平台——视频理解QuickStart使用教程(1) https://developer.aliyun.com/article/1232496?groupCode=supportservice
二、通过Python-SDK调用视频理解-生成视频封面
1、pip install
pip install aliyun-python-sdk-videorecog==1.0.4
2、创建GenerateVideoCover
from aliyunsdkcore.client import AcsClient from aliyunsdkcore.auth.credentials import AccessKeyCredential from aliyunsdkvideorecog.request.v20200320.GenerateVideoCoverRequest import GenerateVideoCoverRequest credentials = AccessKeyCredential('accesskey', 'accesskeysecret') client = AcsClient(region_id='cn-shanghai', credential=credentials) request = GenerateVideoCoverRequest() request.set_accept_format('json') request.set_VideoUrl("url") request.set_IsGif(False) response = client.do_action_with_exception(request) print(str(response, encoding='utf-8'))
3、返回异步任务请求ID
{ "RequestId": "02***E7B-E496-58C0-AC31-B6***9B" }
4、查询异步任务结果
from aliyunsdkcore.client import AcsClient from aliyunsdkcore.auth.credentials import AccessKeyCredential from aliyunsdkvideorecog.request.v20200320.GetAsyncJobResultRequest import GetAsyncJobResultRequest credentials = AccessKeyCredential('accesskey', 'accesskeysecret') client = AcsClient(region_id='cn-shanghai', credential=credentials) request = GetAsyncJobResultRequest() request.set_accept_format('json') request.set_JobId("02***E7B-E496-58C0-AC31-B6***9B") response = client.do_action_with_exception(request) print(str(response, encoding='utf-8'))
5、获取异步结果数据返回
{ "RequestId": "3C****AA-44FE-5978-B950-05131914018A", "Data": { "Status": "PROCESS_SUCCESS", "JobId": "02***E7B-E496-58C0-AC31-B6***9B", "Result": "{\"Outputs\":[{\"ImageURL\":\"http://vibktp**********8Cw%3D\",\"Confifidence\":8.933435588336971}, {\"ImageURL\":\"http://vibkt - prfx-prod-pro****d457e01074e12b615_beautifified.png?Expires=16****8261&OSSvh1&Signature=msA9zI*****eIci2fg%3D\",\"Co nfifidence\":7.563963664957769}]}" } }
《阿里云AI产品必知必会系列电子书》——阿里云视觉智能开放平台——视频理解QuickStart使用教程(3) https://developer.aliyun.com/article/1232491?groupCode=supportservice