|
|
|
@ -17,10 +17,14 @@ import static com.dsideal.aiSupport.AiSupportApplication.getEnvPrefix;
|
|
|
|
|
/**
|
|
|
|
|
* 阿里云达摩院视频风格转换API工具类
|
|
|
|
|
*/
|
|
|
|
|
public class video_style_transform {
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(video_style_transform.class);
|
|
|
|
|
public class VideoStyleTransform {
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(VideoStyleTransform.class);
|
|
|
|
|
private static final String API_URL = "https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis";
|
|
|
|
|
private static final String API_KEY;
|
|
|
|
|
// 获取项目根目录路径
|
|
|
|
|
protected static String projectRoot = System.getProperty("user.dir").replace("\\", "/") + "/dsAiSupport";
|
|
|
|
|
// 拼接相对路径
|
|
|
|
|
protected static String basePath = projectRoot + "/src/main/java/com/dsideal/aiSupport/Util/DashScope/Example/";
|
|
|
|
|
|
|
|
|
|
public static Prop PropKit; // 配置文件工具
|
|
|
|
|
|
|
|
|
@ -248,13 +252,10 @@ public class video_style_transform {
|
|
|
|
|
|
|
|
|
|
// 如果获取到了视频URL,则下载保存
|
|
|
|
|
if (resultVideoUrl != null && !resultVideoUrl.isEmpty()) {
|
|
|
|
|
// 创建保存目录
|
|
|
|
|
String saveDir = System.getProperty("user.dir") + "/style_videos";
|
|
|
|
|
// 生成文件名(使用时间戳和任务ID)
|
|
|
|
|
String fileName = "style_" + System.currentTimeMillis() + "_" + taskId + ".mp4";
|
|
|
|
|
// 完整保存路径
|
|
|
|
|
String savePath = saveDir + "/" + fileName;
|
|
|
|
|
|
|
|
|
|
String savePath = basePath + "/" + fileName;
|
|
|
|
|
// 下载视频
|
|
|
|
|
downloadVideo(resultVideoUrl, savePath);
|
|
|
|
|
}
|