main
HuangHai 3 months ago
parent 48e5b66713
commit cf386bab76

@ -17,10 +17,14 @@ import static com.dsideal.aiSupport.AiSupportApplication.getEnvPrefix;
/** /**
* API * API
*/ */
public class video_style_transform { public class VideoStyleTransform {
private static final Logger log = LoggerFactory.getLogger(video_style_transform.class); 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_URL = "https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis";
private static final String API_KEY; 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; // 配置文件工具 public static Prop PropKit; // 配置文件工具
@ -248,13 +252,10 @@ public class video_style_transform {
// 如果获取到了视频URL则下载保存 // 如果获取到了视频URL则下载保存
if (resultVideoUrl != null && !resultVideoUrl.isEmpty()) { if (resultVideoUrl != null && !resultVideoUrl.isEmpty()) {
// 创建保存目录
String saveDir = System.getProperty("user.dir") + "/style_videos";
// 生成文件名使用时间戳和任务ID // 生成文件名使用时间戳和任务ID
String fileName = "style_" + System.currentTimeMillis() + "_" + taskId + ".mp4"; String fileName = "style_" + System.currentTimeMillis() + "_" + taskId + ".mp4";
// 完整保存路径 // 完整保存路径
String savePath = saveDir + "/" + fileName; String savePath = basePath + "/" + fileName;
// 下载视频 // 下载视频
downloadVideo(resultVideoUrl, savePath); downloadVideo(resultVideoUrl, savePath);
} }
Loading…
Cancel
Save