视频点播 AI 漫剧转绘功能支持将真人实拍视频(如短剧),通过智能场景切分、内容理解、风格迁移和视频生成等多项 AI 技术,转换为具有多样化艺术风格的全新视频(例如动漫风、3D 卡通风、素描风)。您可以借此将现有的真人视频素材,低成本、批量化地转化为风格独特的动漫或卡通内容,从而丰富内容形态、提升用户吸引力。该功能适用于真人短剧的动漫化改编、营销视频的创意视觉升级,以及社交媒体内容的风格化处理等场景。
package com.volcengine.example.vod.edit;
import com.alibaba.fastjson.JSONObject;
import com.google.protobuf.ByteString;
import com.google.protobuf.util.JsonFormat;
import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;
import com.volcengine.service.vod.model.request.VodAsyncVCreativeTaskRequest;
import com.volcengine.service.vod.model.request.VodRequest;
import com.volcengine.service.vod.model.request.VodSubmitDirectEditTaskAsyncRequest;
import com.volcengine.service.vod.model.response.VodAsyncVCreativeTaskResponse;
import com.volcengine.service.vod.model.response.VodSubmitDirectEditTaskAsyncResponse;
import java.util.HashMap;
public class VodAsyncVCreativeTaskDemo {
public static void main(String[] args) {
// 1. 初始化客户端
IVodService vodService = VodServiceImpl.getInstance();
// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65641.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// vodService.setAccessKey("your ak");
// vodService.setSecretKey("your sk");
// 2. 构建 ParamObj 对象,并序列化为字符串
JSONObject paramObj = new JSONObject();
paramObj.put("input","vid://{your vid}");
paramObj.put("style","漫画风");
paramObj.put("resolution","720p");
// 3. 构建请求
VodAsyncVCreativeTaskRequest vodAsyncVCreativeTaskRequest = VodAsyncVCreativeTaskRequest.newBuilder()
.setUploader("your space")
.setParamStr(paramObj.toString())
.setScene("videostyletrans")
.build();
// 4. 发起调用
try {
VodAsyncVCreativeTaskResponse vodAsyncVCreativeTaskResponse = vodService.asyncVCreativeTask(vodAsyncVCreativeTaskRequest);
if (vodAsyncVCreativeTaskResponse.getResponseMetadata().hasError()) {
System.out.println(vodAsyncVCreativeTaskResponse.getResponseMetadata().getError());
System.exit(-1);
}
System.out.println(vodAsyncVCreativeTaskResponse.toString()); // 编码采用 UTF8
// 5. 成功提交,获取任务 ID
System.out.println(vodAsyncVCreativeTaskResponse.getResponseMetadata().getRequestId());
} catch (Exception e) {
e.printStackTrace();
}
}
}
# coding:utf-8
from __future__ import print_function
from volcengine.vod.VodService import VodService
from volcengine.vod.models.request.request_vod_pb2 import VodAsyncVCreativeTaskRequest
import json
if __name__ == '__main__':
# 1. 初始化客户端
vod_service = VodService()
# Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65646.
# The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
# During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
# vod_service.set_ak('your ak')
# vod_service.set_sk('your sk')
try:
# 2. 构建 ParamObj 字典,并序列化为字符串
paramObj = {
'input': 'vid://{your vid}',
'style': '漫画风',
'resolution': '720p'
}
paramStr = json.dumps(paramObj)
# 3. 构建请求体
req = VodAsyncVCreativeTaskRequest()
req.Uploader = "your Uploader"
req.ParamStr = paramStr
req.Scene = "videostyletrans"
req.CallbackArgs = "your CallbackArgs"
# 4. 发起调用
resp = vod_service.async_v_creative_task(req)
except Exception:
raise
else:
l = json.loads(resp)
print(json.dumps(l, ensure_ascii=False, indent=4))
print("****")
<?php
require('../../vendor/autoload.php');
// Create a VOD instance in the specified region.
// $client = VolcServiceVodVod::getInstance('cn-north-1');
$client = VolcServiceVodVod::getInstance();
// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');
$paramObj = [
'input' => 'vid://{your vid}}',
'style' => '漫画风',
'resolution' => '720p',
];
$paramStr = json_encode($paramObj);
$request = new VolcServiceVodModelsRequestVodAsyncVCreativeTaskRequest();
$request->setUploader("your Uploader");
$request->setParamStr($paramStr);
$request->setScene("videostyletrans");
$request->setCallbackArgs("your CallbackArgs");
$response = new VolcServiceVodModelsResponseVodAsyncVCreativeTaskResponse();
try {
$response = $client->asyncVCreativeTask($request);
} catch (Exception $e) {
echo $e, "
";
} catch (Throwable $e) {
echo $e, "
";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "
";
} else {
echo $response->serializeToJsonString(), "
";
}
以下示例基于您已在项目中集成 Java SDK 并初始化客户端。如果您是首次使用,请参考集成 Go SDK 文档完成基础配置。
package vod
import (
"encoding/json"
"fmt"
"github.com/volcengine/volc-sdk-golang/base"
"testing"
"github.com/volcengine/volc-sdk-golang/service/vod"
"github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)
func Test_AsyncVCreativeTask(t *testing.T) {
// Create a VOD instance in the specified region.
// instance := vod.NewInstanceWithRegion("cn-north-1")
instance := vod.NewInstance()
// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65655.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
instance.SetCredential(base.Credentials{
AccessKeyID: "your ak",
SecretAccessKey: "your sk",
})
paramObj := map[string]interface{}{
"input": "vid://{your vid}",
"style": "漫画风",
"resolution": "720p",
}
paramStr, _ := json.Marshal(paramObj)
query := &request.VodAsyncVCreativeTaskRequest{
Uploader: "your Uploader",
ParamStr: string(paramStr),
Scene: "videostyletrans",
CallbackArgs: "your CallbackArgs",
}
resp, status, err := instance.AsyncVCreativeTask(query)
fmt.Println(status)
fmt.Println(err)
fmt.Println(resp.String())
}
package com.volcengine.example.vod.edit;
import com.alibaba.fastjson.JSONObject;
import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;
import com.volcengine.service.vod.model.request.VodAsyncVCreativeTaskRequest;
import com.volcengine.service.vod.model.request.VodGetVCreativeTaskResultRequest;
import com.volcengine.service.vod.model.response.VodAsyncVCreativeTaskResponse;
import com.volcengine.service.vod.model.response.VodGetVCreativeTaskResultResponse;
public class VodGetVCreativeTaskResultDemo {
public static void main(String[] args) {
// Create a VOD instance in the specified region.
// IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
IVodService vodService = VodServiceImpl.getInstance();
// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65641.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// vodService.setAccessKey("your ak");
// vodService.setSecretKey("your sk");
VodGetVCreativeTaskResultRequest vodGetVCreativeTaskResultRequest = VodGetVCreativeTaskResultRequest.newBuilder()
.setVCreativeId("your vcreativeId")
.build();
try {
VodGetVCreativeTaskResultResponse vodGetVCreativeTaskResultResponse = vodService.getVCreativeTaskResult(vodGetVCreativeTaskResultRequest);
if (vodGetVCreativeTaskResultResponse.getResponseMetadata().hasError()) {
System.out.println(vodGetVCreativeTaskResultResponse.getResponseMetadata().getError());
System.exit(-1);
}
System.out.println(vodGetVCreativeTaskResultResponse.toString()); // 编码采用UTF8
System.out.println(vodGetVCreativeTaskResultResponse.getResponseMetadata().getRequestId());
} catch (Exception e) {
e.printStackTrace();
}
}
}
# coding:utf-8
from __future__ import print_function
from volcengine.vod.VodService import VodService
from volcengine.vod.models.request.request_vod_pb2 import VodGetVCreativeTaskResultRequest
import json
if __name__ == '__main__':
# Create a VOD instance in the specified region.
# vod_service = VodService('cn-north-1')
vod_service = VodService()
# Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65646.
# The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
# During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
# vod_service.set_ak('your ak')
# vod_service.set_sk('your sk')
try:
req = VodGetVCreativeTaskResultRequest()
req.VCreativeId = "your VCreativeId"
resp = vod_service.get_v_creative_task_result(req)
except Exception:
raise
else:
l = json.loads(resp)
print(json.dumps(l, ensure_ascii=False, indent=4))
print("****")
<?php
require('../../vendor/autoload.php');
// Create a VOD instance in the specified region.
// $client = VolcServiceVodVod::getInstance('cn-north-1');
$client = VolcServiceVodVod::getInstance();
// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');
$request = new VolcServiceVodModelsRequestVodGetVCreativeTaskResultRequest();
$request->setVCreativeId("your VCreativeId");
$response = new VolcServiceVodModelsResponseVodGetVCreativeTaskResultResponse();
try {
$response = $client->getVCreativeTaskResult($request);
} catch (Exception $e) {
echo $e, "
";
} catch (Throwable $e) {
echo $e, "
";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "
";
} else {
echo $response->serializeToJsonString(),"
";
}
以下示例基于您已在项目中集成 Java SDK 并初始化客户端。如果您是首次使用,请参考集成 Go SDK 文档完成基础配置。
package vod
import (
"encoding/json"
"fmt"
"github.com/volcengine/volc-sdk-golang/base"
"testing"
"github.com/volcengine/volc-sdk-golang/service/vod"
"github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)
func Test_GetVCreativeTaskResult(t *testing.T) {
// Create a VOD instance in the specified region.
// instance := vod.NewInstanceWithRegion("cn-north-1")
instance := vod.NewInstance()
// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65655.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
instance.SetCredential(base.Credentials{
AccessKeyID: "your ak",
SecretAccessKey: "your sk",
})
query := &request.VodGetVCreativeTaskResultRequest{
VCreativeId: "your VCreativeId",
}
resp, status, err := instance.GetVCreativeTaskResult(query)
fmt.Println(status)
fmt.Println(err)
fmt.Println(resp.String())
}
方式 2:配置事件通知
参考事件通知概述文档,配置一个用于接收回调的服务地址。在订阅事件时,勾选 AI 智剪任务完成事件。当任务完成时,您的服务将收到一个 EventType 为 VCreativeComplete 的 HTTP POST 请求。