@@ -21,6 +21,7 @@ import org.apache.commons.lang3.StringUtils; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.util.ObjectUtils; | |||
import org.springframework.web.bind.annotation.*; | |||
@@ -76,7 +77,10 @@ public class PersonPhotoController extends BaseController { | |||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"素材为空"); | |||
} | |||
//todo 掉第三方接口判断图片是否符合规范 | |||
ResultData data = personPhotoService.checkPhoto(record.getMaterial()); | |||
if (data.code != 2000){ | |||
return new ResultData(data.code,data.message); | |||
} | |||
if(record.getTitle() == null){ | |||
record.setTitle("用户自建"); | |||
@@ -153,4 +153,16 @@ public class VoiceMouldController extends BaseController { | |||
logger.debug("[" + getIpAddr() + "] MouldPatchController::chooseType"); | |||
return new ResultData(voiceInfoService.chooseType(id)); | |||
} | |||
@AuthIgnore | |||
@ApiOperation("TTS音色预览") | |||
@GetMapping("/preview") | |||
@ApiImplicitParams({ | |||
@ApiImplicitParam(name = "genTxt", value = "需要生成的文字", dataType = "String", paramType = "query", required = true), | |||
@ApiImplicitParam(name = "voiceId", value = "音色ID", dataType = "Long", paramType = "query", required = true), | |||
@ApiImplicitParam(name = "voiceStyle", value = "语音风格", dataType = "String", paramType = "query", required = true)}) | |||
public ResultData voicePreview(String genTxt, Long voiceId, String voiceStyle) { | |||
logger.debug("[" + getIpAddr() + "] MouldPatchController::voicePreview"); | |||
return new ResultData(voiceInfoService.voicePreview(genTxt, voiceId, voiceStyle)); | |||
} | |||
} |
@@ -62,6 +62,7 @@ public class PhotoSpeakVideo extends TenantEntity { | |||
* { | |||
* "title":, | |||
* "languages":, | |||
* "sex":, | |||
* "mouldSmId":, | |||
* "personId":, | |||
* "personType":, | |||
@@ -43,4 +43,5 @@ public interface PersonPhotoService { | |||
void updateOnline(PersonPhoto record); | |||
ResultData checkPhoto(String material); | |||
} |
@@ -2,6 +2,7 @@ package com.iformall.service.sm; | |||
import com.iformall.common.ErrorCode; | |||
import com.iformall.common.ResultData; | |||
import com.iformall.domain.po.sm.VoiceInfo; | |||
import com.iformall.domain.po.sm.VoiceLanguage; | |||
@@ -12,4 +13,6 @@ public interface VoiceInfoService { | |||
List<VoiceInfo> chooseType(Long id); | |||
VoiceInfo getById(Long voiceMouldId); | |||
ResultData voicePreview(String genTxt, Long voiceId, String voiceStyle); | |||
} |
@@ -1,5 +1,7 @@ | |||
package com.iformall.service.sm.impl; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.github.pagehelper.PageHelper; | |||
import com.github.pagehelper.PageInfo; | |||
import com.iformall.common.IdWorker; | |||
@@ -7,6 +9,7 @@ import com.iformall.common.ResultData; | |||
import com.iformall.domain.po.sm.MaterialMould; | |||
import com.iformall.domain.po.sm.MouldPatchSign; | |||
import com.iformall.domain.po.sm.PersonPhoto; | |||
import com.iformall.douyin.pay.preOrder.CreatePreOrderResult; | |||
import com.iformall.enums.EnumMouldSendType; | |||
import com.iformall.enums.EnumaMouldPatchStatus; | |||
import com.iformall.mapper.MaterialMouldMapper; | |||
@@ -14,6 +17,10 @@ import com.iformall.mapper.PersonPhotoMapper; | |||
import com.iformall.service.sm.MaterialMouldService; | |||
import com.iformall.service.sm.MouldPatchSignService; | |||
import com.iformall.service.sm.PersonPhotoService; | |||
import com.iformall.sm.AiVideoHelper; | |||
import com.iformall.utils.Base64Util; | |||
import com.iformall.utils.HttpUtil; | |||
import io.swagger.models.auth.In; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
@@ -22,6 +29,7 @@ import org.springframework.stereotype.Service; | |||
import java.math.BigDecimal; | |||
import java.util.Date; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
@@ -35,11 +43,11 @@ public class PersonPhotoServiceImpl implements PersonPhotoService { | |||
@Autowired | |||
MouldPatchSignService mouldPatchSignService; | |||
private void handleSendType(PersonPhoto record){ | |||
private void handleSendType(PersonPhoto record) { | |||
// | |||
if(record.getUserId() != null){ | |||
if (record.getUserId() != null) { | |||
record.setSendType(EnumMouldSendType.build.getCode()); | |||
}else if(record.getSendType() == null){ | |||
} else if (record.getSendType() == null) { | |||
record.setSendTypes(EnumMouldSendType.getSysSendTypes()); | |||
} | |||
} | |||
@@ -56,7 +64,7 @@ public class PersonPhotoServiceImpl implements PersonPhotoService { | |||
handleSendType(record); | |||
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> personPhotoMapper.findCList(record)); | |||
} | |||
@Override | |||
public PersonPhoto getById(Long id) { | |||
return personPhotoMapper.selectById(id); | |||
@@ -65,10 +73,10 @@ public class PersonPhotoServiceImpl implements PersonPhotoService { | |||
@Override | |||
public PersonPhoto getDetailById(Long id) { | |||
PersonPhoto personPhoto = getById(id); | |||
if(personPhoto == null){ | |||
if (personPhoto == null) { | |||
return null; | |||
} | |||
if(personPhoto.getSceneSignList() != null && !personPhoto.getSceneSignList().isEmpty()){ | |||
if (personPhoto.getSceneSignList() != null && !personPhoto.getSceneSignList().isEmpty()) { | |||
MouldPatchSign signQ = new MouldPatchSign(); | |||
signQ.setIds(personPhoto.getSceneSignList()); | |||
List<MouldPatchSign> signList = mouldPatchSignService.getList(signQ); | |||
@@ -92,7 +100,7 @@ public class PersonPhotoServiceImpl implements PersonPhotoService { | |||
//record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
final IdWorker idWorker = IdWorker.get(); | |||
record.setId(idWorker.nextId()); | |||
if(record.getStatus() == null){ | |||
if (record.getStatus() == null) { | |||
record.setStatus(EnumaMouldPatchStatus.draft.getCode()); | |||
} | |||
record.setCreateDate(now); | |||
@@ -102,7 +110,7 @@ public class PersonPhotoServiceImpl implements PersonPhotoService { | |||
record.setUpdateDate(now); | |||
personPhotoMapper.updateById(record); | |||
} | |||
return new ResultData(record); | |||
return new ResultData(record); | |||
} | |||
@Override | |||
@@ -116,11 +124,25 @@ public class PersonPhotoServiceImpl implements PersonPhotoService { | |||
PersonPhoto personPhotoUpd = new PersonPhoto(); | |||
personPhotoUpd.setId(record.getId()); | |||
personPhotoUpd.setStatus(record.getStatus()); | |||
if(EnumaMouldPatchStatus.put_on.getCode().equals(personPhotoUpd.getStatus())){ | |||
if (EnumaMouldPatchStatus.put_on.getCode().equals(personPhotoUpd.getStatus())) { | |||
personPhotoUpd.setPutonDate(now); | |||
} | |||
personPhotoUpd.setUpdateDate(now); | |||
personPhotoMapper.updateById(personPhotoUpd); | |||
} | |||
@Override | |||
public ResultData checkPhoto(String material) { | |||
String url = "http://nas.pucao.cn:2002/image_qualit"; | |||
String result = AiVideoHelper.doPost(url, Base64Util.imageUrlToBase64(material)); | |||
if (StringUtils.isNotEmpty(result)) { | |||
JSONObject result1 = JSON.parseObject(result); | |||
String status = result1.getString("status"); | |||
JSONObject jsonObject = JSON.parseObject(status); | |||
Integer code = jsonObject.getInteger("code"); | |||
String msg = jsonObject.getString("msg"); | |||
return new ResultData(code, msg); | |||
} | |||
return new ResultData("图片质量审核失败"); | |||
} | |||
} |
@@ -1,5 +1,6 @@ | |||
package com.iformall.service.sm.impl; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.github.pagehelper.PageHelper; | |||
import com.github.pagehelper.PageInfo; | |||
@@ -10,6 +11,8 @@ import com.iformall.domain.po.sm.*; | |||
import com.iformall.enums.*; | |||
import com.iformall.mapper.PhotoSpeakVideoMapper; | |||
import com.iformall.service.sm.*; | |||
import com.iformall.sm.*; | |||
import com.iformall.utils.Base64Util; | |||
import com.iformall.video.VideoFactory; | |||
import com.iformall.video.entity.VideUploadResult; | |||
import org.apache.commons.lang3.StringUtils; | |||
@@ -20,6 +23,7 @@ import org.springframework.scheduling.annotation.Async; | |||
import org.springframework.scheduling.annotation.AsyncResult; | |||
import org.springframework.stereotype.Service; | |||
import javax.transaction.xa.XAException; | |||
import java.util.ArrayList; | |||
import java.util.Date; | |||
import java.util.List; | |||
@@ -98,6 +102,7 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { | |||
JSONObject voiceMouldObject = new JSONObject(); | |||
voiceMouldObject.put("title",voiceMould.getLocalName()); | |||
voiceMouldObject.put("mouldSmId",voiceMould.getMouldSmId()); | |||
voiceMouldObject.put("sex",voiceMould.getSex()); | |||
voiceMouldObject.put("personType",0); | |||
voiceMouldObject.put("personTypeStr","默认"); | |||
voiceMouldObject.put("speakType",0); | |||
@@ -216,77 +221,50 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { | |||
return new AsyncResult<>(0); | |||
} | |||
try { | |||
AiPhotoSpeakParam param = new AiPhotoSpeakParam(); | |||
param.setImg(Base64Util.imageUrlToBase64(photoSpeakVideo.getPersonPhotoUrl())); | |||
param.setVoice_id(voiceMouldSmId); | |||
param.setVoice_style(StringUtils.isBlank(voiceType) ? "default" : voiceType); | |||
String voiceMouldSm = photoSpeakVideo.getVoiceMouldSm(); | |||
JSONObject jsonObject = JSON.parseObject(voiceMouldSm); | |||
Integer sex = jsonObject.getInteger("sex"); | |||
if (EnumVoiceFrom.FROM_MOULD.getCode().equals(voiceFrom)) { | |||
param.setGen_txt(paperwork); | |||
param.setGender(sex.toString()); | |||
param.setUrl("None"); | |||
} else if (EnumVoiceFrom.FROM_UPD.getCode().equals(voiceFrom)) { | |||
param.setGen_txt("None"); | |||
param.setGender("None"); | |||
param.setUrl(voiceMaterialUrl); | |||
} | |||
AiPhotoSpeakResult video = AiVideoHelper.createPhotoSpeakVideo(param); | |||
if (video.isSuccess()) { | |||
videoUpd.setVideoPath(video.getUrl()); | |||
videoUpd.setVideoStatus(EnumVideoStatus.success.getCode()); | |||
videoUpd.setVideoMsg("success"); | |||
videoUpd.setCreateVideoDate(new Date()); | |||
this.saveOrUpdate(videoUpd); | |||
try{ | |||
// AiVideoParam videoParam = new AiVideoParam(); | |||
// videoParam.setGen_txt(paperwork); | |||
// videoParam.setVideo_template_id(personMouldSmId); | |||
// videoParam.setVoice_id(voiceMouldSmId); | |||
// videoParam.setVoice_style(voiceType); | |||
// AiVideoParam.VideoFiles videoFiles = new AiVideoParam.VideoFiles(); | |||
// AiVideoParam.BackGround backGround = new AiVideoParam.BackGround(); | |||
// backGround.setType(EnumVideoType.getEnum(mouldVideo.getVideoType()).getType()); | |||
// JSONObject backgroundObject = JSONObject.parseObject(mouldVideo.getBackgroundSm()); | |||
// backGround.setImage(Base64Util.imageUrlToBase64(backgroundObject.getString("material"))); | |||
// videoFiles.setBack_ground(backGround); | |||
// AiVideoParam.Material digitalHuman = new AiVideoParam.Material(); | |||
// JSONObject personObject = JSONObject.parseObject(mouldVideo.getPersonJson()); | |||
// int[] digitalHumanCoord = new int[]{personObject.getIntValue("x"),personObject.getIntValue("y")}; | |||
// digitalHuman.setCoord(digitalHumanCoord); | |||
// digitalHuman.setLevel(personObject.getIntValue("z")); | |||
// digitalHuman.setRatio(personObject.getFloatValue("w")); | |||
// videoFiles.setDigital_human(digitalHuman); | |||
// | |||
// if(StringUtils.isNotBlank(mouldVideo.getMaterialAllJson())){ | |||
// JSONArray materialAllArray = JSONArray.parseArray(mouldVideo.getMaterialAllJson()); | |||
// if(materialAllArray != null && !materialAllArray.isEmpty()){ | |||
// List<AiVideoParam.Material> materialList = new ArrayList<>(); | |||
// for(int i = 0;i < materialAllArray.size();i++) { | |||
// JSONObject materialObject = materialAllArray.getJSONObject(i); | |||
// if(EnumMouldPatchType.material_mould.getCode().equals(materialObject.getInteger("type"))){ | |||
// AiVideoParam.Material material = new AiVideoParam.Material(); | |||
// int[] materialCoord = new int[]{materialObject.getIntValue("x"),materialObject.getIntValue("y")}; | |||
// material.setCoord(materialCoord); | |||
// material.setImage(Base64Util.imageUrlToBase64(materialObject.getString("material"))); | |||
// material.setLevel(materialObject.getIntValue("z")); | |||
// material.setRatio(materialObject.getFloatValue("w")); | |||
// materialList.add(material); | |||
// } | |||
// } | |||
// if(materialList.size() > 0){ | |||
// videoFiles.setMaterial(materialList); | |||
// } | |||
// } | |||
// } | |||
// videoParam.setVideo_files(videoFiles); | |||
// | |||
// AiVideoResult video = AiVideoHelper.createVideo(videoParam); | |||
// if(video.isSuccess()){ | |||
// videoUpd.setVideoPath(video.getUrl()); | |||
//// videoUpd.setVideoTime(video.getDuration()+""); | |||
// videoUpd.setVideoStatus(EnumVideoStatus.success.getCode()); | |||
// videoUpd.setVideoMsg("success"); | |||
// videoUpd.setCreateVideoDate(new Date()); | |||
// this.saveOrUpdate(videoUpd); | |||
// | |||
// videoUpd.setTitle(mouldVideo.getTitle()); | |||
// this.uploadVideo(videoUpd); | |||
// | |||
// return new AsyncResult<>(1); | |||
// } | |||
videoUpd.setTitle(photoSpeakVideo.getTitle()); | |||
this.uploadVideo(videoUpd); | |||
return new AsyncResult<>(1); | |||
} | |||
videoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); | |||
videoUpd.setVideoMsg("fail"); | |||
this.saveOrUpdate(videoUpd); | |||
return new AsyncResult<>(0); | |||
}catch(Exception e){ | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
videoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); | |||
videoUpd.setVideoMsg("请求异常"); | |||
this.saveOrUpdate(videoUpd); | |||
return new AsyncResult<>(0); | |||
} | |||
} | |||
@Override | |||
@@ -2,14 +2,20 @@ package com.iformall.service.sm.impl; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.google.common.collect.Lists; | |||
import com.iformall.common.ResultData; | |||
import com.iformall.domain.po.sm.VoiceInfo; | |||
import com.iformall.enums.EnumSex; | |||
import com.iformall.mapper.VoiceMapper; | |||
import com.iformall.service.sm.VoiceInfoService; | |||
import com.iformall.sm.AiPhotoSpeakResult; | |||
import com.iformall.sm.AiVideoHelper; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.util.ObjectUtils; | |||
import java.util.List; | |||
@@ -37,4 +43,29 @@ public class VoiceInfoServiceImpl implements VoiceInfoService { | |||
public VoiceInfo getById(Long voiceMouldId) { | |||
return voiceMapper.selectById(voiceMouldId); | |||
} | |||
@Override | |||
public ResultData voicePreview(String genTxt, Long voiceId, String voiceStyle) { | |||
if (voiceId == null || StringUtils.isBlank(genTxt)) { | |||
return new ResultData(); | |||
} | |||
VoiceInfo voiceInfo = voiceMapper.selectOne(new LambdaQueryWrapper<VoiceInfo>().eq(VoiceInfo::getIsDel, 0).eq(VoiceInfo::getId, voiceId)); | |||
JSONObject jsonObject = new JSONObject(); | |||
jsonObject.put("gen_txt", genTxt); | |||
jsonObject.put("voice_id", voiceInfo.getMouldSmId()); | |||
jsonObject.put("voice_style", voiceStyle); | |||
jsonObject.put("gender", voiceInfo.getSex() == 1 ? "male" : "female"); | |||
String response = AiVideoHelper.doPost("http://nas.pucao.cn:2002/tts_wav", jsonObject.toJSONString()); | |||
if (StringUtils.isNotBlank(response)) { | |||
String str = "http://nas.pucao.cn:2002"; | |||
JSONObject object = JSON.parseObject(response); | |||
JSONObject status = object.getJSONObject("status"); | |||
Integer code = status.getInteger("code"); | |||
if (code.intValue() == 3000) { | |||
JSONObject data = object.getJSONObject("data"); | |||
return new ResultData(str + data.getString("url")); | |||
} | |||
} | |||
return new ResultData(); | |||
} | |||
} |
@@ -0,0 +1,38 @@ | |||
package com.iformall.sm; | |||
import io.swagger.models.auth.In; | |||
import lombok.Data; | |||
@Data | |||
public class AiPhotoSpeakParam { | |||
/** | |||
* | 参数 | 必选 | 类型 | 说明 | | |||
* | ----------------- | ---- | ------- | ------------------------------------------------------------ | | |||
* | gen_txt | 是 | string | 需要生成的文字, 如果上传语音文件就为None | | |||
* | voice_id | 是 | string | 音色ID,如:"zh-CN-YunxiNeural"。如果使用“default”,表示不指定具体的,由后端服务自动匹配 | | |||
* | voice_style | 是 | string | TTS语音风格,如:”angry“。如果使用“default”,表示默认风格 | | |||
* | gender | 是 | string | 说话人性别,male或者female | | |||
* | url | 是 | string | 如果上传音频就传url,否则为None | | |||
* | img | 是 | base64 | 编码后的图片 | | |||
*/ | |||
private String gen_txt; | |||
private String voice_id; | |||
private String voice_style; | |||
private String gender; | |||
private String url; | |||
private String img; | |||
public String neglectImgString() { | |||
StringBuffer str = new StringBuffer(); | |||
str.append("{"); | |||
str.append("\"gen_txt\":").append("\"").append(gen_txt).append("\","); | |||
str.append("\"voice_id\":").append("\"").append(voice_id).append("\","); | |||
str.append("\"voice_style\":").append("\"").append(voice_style).append("\","); | |||
str.append("\"gender\":").append("\"").append(gender).append("\","); | |||
str.append("\"url\":").append("\"").append(url).append("\","); | |||
str.append("\"img\":").append("\"").append(img).append("\"}"); | |||
return str.toString(); | |||
} | |||
} |
@@ -0,0 +1,12 @@ | |||
package com.iformall.sm; | |||
import lombok.Data; | |||
@Data | |||
public class AiPhotoSpeakResult { | |||
private boolean success; | |||
private String msg; | |||
private String url; | |||
} |
@@ -31,6 +31,7 @@ public class AiVideoHelper { | |||
// http://nas.pucao.cn:2001/gen_dh_video | |||
public static String uri = "http://nas.pucao.cn:2001"; | |||
public static String url = "http://nas.pucao.cn:2002/img_talking"; | |||
public static String doPost(String url, String params) { | |||
return HttpUtil.doAiVideoPost(url,params); | |||
} | |||
@@ -96,26 +97,69 @@ public class AiVideoHelper { | |||
// } | |||
} | |||
public static AiPhotoSpeakResult createPhotoSpeakVideo(AiPhotoSpeakParam videoParam) { | |||
log.info("生成视频start request:" + videoParam.neglectImgString()); | |||
String response = doPost(url, JSONObject.toJSONString(videoParam)); | |||
log.info("生成视频end response:" + response); | |||
AiPhotoSpeakResult result = new AiPhotoSpeakResult(); | |||
if (StringUtils.isBlank(response)) { | |||
result.setSuccess(false); | |||
result.setMsg("请求生成视频异常,请稍后重试"); | |||
return result; | |||
} | |||
JSONObject jsonObject = JSON.parseObject(response); | |||
JSONObject status = jsonObject.getJSONObject("status"); | |||
Integer code = status.getInteger("code"); | |||
if (code == null) { | |||
result.setSuccess(false); | |||
result.setMsg("请求生成视频异常,请稍后重试"); | |||
return result; | |||
} | |||
if (code.intValue() == 1000) { | |||
JSONObject data = jsonObject.getJSONObject("data"); | |||
String videoUrl = data.getString("url"); | |||
result.setSuccess(true); | |||
result.setMsg("success"); | |||
result.setUrl(videoUrl); | |||
} else { | |||
result.setSuccess(false); | |||
result.setMsg(status.getString("msg")); | |||
} | |||
return result; | |||
} | |||
public static void main(String[] args) { | |||
AiVideoParam videoParam = new AiVideoParam(); | |||
videoParam.setGen_txt("我写了一篇小说,你帮我看看。"); | |||
videoParam.setVideo_template_id("16776650495633934_PgNAW8Sm"); | |||
videoParam.setVoice_id("zh-CN-XiaohanNeural"); | |||
videoParam.setVoice_style("default"); | |||
AiVideoParam.VideoFiles videoFiles = new AiVideoParam.VideoFiles(); | |||
AiVideoParam.BackGround backGround = new AiVideoParam.BackGround(); | |||
backGround.setType("vertical"); | |||
backGround.setImage(Base64Util.imageUrlToBase64("https://suimang.oss-accelerate.aliyuncs.com/builtin/background/grace/1080.jpg")); | |||
videoFiles.setBack_ground(backGround); | |||
AiVideoParam.Material digitalHuman = new AiVideoParam.Material(); | |||
int[] digitalHumanCoord = new int[]{0,0}; | |||
digitalHuman.setCoord(digitalHumanCoord); | |||
digitalHuman.setLevel(0); | |||
digitalHuman.setRatio(1.0f); | |||
videoFiles.setDigital_human(digitalHuman); | |||
videoParam.setVideo_files(videoFiles); | |||
AiVideoResult video = AiVideoHelper.createVideo(videoParam); | |||
// AiVideoParam videoParam = new AiVideoParam(); | |||
// videoParam.setGen_txt("我写了一篇小说,你帮我看看。"); | |||
// videoParam.setVideo_template_id("16776650495633934_PgNAW8Sm"); | |||
// videoParam.setVoice_id("zh-CN-XiaohanNeural"); | |||
// videoParam.setVoice_style("default"); | |||
// AiVideoParam.VideoFiles videoFiles = new AiVideoParam.VideoFiles(); | |||
// AiVideoParam.BackGround backGround = new AiVideoParam.BackGround(); | |||
// backGround.setType("vertical"); | |||
// backGround.setImage(Base64Util.imageUrlToBase64("https://suimang.oss-accelerate.aliyuncs.com/builtin/background/grace/1080.jpg")); | |||
// videoFiles.setBack_ground(backGround); | |||
// AiVideoParam.Material digitalHuman = new AiVideoParam.Material(); | |||
// int[] digitalHumanCoord = new int[]{0,0}; | |||
// digitalHuman.setCoord(digitalHumanCoord); | |||
// digitalHuman.setLevel(0); | |||
// digitalHuman.setRatio(1.0f); | |||
// videoFiles.setDigital_human(digitalHuman); | |||
// videoParam.setVideo_files(videoFiles); | |||
// | |||
// AiVideoResult video = AiVideoHelper.createVideo(videoParam); | |||
AiPhotoSpeakParam param = new AiPhotoSpeakParam(); | |||
param.setGen_txt("我写了一篇小说,你帮我看看。"); | |||
param.setImg(Base64Util.imageUrlToBase64("https://suimang.oss-accelerate.aliyuncs.com/builtin/personmould/16739389169485046_nVi875Ej_grace_1080.jpg")); | |||
param.setGender("male"); | |||
param.setVoice_id("zh-CN-XiaohanNeural"); | |||
param.setVoice_style("default"); | |||
param.setUrl("None"); | |||
AiPhotoSpeakResult video = AiVideoHelper.createPhotoSpeakVideo(param); | |||
} | |||
} |