| @@ -8,4 +8,7 @@ ALTER TABLE `mallink_suimang_test`.`photo_speak_video` | |||||
| ADD COLUMN `is_hy` smallint NULL DEFAULT 0 COMMENT '是否超分(1、是,2、否)' AFTER `video_hy_status`, | ADD COLUMN `is_hy` smallint NULL DEFAULT 0 COMMENT '是否超分(1、是,2、否)' AFTER `video_hy_status`, | ||||
| ALTER TABLE `mallink_suimang_test`.`voice_material` | ALTER TABLE `mallink_suimang_test`.`voice_material` | ||||
| ADD COLUMN `time` double NULL COMMENT '视频时长' AFTER `type`; | |||||
| ADD COLUMN `time` double NULL COMMENT '视频时长' AFTER `type`; | |||||
| ALTER TABLE `mallink_suimang_test`.`photo_speak_video` | |||||
| ADD COLUMN `audio_path` varchar(255) NULL DEFAULT NULL COMMENT 'audio_path' AFTER `save_dir`, | |||||
| @@ -216,11 +216,11 @@ public class PhotoSpeakVideoController extends BaseController { | |||||
| if(StringUtils.isBlank(voiceMaterialUrl)){ | if(StringUtils.isBlank(voiceMaterialUrl)){ | ||||
| voiceMaterialService.handVideoUrl(voiceMaterial); | voiceMaterialService.handVideoUrl(voiceMaterial); | ||||
| voiceMaterialUrl = voiceMaterial.getMaterial(); | voiceMaterialUrl = voiceMaterial.getMaterial(); | ||||
| videoUpd.setVoiceMaterialUrl(voiceMaterialUrl); | |||||
| } | } | ||||
| if(StringUtils.isBlank(voiceMaterialUrl)){ | if(StringUtils.isBlank(voiceMaterialUrl)){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未找到上传声音文件"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未找到上传声音文件"); | ||||
| } | } | ||||
| videoUpd.setVoiceMaterialUrl(voiceMaterialUrl); | |||||
| // videoUpd.setVideoTime(String.valueOf(voiceMaterial.getTime())); | // videoUpd.setVideoTime(String.valueOf(voiceMaterial.getTime())); | ||||
| } else if (EnumVoiceFrom.MUSIC.getCode().equals(voiceFrom)) { | } else if (EnumVoiceFrom.MUSIC.getCode().equals(voiceFrom)) { | ||||
| Long musicId = mouldVideo.getMusicId(); | Long musicId = mouldVideo.getMusicId(); | ||||
| @@ -151,6 +151,8 @@ public class PhotoSpeakVideo extends TenantEntity { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private List<Integer> videoStatuss; | private List<Integer> videoStatuss; | ||||
| private String audioPath; | |||||
| private Long musicId; | private Long musicId; | ||||
| private String saveDir; | private String saveDir; | ||||
| @@ -227,6 +227,7 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { | |||||
| AiPhotoSpeakResult video = AiVideoHelper.createPhotoSpeakVideo(param); | AiPhotoSpeakResult video = AiVideoHelper.createPhotoSpeakVideo(param); | ||||
| if (video.isSuccess()) { | if (video.isSuccess()) { | ||||
| photoSpeakVideo.setSaveDir(video.getSaveDir()); | photoSpeakVideo.setSaveDir(video.getSaveDir()); | ||||
| photoSpeakVideo.setAudioPath(video.getAudioPath()); | |||||
| photoSpeakVideo.setVideoPath(video.getUrl()); | photoSpeakVideo.setVideoPath(video.getUrl()); | ||||
| this.updateById(photoSpeakVideo); | this.updateById(photoSpeakVideo); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| @@ -335,6 +336,7 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { | |||||
| try { | try { | ||||
| AiVideoHqParam param = new AiVideoHqParam(); | AiVideoHqParam param = new AiVideoHqParam(); | ||||
| param.setSave_dir(speakVideo.getSaveDir()); | param.setSave_dir(speakVideo.getSaveDir()); | ||||
| param.setAudio_path(speakVideo.getAudioPath()); | |||||
| AiVideoHqResult result = AiVideoHelper.videoHq(param); | AiVideoHqResult result = AiVideoHelper.videoHq(param); | ||||
| if (result.isSuccess()) { | if (result.isSuccess()) { | ||||
| speakVideo.setVideoHyStatus(EnumVideoStatus.success.getCode()); | speakVideo.setVideoHyStatus(EnumVideoStatus.success.getCode()); | ||||
| @@ -9,6 +9,7 @@ public class AiPhotoSpeakResult { | |||||
| private String msg; | private String msg; | ||||
| private String url; | private String url; | ||||
| private String saveDir; | private String saveDir; | ||||
| private String audioPath; | |||||
| public String getMsgInfo(Integer code, String msg) { | public String getMsgInfo(Integer code, String msg) { | ||||
| if (code == 4000 && msg.equals("img_talk success")) { | if (code == 4000 && msg.equals("img_talk success")) { | ||||
| @@ -31,8 +31,11 @@ public class AiVideoHelper { | |||||
| // http://nas.pucao.cn:2001/gen_dh_video | // http://nas.pucao.cn:2001/gen_dh_video | ||||
| public static String uri = "http://nas.pucao.cn:2001"; | public static String uri = "http://nas.pucao.cn:2001"; | ||||
| public static String url1 = "http://nas.pucao.cn:2002"; | |||||
| public static String url = "http://111.198.0.15:22299"; | |||||
| public static String url = "http://nas.pucao.cn:2002"; | |||||
| public static String hy_url = "http://nas.pucao.cn:2002"; | |||||
| // public static String url = "http://111.198.0.15:22299"; | |||||
| // public static String hy_url = "http://111.198.0.15:22288"; | |||||
| public static String photo_speak_suffix = "/img_talking"; | public static String photo_speak_suffix = "/img_talking"; | ||||
| public static String image_quality_suffix = "/image_qualit"; | public static String image_quality_suffix = "/image_qualit"; | ||||
| public static String voice_preview = "/tts_wav"; | public static String voice_preview = "/tts_wav"; | ||||
| @@ -126,9 +129,11 @@ public class AiVideoHelper { | |||||
| JSONObject data = jsonObject.getJSONObject("data"); | JSONObject data = jsonObject.getJSONObject("data"); | ||||
| String videoUrl = data.getString("url"); | String videoUrl = data.getString("url"); | ||||
| String saveDir = data.getString("save_dir"); | String saveDir = data.getString("save_dir"); | ||||
| String audioPath = data.getString("audio_path"); | |||||
| result.setSuccess(true); | result.setSuccess(true); | ||||
| result.setUrl(videoUrl); | result.setUrl(videoUrl); | ||||
| result.setSaveDir(saveDir); | result.setSaveDir(saveDir); | ||||
| result.setAudioPath(audioPath); | |||||
| String resultMsg = result.getMsgInfo(code, msg); | String resultMsg = result.getMsgInfo(code, msg); | ||||
| result.setMsg(resultMsg); | result.setMsg(resultMsg); | ||||
| } else { | } else { | ||||
| @@ -216,7 +221,7 @@ public class AiVideoHelper { | |||||
| } | } | ||||
| public static AiVideoHqResult videoHq(AiVideoHqParam param) { | public static AiVideoHqResult videoHq(AiVideoHqParam param) { | ||||
| String response = doPost(url + video_hq, JSONObject.toJSONString(param)); | |||||
| String response = doPost(hy_url + video_hq, JSONObject.toJSONString(param)); | |||||
| log.info("视频超分 end response:" + response); | log.info("视频超分 end response:" + response); | ||||
| AiVideoHqResult result = new AiVideoHqResult(); | AiVideoHqResult result = new AiVideoHqResult(); | ||||
| @@ -277,13 +282,22 @@ public class AiVideoHelper { | |||||
| // AiVideoResult video = AiVideoHelper.createVideo(videoParam); | // AiVideoResult video = AiVideoHelper.createVideo(videoParam); | ||||
| // | // | ||||
| // AiPhotoSpeakParam param = new AiPhotoSpeakParam(); | |||||
| // param.setGen_txt("人多泰达股份冲冠怒发代发"); | |||||
| // param.setImg(Base64Util.imageUrlToBase64("https://suimang.oss-accelerate.aliyuncs.com/builtin/personphoto/16564099737021232.png")); | |||||
| // param.setGender("male"); | |||||
| // param.setVoice_id("yue-CN-YunSongNeural"); | |||||
| // param.setVoice_style("default"); | |||||
| // param.setUrl("None"); | |||||
| // AiPhotoSpeakResult video = AiVideoHelper.createPhotoSpeakVideo(param); | |||||
| AiPhotoSpeakParam param = new AiPhotoSpeakParam(); | AiPhotoSpeakParam param = new AiPhotoSpeakParam(); | ||||
| param.setGen_txt("人多泰达股份冲冠怒发代发"); | |||||
| param.setImg(Base64Util.imageUrlToBase64("https://suimang.oss-accelerate.aliyuncs.com/builtin/personphoto/16564099737021232.png")); | |||||
| param.setGender("male"); | |||||
| param.setVoice_id("yue-CN-YunSongNeural"); | |||||
| param.setGen_txt("None"); | |||||
| param.setImg(Base64Util.imageUrlToBase64("https://suimang.oss-accelerate.aliyuncs.com/builtin/personphoto/seed50258.png")); | |||||
| param.setGender("None"); | |||||
| param.setVoice_id("default"); | |||||
| param.setVoice_style("default"); | param.setVoice_style("default"); | ||||
| param.setUrl("None"); | |||||
| param.setUrl("https://video.metavatar.cc/sv/43a5c16d-189251d6a98/43a5c16d-189251d6a98.mp3"); | |||||
| AiPhotoSpeakResult video = AiVideoHelper.createPhotoSpeakVideo(param); | AiPhotoSpeakResult video = AiVideoHelper.createPhotoSpeakVideo(param); | ||||
| // AiCheckPhotoParam param = new AiCheckPhotoParam(); | // AiCheckPhotoParam param = new AiCheckPhotoParam(); | ||||
| @@ -5,5 +5,6 @@ import lombok.Data; | |||||
| @Data | @Data | ||||
| public class AiVideoHqParam { | public class AiVideoHqParam { | ||||
| private String save_dir; | private String save_dir; | ||||
| private String audio_path; | |||||
| } | } | ||||