main
HuangHai 2 months ago
parent a43f8f8692
commit 986ad76d42

@ -103,21 +103,21 @@ public class ImgSpeak {
/** /**
* LivePortraitAPI * LivePortraitAPI
* *
* @param imageUrl URL * @param imageUrl URL
* @param audioUrl URL * @param audioUrl URL
* @param templateId IDnormal, dance, rap * @param templateId IDnormal, dance, rap
* @param eyeMoveFreq 0-1 * @param eyeMoveFreq 0-1
* @param videoFps 30 * @param videoFps 30
* @param mouthMoveStrength 0-1 * @param mouthMoveStrength 0-1
* @param pasteBack truefalse * @param pasteBack truefalse
* @param headMoveStrength 0-1 * @param headMoveStrength 0-1
* @return ID * @return ID
* @throws Exception * @throws Exception
*/ */
@SneakyThrows @SneakyThrows
public static String synthesisVideo(String imageUrl, String audioUrl, String templateId, public static String synthesisVideo(String imageUrl, String audioUrl, String templateId,
double eyeMoveFreq, int videoFps, double mouthMoveStrength, double eyeMoveFreq, int videoFps, double mouthMoveStrength,
boolean pasteBack, double headMoveStrength) { boolean pasteBack, double headMoveStrength) {
// 先进行人脸检测 // 先进行人脸检测
detectFace(imageUrl); detectFace(imageUrl);
@ -303,7 +303,7 @@ public class ImgSpeak {
// 调用灵动人像LivePortrait视频合成API // 调用灵动人像LivePortrait视频合成API
String taskId = synthesisVideo(imageUrl, audioUrl, templateId, eyeMoveFreq, String taskId = synthesisVideo(imageUrl, audioUrl, templateId, eyeMoveFreq,
videoFps, mouthMoveStrength, pasteBack, headMoveStrength); videoFps, mouthMoveStrength, pasteBack, headMoveStrength);
// 轮询查询任务状态 // 轮询查询任务状态
int maxRetries = 100; int maxRetries = 100;
@ -325,7 +325,6 @@ public class ImgSpeak {
double videoDuration = result.getJSONObject("usage").getDoubleValue("video_duration"); double videoDuration = result.getJSONObject("usage").getDoubleValue("video_duration");
String videoRatio = result.getJSONObject("usage").getString("video_ratio"); String videoRatio = result.getJSONObject("usage").getString("video_ratio");
log.info("视频时长: {}秒, 视频比例: {}", videoDuration, videoRatio); log.info("视频时长: {}秒, 视频比例: {}", videoDuration, videoRatio);
break; break;
} else if ("FAILED".equals(status)) { } else if ("FAILED".equals(status)) {
// 任务失败 // 任务失败

Loading…
Cancel
Save