tool capability
API |
describe |
---|---|
Developers can upload materials to Douyin server through this interface. |
|
Upload temporary material interface. |
|
Get material list interface. |
|
Delete material interface. |
|
Obtain the applet interface capability. |
|
Simulate webhook events. |
|
This interface is used to get jsapi_ticket. This interface is applicable to Douyin . |
Batch editing development ideas:
Introduction of 4 mixed cutting modes
Intelligent mixing and cutting synthesis : You only need to upload a long video with a length of 15-60 seconds. The system will extract the audio and then cut it into multiple small clips.
Smart random combination : At least 6 (the more the better) short videos within 6 seconds need to be uploaded, the system will mute the video, and the user will post the video
The system randomly selects 5 short video materials in this mode to combine randomly, and then synthesizes them with audio materials.
Combination of scene sequence : At least one or more short videos within 6 seconds must be uploaded in each of the five scenes, and the system will mute the video. When the user publishes the video, the system will randomly select a short video material combination in each scene, and then synthesize it with the audio material.
Smart picture combination: need to upload as many picture materials as possible, select 6 picture materials, and the system will combine the picture materials when the user publishes the video
Randomly combined into video, and then synthesized with audio.
*: Once the mode is selected, please do not switch the video synthesis mode easily, otherwise the material and cached video will be cleared.
Code Development Example
$breadcrumbs = [
['title' => 'AI视频创意', 'link' => '#'],
['title' => '开始创作', 'link' => ''],
];
$this->buildBreadcrumbs($breadcrumbs);
//搜索专用
$keyword_type = $this->request->getStrParam('keyword_type');
$keyword = $this->request->getStrParam('keyword');
$this->output['keyword_type'] = $keyword_type;
$this->output['keyword'] = $keyword;
$dv_id = $this->request->getIntParam('dv_id'); //视频工程ID
$this->output['dv_id'] = $dv_id;
$type = $this->request->getIntParam('type', 0); //素材类型
$scene = $this->request->getIntParam('scene', 1);
$this->output['scene'] = $scene;
//获取视频信息
$video_model = new App_Model_Douyin_MysqlVideoStorage();
$video_info = $video_model->getRowByIdSid($dv_id, $this->sid);
if (empty($video_info)) {
plum_redirect_with_msg('视频创意工程不存在');
}
$mixed_video_mode = $video_info['dv_video_mode'];
if (in_array($mixed_video_mode, [11])) { //智能图片组合
$type = in_array($type, [0, 1]) ? 3 : $type; //默认为图片素材类型
} else {
$type = in_array($type, [0, 3]) ? 1 : $type; //默认为视频素材类型
}
//获取素材列表
$where = [
['name' => 'dvm_ds_id', 'oper' => '=', 'value' => $this->sid],
['name' => 'dvm_dv_id', 'oper' => '=', 'value' => $dv_id],
['name' => 'dvm_material_type', 'oper' => '=', 'value' => $type]
];
//视频类型,区分混剪模式
if ($type == 1) {
$where[] = ['name' => 'dvm_video_mixed_mode', 'oper' => '=', 'value' => $video_info['dv_video_mode']];
}
if (!empty($keyword_type)) {
$where[] = ['name' => $keyword_type, 'oper' => 'like', 'value' => "%{$keyword}%"];
}
//智能场景组合,视频素材加场景值筛选
if ($type == 1 && $mixed_video_mode == 4) {
$scene_model = new App_Model_Douyin_MysqlVideoSceneStorage();
$scene_count = $scene_model->getCountByDvid($dv_id);
if ($scene_count == 0 && $video_info['dv_video_use'] > 0) {
for ($i = 1; $i <= $video_info['dv_video_use']; $i++) {
$indata = [
'dvs_ds_id' => $this->sid,
'dvs_dv_id' => $dv_id,
'dvs_name' => "场景" . $i,
'dvs_duration' => $video_info['dv_video_shot'] * 1000,
'dvs_