switch ($video_mode) {
case 1 :
case 2 :
case 3 :
case 4 :
unset($type_list['image']);
break;
case 11 :
unset($type_list['video']);
$type = $type == 1 ? 3 : $type;
break;
default :
break;
}
$type_list_single = array_column($type_list,'title','type');
$this->output['now_type'] = $type;
$this->output['type_list'] = $type_list;
$this->output['type_list_single'] = $type_list_single;
//获取素材组合信息
$pailie_model = new App_Model_Douyin_MysqlVideoMaterialPailieStorage();
$pailie_row = $pailie_model->getRowByDvid($da_id);
$pailie_row['dvmp_pailie_have'] = $pailie_row['dvmp_total']-$pailie_row['dvmp_used'];
//视频混剪模式
$this->output['pailie_row'] = $pailie_row;
$this->output['temp_video_count'] = $temp_video_count;
$this->output['project_mode'] = plum_parse_config('project_mixed_mode','dydqt/project')[$video_mode];
//输出操作指引
}
//保存
$dvm_id_list = []; //保存的所有素材列表
foreach ($attachment_list as $each){
$material_data = [
'dvm_aa_id' => $this->manager['ds_agent_id'],
'dvm_ds_id' => $this->sid,
'dvm_dv_id' => $video_info['dv_id'],
'dvm_material_name' => $each['dsa_real_name'],
'dvm_material_type' => $mt_type,
'dvm_material_content' => $each['dsa_path'],
'dvm_video_mixed_mode' => $video_info['dv_video_mode'],
'dvm_video_is_deal' => ($sc_type == 'video' && $video_info['dv_video_mode'] != 3) ? 0 : 1,
'dvm_update_time' => time(),
'dvm_width' => $each['dsa_width'],
'dvm_height' => $each['dsa_height'],
'dvm_duration' => $each['dsa_duration'],
'dvm_scene' => $scene > 0 ? $scene : 1,//默认场景1
'dvm_related_aid' => $each['dsa_id'],
'dvm_create_time' => time(),
];
$dvm_id = $videvo_material_model->insertValue($material_data);
array_push($dvm_id_list, $dvm_id);
}
//清空素材排列组合(视频及图片素材,背景图片不处理)
if (in_array($sc_type, ['video', 'image']) && in_array($mt_type, [1,3])) {
$VideoMaterialPailie_model = new
if (count($have_write_list) < 1) {
$this->displayJsonError('生成失败,当前模式下至少需要上传1条文案素材');
}
break;
}
//获取没有处理过的视频列表
$not_deal_video_list = $videoMaterial_model->getCreateVideoMaterials($this->sid,$dv_id,1,$video_info['dv_video_mode'],0);
if(!empty($not_deal_video_list)){
$this->displayJsonError('当前存在未处理过的视频素材,请等待所有素材处理结束');
}
//获取音频列表
if(in_array($video_info['dv_video_mode'],[1,2,4])){
$have_radio_list = $videoMaterial_model->getCreateVideoMaterials($video_info['dv_s_id'],$video_info['dv_id'],2);
if(empty($have_radio_list) || count($have_radio_list) <= 0){
$this->displayJsonError('生成失败,当前模式下无音频素材');
}
}
//再次遍历,生成排列组合
$updata = ['dvmp_is_zuhe' => 1,'dvmp_used' => 0];
switch ($video_info['dv_video_mode']) {
case 1: //混剪视频
case 2: //智能组合
$total = 1;
for($i=count($have_video_list); $i>(count($have_video_list)-$video_info['dv_video_use']); $i--) {
$total *= $i;
}
//防止产生的组合数过大
$total = min(100000000000, $total);
$updata['dvmp_total'] = $total;
if ($total < 1000) {
$material_id_list = array_column($have_video_list,'dvm_id');
$zuhe_list = plumGetArrPailie($material_id_list, $video_info['dv_video_use']);
$updata['dvmp_pailie'] = json_encode($zuhe_list,JSON_UNESCAPED_UNICODE);
}
break;
case 3: //随机选定
$total = count($have_video_list);
$updata['dvmp_total'] = $total;
$material_id_list = array_column($have_video_list,'dvm_id');
$zuhe_list = plumGetArrPailie($material_id_list, 1);
$updata['dvmp_pailie'] = json_encode($zuhe_list,JSON_UNESCAPED_UNICODE);
break;
开发语言:PHP
开发环境:源码所需服务器配置 1、规格:最低4核8G 2、硬盘:不低于100G 3、带宽:可以使用按量付费,100M峰值带宽 4、系统:CentOS7或CentOS8
视频文件要求:
为了更好的观看体验,推荐上传16:9,分辨率为720p(1280x720)及以上的竖版视频。
支持常用视频格式,推荐使用 mp4
视频文件大小不超过128M
带品牌logo或品牌水印的视频,会命中抖音的审核逻辑,有比较大的概率导致分享视频推荐降权处理/分享视频下架处理/分享账号被封禁处理。强烈建议第三方应用自行处理好分享内容中的不合规水印。