yumeng 2 лет назад
Родитель
Сommit
f6f9428736

+ 20 - 0
pom.xml

@@ -33,6 +33,11 @@
 <!--            </exclusions>-->
 <!--            </exclusions>-->
         </dependency>
         </dependency>
         <dependency>
         <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <version>25.0-jre</version>
+        </dependency>
+        <dependency>
             <groupId>org.slf4j</groupId>
             <groupId>org.slf4j</groupId>
             <artifactId>jcl-over-slf4j</artifactId>
             <artifactId>jcl-over-slf4j</artifactId>
         </dependency>
         </dependency>
@@ -138,6 +143,21 @@
             <artifactId>log4j</artifactId>
             <artifactId>log4j</artifactId>
             <version>1.2.17</version>
             <version>1.2.17</version>
         </dependency>
         </dependency>
+
+        <dependency>
+            <groupId>com.tencentcloudapi</groupId>
+            <artifactId>tencentcloud-sdk-java</artifactId>
+            <!-- go to https://search.maven.org/search?q=tencentcloud-sdk-java and get the latest version. -->
+            <!-- 请到https://search.maven.org/search?q=tencentcloud-sdk-java查询所有版本,最新版本如下 -->
+            <version>3.1.414</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.qcloud</groupId>
+            <artifactId>vod_api</artifactId>
+            <version>2.1.4</version>
+        </dependency>
+
     </dependencies>
     </dependencies>
     <build>
     <build>
         <plugins>
         <plugins>

+ 103 - 0
src/main/java/cn/com/ctop/track/controller/MaterialController.java

@@ -0,0 +1,103 @@
+package cn.com.ctop.track.controller;
+
+import cn.com.ctop.track.service.MediaService;
+import com.alibaba.fastjson.JSONArray;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+@Controller
+@RequestMapping("/video")
+public class MaterialController {
+    @Autowired
+    private MediaService mediaService;
+
+
+
+    @ResponseBody
+    @RequestMapping(value = "/test")
+    public void test() throws Exception {
+        mediaService.test();
+
+
+    }
+
+
+    @ResponseBody
+    @RequestMapping(value = "/test2")
+    public void test2() throws Exception {
+        mediaService.test2();
+
+    }
+
+
+    @ResponseBody
+    @RequestMapping(value = "/test3")
+    public void test3() throws Exception {
+        mediaService.test3();
+
+    }
+
+    @ResponseBody
+    @RequestMapping(value = "/test4")
+    public void test4() throws Exception {
+        mediaService.test4();
+
+    }
+
+
+
+
+    @ResponseBody
+    @RequestMapping(value = "/upload")
+    public void upload() throws Exception {
+        mediaService.vodUpload();
+
+    }
+
+    // 视频拼接
+    @ResponseBody
+    @RequestMapping(value = "/editMedia")
+    public void editMedia() throws Exception {
+
+       // mediaService.editMedia();
+    }
+
+    // 获取视频合成任务列表
+
+    @ResponseBody
+    @RequestMapping(value = "/getTask")
+    public void getTask(String taskId) throws Exception {
+
+        mediaService.getTask(taskId);
+    }
+
+    // 视频拆条
+    @ResponseBody
+    @RequestMapping(value = "/splitMedia")
+    public void splitMedia(String fileId) throws Exception {
+        mediaService.splitMedia(fileId);
+    }
+
+    // 视频合成 替换音轨
+    @ResponseBody
+    @RequestMapping(value = "/composeMedia")
+    public void composeMedia(String fileId) throws Exception {
+        JSONArray videoArray = new JSONArray();
+      //  videoArray.add("387702292666447535");
+        videoArray.add("387702292980880553");
+
+
+        JSONArray AudioArray = new JSONArray();
+       // AudioArray.add("387702292668811825");
+        AudioArray.add("387702292669379335");
+
+        Integer videoMute = 1;
+
+
+        mediaService.composeMedia(videoArray, AudioArray, videoMute);
+    }
+
+
+}

+ 3 - 2
src/main/java/cn/com/ctop/track/controller/TrackController.java

@@ -26,6 +26,7 @@ public class TrackController {
     @Autowired
     @Autowired
     private ConvertInfoService convertInfoService;
     private ConvertInfoService convertInfoService;
 
 
+
     @ResponseBody
     @ResponseBody
     @RequestMapping(value = "/convert")
     @RequestMapping(value = "/convert")
     public String convert(HttpServletRequest request,
     public String convert(HttpServletRequest request,
@@ -306,7 +307,7 @@ public class TrackController {
             if (os != null) {
             if (os != null) {
                 if (os.equals("Android")) {
                 if (os.equals("Android")) {
                     imeiMd5 = request.getParameter("imei_md5");
                     imeiMd5 = request.getParameter("imei_md5");
-                    oaid = request.getParameter("oaid");
+                    oaid = request.getParameter("oaidMd5");
                 } else if (os.equals("IOS")) {
                 } else if (os.equals("IOS")) {
                     idfaMd5 = request.getParameter("idfa_md5");
                     idfaMd5 = request.getParameter("idfa_md5");
                 }
                 }
@@ -326,7 +327,7 @@ public class TrackController {
                 if (transformType.equals("2")) {
                 if (transformType.equals("2")) {
                     if (platform != null && platform.equals("bytedance")) {
                     if (platform != null && platform.equals("bytedance")) {
                         callbackUrl = "https://ad.oceanengine.com/track/activate/?callback=" + callbackUrl;
                         callbackUrl = "https://ad.oceanengine.com/track/activate/?callback=" + callbackUrl;
-                        callbackUrl = callbackUrl + "&event_type=1&conv_time=" + new Date().getTime() + "&imei=" + imeiMd5 + "&oaid=" + oaid;
+                        callbackUrl = callbackUrl + "&event_type=1&conv_time=" + new Date().getTime() + "&imei=" + imeiMd5 + "&oaidMd5=" + oaid;
                     } else if (platform != null && platform.equals("kuaishou")) {
                     } else if (platform != null && platform.equals("kuaishou")) {
                         callbackUrl = callbackUrl + "&event_type=2&event_time=" + new Date().getTime();
                         callbackUrl = callbackUrl + "&event_type=2&event_time=" + new Date().getTime();
                     }
                     }

+ 24 - 0
src/main/java/cn/com/ctop/track/service/MediaService.java

@@ -0,0 +1,24 @@
+package cn.com.ctop.track.service;
+
+import com.alibaba.fastjson.JSONArray;
+
+public interface MediaService {
+
+    void vodUpload() throws Exception;
+
+    void editMedia(JSONArray ids, String fileName);
+
+    void getTask(String taskId);
+
+    void splitMedia(String fileId);
+
+    void composeMedia(JSONArray videoArray, JSONArray AudioArray, Integer videoMute);
+
+    void test();
+
+    void test2();
+
+    void test3();
+
+    void test4();
+}

+ 749 - 0
src/main/java/cn/com/ctop/track/service/impl/MediaServiceImpl.java

@@ -0,0 +1,749 @@
+package cn.com.ctop.track.service.impl;
+
+import cn.com.ctop.track.service.MediaService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.google.common.collect.Lists;
+import com.qcloud.vod.VodUploadClient;
+import com.qcloud.vod.model.VodUploadRequest;
+import com.qcloud.vod.model.VodUploadResponse;
+import com.tencentcloudapi.common.Credential;
+import com.tencentcloudapi.common.exception.TencentCloudSDKException;
+import com.tencentcloudapi.common.profile.ClientProfile;
+import com.tencentcloudapi.common.profile.HttpProfile;
+import com.tencentcloudapi.vod.v20180717.VodClient;
+import com.tencentcloudapi.vod.v20180717.models.*;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.util.List;
+
+import static java.util.Collections.shuffle;
+
+
+@Service
+@Slf4j
+public class MediaServiceImpl implements MediaService {
+
+    public static Integer count = 0;
+    public static Integer qianIndex = 0;
+    public static Integer houIndex = 0;
+
+    @Override
+    public void test() {
+        VodUploadClient client = new VodUploadClient("AKIDPcZGgphIcfRxCF1XmjQqzqRlnY3GCrFN", "tVqvjFUS9ZhY8RTEiJeiV1GEvMVNyJM8");
+        JSONArray qianTieArray = new JSONArray();
+        String qianTiePath = "D:\\file\\a";
+        JSONArray files = getFiles(qianTiePath);
+        for (int i = 0; i < files.size(); i++) {
+            VodUploadRequest request = new VodUploadRequest();
+            request.setMediaFilePath(files.getString(i));
+            try {
+                VodUploadResponse response = client.upload("ap-chongqing", request);
+                //    log.info("Upload FileId = {}", response.getFileId());
+                qianTieArray.add(response.getFileId());
+                Thread.sleep(500);
+            } catch (Exception e) {
+                // 业务方进行异常处理
+                log.error("Upload Err", e);
+            }
+        }
+        JSONArray houTieArray = new JSONArray();
+        String houTiePath = "D:\\file\\b";
+        JSONArray houTieFiles = getFiles(houTiePath);
+        for (int i = 0; i < houTieFiles.size(); i++) {
+            VodUploadRequest request = new VodUploadRequest();
+            request.setMediaFilePath(houTieFiles.getString(i));
+            try {
+                VodUploadResponse response = client.upload("ap-chongqing", request);
+//                log.info("Upload FileId = {}", response.getFileId());
+                houTieArray.add(response.getFileId());
+                Thread.sleep(500);
+            } catch (Exception e) {
+                // 业务方进行异常处理
+                log.error("Upload Err", e);
+            }
+        }
+        for (int i = 0; i < qianTieArray.size(); i++) {
+            String s = qianTieArray.getString(i);
+            list2(qianTieArray, s, houTieArray);
+        }
+    }
+
+    private List<String> list2(JSONArray list, String value, JSONArray houTieArray) {
+        for (int i = 0; i < list.size(); i++) {
+            String s = list.getString(i);
+            if (s.equals(value)) {
+                continue;
+            }
+            this.list3(list, value, s, houTieArray);
+        }
+        return null;
+    }
+
+
+    private List<String> list3(JSONArray list, String value1, String value2, JSONArray houTieArray) {
+        for (int i = 0; i < list.size(); i++) {
+            String value3 = list.getString(i);
+            if (value3.equals(value1) || value3.equals(value2)) {
+                continue;
+            }
+            for (int j = 0; j < houTieArray.size(); j++) {
+                String houtie = houTieArray.getString(j);
+                JSONArray jieGuoList = new JSONArray();
+                jieGuoList.add(value1);
+                jieGuoList.add(value2);
+                jieGuoList.add(value3);
+                jieGuoList.add(houtie);
+                count++;
+                this.editMedia(jieGuoList, "束荣莉-金曲-四批次" + "_" + count);
+                System.err.println(count);
+            }
+        }
+        return null;
+
+    }
+
+
+    @Override
+    public void vodUpload() throws Exception {
+        VodUploadClient client = new VodUploadClient("AKIDPcZGgphIcfRxCF1XmjQqzqRlnY3GCrFN", "tVqvjFUS9ZhY8RTEiJeiV1GEvMVNyJM8");
+        JSONArray qianTieArray = new JSONArray();
+        String qianTiePath = "D:\\file\\a";
+        JSONArray files = getFiles(qianTiePath);
+        for (int i = 0; i < files.size(); i++) {
+            VodUploadRequest request = new VodUploadRequest();
+            request.setMediaFilePath(files.getString(i));
+            try {
+                VodUploadResponse response = client.upload("ap-chongqing", request);
+                //    log.info("Upload FileId = {}", response.getFileId());
+                qianTieArray.add(response.getFileId());
+                Thread.sleep(500);
+            } catch (Exception e) {
+                // 业务方进行异常处理
+                log.error("Upload Err", e);
+            }
+        }
+        JSONArray houTieArray = new JSONArray();
+        String houTiePath = "D:\\file\\b";
+        JSONArray houTieFiles = getFiles(houTiePath);
+        for (int i = 0; i < houTieFiles.size(); i++) {
+            VodUploadRequest request = new VodUploadRequest();
+            request.setMediaFilePath(houTieFiles.getString(i));
+            try {
+                VodUploadResponse response = client.upload("ap-chongqing", request);
+//                log.info("Upload FileId = {}", response.getFileId());
+                houTieArray.add(response.getFileId());
+                Thread.sleep(500);
+            } catch (Exception e) {
+                // 业务方进行异常处理
+                log.error("Upload Err", e);
+            }
+        }
+
+        Integer count = 0;
+        for (int i = 0; i < qianTieArray.size(); i++) {
+            String qianTieFileId = qianTieArray.getString(i);
+            for (int j = 0; j < houTieArray.size(); j++) {
+                String houtieFileId = houTieArray.getString(j);
+
+                JSONArray ids = new JSONArray();
+                ids.add(qianTieFileId);
+                ids.add(houtieFileId);
+                editMedia(ids, "来玩削削削_女_" + count);
+                count++;
+                System.err.println(count);
+            }
+        }
+
+
+    }
+
+
+    @Override
+    public void test2() {
+
+        VodUploadClient client = new VodUploadClient("AKIDPcZGgphIcfRxCF1XmjQqzqRlnY3GCrFN", "tVqvjFUS9ZhY8RTEiJeiV1GEvMVNyJM8");
+        JSONArray qianTieArray = new JSONArray();
+        String qianTiePath = "D:\\file\\a";
+        JSONArray files = getFiles(qianTiePath);
+        for (int i = 0; i < files.size(); i++) {
+            VodUploadRequest request = new VodUploadRequest();
+            request.setMediaFilePath(files.getString(i));
+            try {
+                VodUploadResponse response = client.upload("ap-chongqing", request);
+                //    log.info("Upload FileId = {}", response.getFileId());
+                qianTieArray.add(response.getFileId());
+                Thread.sleep(500);
+            } catch (Exception e) {
+                // 业务方进行异常处理
+                log.error("Upload Err", e);
+            }
+        }
+        JSONArray zhongList = new JSONArray();
+        String zhongTiePath = "D:\\file\\b";
+        JSONArray zhongFiles = getFiles(zhongTiePath);
+        for (int i = 0; i < zhongFiles.size(); i++) {
+            VodUploadRequest request = new VodUploadRequest();
+            request.setMediaFilePath(zhongFiles.getString(i));
+            try {
+                VodUploadResponse response = client.upload("ap-chongqing", request);
+//                log.info("Upload FileId = {}", response.getFileId());
+                zhongList.add(response.getFileId());
+                Thread.sleep(500);
+            } catch (Exception e) {
+                // 业务方进行异常处理
+                log.error("Upload Err", e);
+            }
+        }
+
+
+/*        List<String> houList = new ArrayList<>();
+        String houTiePath = "D:\\file\\c";
+        JSONArray houTieFiles = getFiles(houTiePath);
+        for (int i = 0; i < houTieFiles.size(); i++) {
+            VodUploadRequest request = new VodUploadRequest();
+            request.setMediaFilePath(houTieFiles.getString(i));
+            try {
+                VodUploadResponse response = client.upload("ap-chongqing", request);
+//                log.info("Upload FileId = {}", response.getFileId());
+                houList.add(response.getFileId());
+                Thread.sleep(500);
+            } catch (Exception e) {
+                // 业务方进行异常处理
+                log.error("Upload Err", e);
+            }
+        }*/
+
+
+        for (int i = 0; i < zhongList.size(); i++) {
+            String s = zhongList.getString(i);
+            JSONArray array = pipei1(i, s, qianTieArray);
+            //  JSONArray array1 = pipei2(i, houList, array);
+            editMedia(array, "乐刷刷_06-01_女_" + count);
+            count++;
+            System.err.println(count);
+
+        }
+
+
+    }
+
+    @Override
+    public void test3() {
+        VodUploadClient client = new VodUploadClient("AKIDPcZGgphIcfRxCF1XmjQqzqRlnY3GCrFN", "tVqvjFUS9ZhY8RTEiJeiV1GEvMVNyJM8");
+        JSONArray qianTieArray = new JSONArray();
+        String qianTiePath = "D:\\file\\a";
+        JSONArray files = getFiles(qianTiePath);
+        for (int i = 0; i < files.size(); i++) {
+            VodUploadRequest request = new VodUploadRequest();
+            request.setMediaFilePath(files.getString(i));
+            try {
+                VodUploadResponse response = client.upload("ap-chongqing", request);
+                //    log.info("Upload FileId = {}", response.getFileId());
+                qianTieArray.add(response.getFileId());
+                Thread.sleep(500);
+            } catch (Exception e) {
+                // 业务方进行异常处理
+                log.error("Upload Err", e);
+            }
+        }
+
+
+        JSONArray houTieArray = new JSONArray();
+        String houTiePath = "D:\\file\\b";
+        JSONArray houTieFiles = getFiles(houTiePath);
+        for (int i = 0; i < houTieFiles.size(); i++) {
+            VodUploadRequest request = new VodUploadRequest();
+            request.setMediaFilePath(houTieFiles.getString(i));
+            try {
+                VodUploadResponse response = client.upload("ap-chongqing", request);
+//                log.info("Upload FileId = {}", response.getFileId());
+                houTieArray.add(response.getFileId());
+                Thread.sleep(500);
+            } catch (Exception e) {
+                // 业务方进行异常处理
+                log.error("Upload Err", e);
+            }
+        }
+
+
+        List<List<Object>> partition = Lists.partition(qianTieArray, 3);
+        for (int i = 0; i < partition.size(); i++) {
+            List<Object> objects = partition.get(i);
+            JSONArray array = JSONArray.parseArray(String.valueOf(objects));
+            houTiePipei(array, houTieArray);
+        }
+
+
+        shuffle(qianTieArray);
+        List<List<Object>> partition1 = Lists.partition(qianTieArray, 3);
+        for (int i = 0; i < partition1.size(); i++) {
+            List<Object> objects = partition1.get(i);
+            JSONArray array = JSONArray.parseArray(String.valueOf(objects));
+            houTiePipei(array, houTieArray);
+        }
+
+
+        shuffle(qianTieArray);
+        List<List<Object>> partition2 = Lists.partition(qianTieArray, 3);
+        for (int i = 0; i < partition2.size(); i++) {
+            List<Object> objects = partition2.get(i);
+            JSONArray array = JSONArray.parseArray(String.valueOf(objects));
+            houTiePipei(array, houTieArray);
+        }
+
+    }
+
+    @Override
+    public void test4() {
+        VodUploadClient client = new VodUploadClient("AKIDPcZGgphIcfRxCF1XmjQqzqRlnY3GCrFN", "tVqvjFUS9ZhY8RTEiJeiV1GEvMVNyJM8");
+        JSONArray qianTieArray = new JSONArray();
+        String qianTiePath = "D:\\file\\a";
+        JSONArray files = getFiles(qianTiePath);
+        for (int i = 0; i < files.size(); i++) {
+            VodUploadRequest request = new VodUploadRequest();
+            request.setMediaFilePath(files.getString(i));
+            try {
+                VodUploadResponse response = client.upload("ap-chongqing", request);
+                //    log.info("Upload FileId = {}", response.getFileId());
+                qianTieArray.add(response.getFileId());
+                Thread.sleep(500);
+            } catch (Exception e) {
+                // 业务方进行异常处理
+                log.error("Upload Err", e);
+            }
+        }
+        JSONArray houTieArray = new JSONArray();
+        String houTiePath = "D:\\file\\b";
+        JSONArray houTieFiles = getFiles(houTiePath);
+        for (int i = 0; i < houTieFiles.size(); i++) {
+            VodUploadRequest request = new VodUploadRequest();
+            request.setMediaFilePath(houTieFiles.getString(i));
+            try {
+                VodUploadResponse response = client.upload("ap-chongqing", request);
+//                log.info("Upload FileId = {}", response.getFileId());
+                houTieArray.add(response.getFileId());
+                Thread.sleep(500);
+            } catch (Exception e) {
+                // 业务方进行异常处理
+                log.error("Upload Err", e);
+            }
+        }
+
+
+        for (int i = 0; i < houTieArray.size(); i++) {
+
+            String b = houTieArray.getString(i);
+            JSONArray array = pipei4(i, b, qianTieArray);
+            editMedia(array, "金曲多多-2022-07-04" + i);
+
+        }
+
+
+    }
+
+
+    private JSONArray pipei4(Integer index, String b, JSONArray array) {
+        JSONArray ids = new JSONArray();
+        int size = array.size() - 1;
+        if (index <= size) {
+            String s = array.getString(index);
+            ids.add(s);
+            ids.add(b);
+        } else {
+            String s = array.getString(qianIndex);
+            qianIndex++;
+            if (qianIndex == size + 1) {
+                qianIndex = 0;
+            }
+            ids.add(s);
+            ids.add(b);
+
+        }
+        return ids;
+    }
+
+
+    private void houTiePipei(JSONArray qiantieArray, JSONArray houtieArray) {
+        if (qiantieArray.size() < 3) {
+            return;
+        }
+        for (int i = 0; i < houtieArray.size(); i++) {
+            String string = houtieArray.getString(i);
+            JSONArray qiantie = JSONArray.parseArray(qiantieArray.toJSONString());
+            qiantie.add(string);
+            System.err.println(count);
+            editMedia(qiantie, "2022-06-17_金曲_" + count);
+            count++;
+
+        }
+
+
+    }
+
+
+    private JSONArray pipei1(Integer index, String value, JSONArray qianList) {
+
+        JSONArray ids = new JSONArray();
+        int size = qianList.size() - 1;
+        if (index <= size) {
+            String s = qianList.getString(index);
+            ids.add(s);
+            ids.add(value);
+        } else {
+            String s = qianList.getString(qianIndex);
+            qianIndex++;
+            if (qianIndex == size + 1) {
+                qianIndex = 0;
+            }
+            ids.add(s);
+            ids.add(value);
+
+        }
+        return ids;
+
+    }
+
+
+    private JSONArray pipei2(Integer index, List<String> houList, JSONArray ids) {
+
+
+        int size = houList.size() - 1;
+        if (index <= size) {
+            String s = houList.get(index);
+            ids.add(s);
+
+        } else {
+            String s = houList.get(houIndex);
+            houIndex++;
+            if (houIndex == size + 1) {
+                houIndex = 0;
+            }
+            ids.add(s);
+
+
+        }
+        return ids;
+
+    }
+
+
+    @Override
+    public void editMedia(JSONArray ids, String fileName) {
+        try {
+            // 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey,此处还需注意密钥对的保密
+            // 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取
+            Credential cred = new Credential("AKIDPcZGgphIcfRxCF1XmjQqzqRlnY3GCrFN", "tVqvjFUS9ZhY8RTEiJeiV1GEvMVNyJM8");
+            // 实例化一个http选项,可选的,没有特殊需求可以跳过
+            HttpProfile httpProfile = new HttpProfile();
+            httpProfile.setEndpoint("vod.tencentcloudapi.com");
+            // 实例化一个client选项,可选的,没有特殊需求可以跳过
+            ClientProfile clientProfile = new ClientProfile();
+            clientProfile.setHttpProfile(httpProfile);
+            // 实例化要请求产品的client对象,clientProfile是可选的
+            VodClient client = new VodClient(cred, "", clientProfile);
+            // 实例化一个请求对象,每个接口都会对应一个request对象
+            EditMediaRequest req = new EditMediaRequest();
+            // 返回的resp是一个EditMediaResponse的实例,与请求对象对应
+            JSONArray fileArray = new JSONArray();
+           /* JSONArray ids = new JSONArray();
+            ids.add(fileId1);
+            ids.add(fileId2);*/
+            for (int i = 0; i < ids.size(); i++) {
+                JSONObject fileJson = new JSONObject();
+                fileJson.put("FileId", ids.getString(i));
+                fileArray.add(fileJson);
+            }
+            req.set("FileInfos", fileArray);
+            req.setInputType("File");
+            EditMediaOutputConfig editMediaOutputConfig1 = new EditMediaOutputConfig();
+            editMediaOutputConfig1.setMediaName(fileName);
+            req.setOutputConfig(editMediaOutputConfig1);
+            EditMediaResponse resp = client.EditMedia(req);
+            // 输出json格式的字符串回包
+            System.out.println(EditMediaResponse.toJsonString(resp));
+        } catch (TencentCloudSDKException e) {
+            System.out.println(e.toString());
+        }
+    }
+
+    @Override
+    public void getTask(String taskId) {
+        try {
+            // 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey,此处还需注意密钥对的保密
+            // 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取
+            Credential cred = new Credential("AKIDPcZGgphIcfRxCF1XmjQqzqRlnY3GCrFN", "tVqvjFUS9ZhY8RTEiJeiV1GEvMVNyJM8");
+            // 实例化一个http选项,可选的,没有特殊需求可以跳过
+            HttpProfile httpProfile = new HttpProfile();
+            httpProfile.setEndpoint("vod.tencentcloudapi.com");
+            // 实例化一个client选项,可选的,没有特殊需求可以跳过
+            ClientProfile clientProfile = new ClientProfile();
+            clientProfile.setHttpProfile(httpProfile);
+            // 实例化要请求产品的client对象,clientProfile是可选的
+            VodClient client = new VodClient(cred, "", clientProfile);
+            // 实例化一个请求对象,每个接口都会对应一个request对象
+            DescribeTaskDetailRequest req = new DescribeTaskDetailRequest();
+            req.setTaskId(taskId);
+
+            // 返回的resp是一个DescribeTaskDetailResponse的实例,与请求对象对应
+            DescribeTaskDetailResponse resp = client.DescribeTaskDetail(req);
+            // 输出json格式的字符串回包
+            System.out.println(DescribeTaskDetailResponse.toJsonString(resp));
+        } catch (TencentCloudSDKException e) {
+            System.out.println(e.toString());
+        }
+    }
+
+    @Override
+    public void splitMedia(String fileId) {
+        try {
+            // 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey,此处还需注意密钥对的保密
+            // 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取
+            Credential cred = new Credential("AKIDPcZGgphIcfRxCF1XmjQqzqRlnY3GCrFN", "tVqvjFUS9ZhY8RTEiJeiV1GEvMVNyJM8");
+            // 实例化一个http选项,可选的,没有特殊需求可以跳过
+            HttpProfile httpProfile = new HttpProfile();
+            httpProfile.setEndpoint("vod.tencentcloudapi.com");
+            // 实例化一个client选项,可选的,没有特殊需求可以跳过
+            ClientProfile clientProfile = new ClientProfile();
+            clientProfile.setHttpProfile(httpProfile);
+            // 实例化要请求产品的client对象,clientProfile是可选的
+            VodClient client = new VodClient(cred, "", clientProfile);
+            // 实例化一个请求对象,每个接口都会对应一个request对象
+            SplitMediaRequest req = new SplitMediaRequest();
+            req.setFileId(fileId);
+
+
+            JSONArray array = new JSONArray();
+           /* JSONObject splitJson = new JSONObject();
+            splitJson.put("StartTimeOffset", 0);
+            splitJson.put("EndTimeOffset", 2);
+
+
+            JSONObject splitJson1 = new JSONObject();
+            splitJson1.put("StartTimeOffset", 3);
+            splitJson1.put("EndTimeOffset", 26);*/
+
+
+            JSONObject splitJson2 = new JSONObject();
+            splitJson2.put("StartTimeOffset", 28.5);
+            splitJson2.put("EndTimeOffset", 31);
+        /*    array.add(splitJson);
+            array.add(splitJson1);*/
+            array.add(splitJson2);
+            req.set("Segments", array);
+            // 返回的resp是一个SplitMediaResponse的实例,与请求对象对应
+            SplitMediaResponse resp = client.SplitMedia(req);
+            // 输出json格式的字符串回包
+            System.out.println(SplitMediaResponse.toJsonString(resp));
+        } catch (TencentCloudSDKException e) {
+            System.out.println(e.toString());
+        }
+    }
+
+    @Override
+    public void composeMedia(JSONArray videoArray, JSONArray audioArray, Integer videoMute) {
+        try {
+            // 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey,此处还需注意密钥对的保密
+            // 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取
+            Credential cred = new Credential("AKIDPcZGgphIcfRxCF1XmjQqzqRlnY3GCrFN", "tVqvjFUS9ZhY8RTEiJeiV1GEvMVNyJM8");
+            // 实例化一个http选项,可选的,没有特殊需求可以跳过
+            HttpProfile httpProfile = new HttpProfile();
+            httpProfile.setEndpoint("vod.tencentcloudapi.com");
+            // 实例化一个client选项,可选的,没有特殊需求可以跳过
+            ClientProfile clientProfile = new ClientProfile();
+            clientProfile.setHttpProfile(httpProfile);
+            // 实例化要请求产品的client对象,clientProfile是可选的
+            VodClient client = new VodClient(cred, "", clientProfile);
+            // 实例化一个请求对象,每个接口都会对应一个request对象
+            ComposeMediaRequest req = new ComposeMediaRequest();
+            for (int i = 0; i < videoArray.size(); i++) {
+                String videoId = videoArray.getString(i);
+                for (int j = 0; j < audioArray.size(); j++) {
+                    String audioId = audioArray.getString(j);
+
+
+                    MediaTrack[] mediaTracks1 = new MediaTrack[2];
+                    MediaTrack mediaTrack1 = new MediaTrack();
+                    mediaTrack1.setType("Video");
+
+                    MediaTrackItem[] mediaTrackItems1 = new MediaTrackItem[1];
+                    MediaTrackItem mediaTrackItem1 = new MediaTrackItem();
+                    mediaTrackItem1.setType("Video");
+                    VideoTrackItem videoTrackItem1 = new VideoTrackItem();
+                    videoTrackItem1.setSourceMedia(videoId);
+
+                    AudioTransform[] audioTransforms1 = new AudioTransform[1];
+                    AudioTransform audioTransform1 = new AudioTransform();
+                    audioTransform1.setType("Volume");
+                    AudioVolumeParam audioVolumeParam1 = new AudioVolumeParam();
+                    audioVolumeParam1.setMute(Long.valueOf(videoMute));
+                    audioTransform1.setVolumeParam(audioVolumeParam1);
+
+                    audioTransforms1[0] = audioTransform1;
+
+                    videoTrackItem1.setAudioOperations(audioTransforms1);
+
+                    mediaTrackItem1.setVideoItem(videoTrackItem1);
+
+                    AudioTrackItem audioTrackItem1 = new AudioTrackItem();
+                    audioTrackItem1.setSourceMedia(audioId);
+
+                    mediaTrackItem1.setAudioItem(audioTrackItem1);
+
+                    mediaTrackItems1[0] = mediaTrackItem1;
+
+                    mediaTrack1.setTrackItems(mediaTrackItems1);
+
+                    mediaTracks1[0] = mediaTrack1;
+
+                    MediaTrack mediaTrack2 = new MediaTrack();
+                    mediaTrack2.setType("Audio");
+
+                    MediaTrackItem[] mediaTrackItems2 = new MediaTrackItem[1];
+                    MediaTrackItem mediaTrackItem2 = new MediaTrackItem();
+                    mediaTrackItem2.setType("Audio");
+                    AudioTrackItem audioTrackItem2 = new AudioTrackItem();
+                    audioTrackItem2.setSourceMedia(audioId);
+                    audioTrackItem2.setSourceMediaStartTime(51F);
+                    audioTrackItem2.setDuration(81F);
+
+                    mediaTrackItem2.setAudioItem(audioTrackItem2);
+
+                    mediaTrackItems2[0] = mediaTrackItem2;
+                    mediaTrack2.setTrackItems(mediaTrackItems2);
+                    mediaTracks1[1] = mediaTrack2;
+                    req.setTracks(mediaTracks1);
+                    ComposeMediaOutput composeMediaOutput1 = new ComposeMediaOutput();
+                    composeMediaOutput1.setFileName("123344");
+                    req.setOutput(composeMediaOutput1);
+                    // 返回的resp是一个ComposeMediaResponse的实例,与请求对象对应
+                    ComposeMediaResponse resp = client.ComposeMedia(req);
+                    // 输出json格式的字符串回包
+                    System.out.println(ComposeMediaResponse.toJsonString(resp));
+                }
+
+
+            }
+
+
+        } catch (TencentCloudSDKException e) {
+            System.out.println(e.toString());
+        }
+    }
+
+
+    /*public static void main(String[] args) {
+        try {
+            // 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey,此处还需注意密钥对的保密
+            // 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取
+            Credential cred = new Credential("SecretId", "SecretKey");
+            // 实例化一个http选项,可选的,没有特殊需求可以跳过
+            HttpProfile httpProfile = new HttpProfile();
+            httpProfile.setEndpoint("vod.tencentcloudapi.com");
+            // 实例化一个client选项,可选的,没有特殊需求可以跳过
+            ClientProfile clientProfile = new ClientProfile();
+            clientProfile.setHttpProfile(httpProfile);
+            // 实例化要请求产品的client对象,clientProfile是可选的
+            VodClient client = new VodClient(cred, "", clientProfile);
+            // 实例化一个请求对象,每个接口都会对应一个request对象
+            ComposeMediaRequest req = new ComposeMediaRequest();
+            MediaTrack[] mediaTracks1 = new MediaTrack[2];
+            MediaTrack mediaTrack1 = new MediaTrack();
+            mediaTrack1.setType("Video");
+
+            MediaTrackItem[] mediaTrackItems1 = new MediaTrackItem[1];
+            MediaTrackItem mediaTrackItem1 = new MediaTrackItem();
+            mediaTrackItem1.setType("Video");
+            VideoTrackItem videoTrackItem1 = new VideoTrackItem();
+            videoTrackItem1.setSourceMedia("387702292666447535");
+
+            AudioTransform[] audioTransforms1 = new AudioTransform[1];
+            AudioTransform audioTransform1 = new AudioTransform();
+            audioTransform1.setType("Volume");
+            AudioVolumeParam audioVolumeParam1 = new AudioVolumeParam();
+            audioVolumeParam1.setMute(1L);
+            audioTransform1.setVolumeParam(audioVolumeParam1);
+
+            audioTransforms1[0] = audioTransform1;
+
+            videoTrackItem1.setAudioOperations(audioTransforms1);
+
+            mediaTrackItem1.setVideoItem(videoTrackItem1);
+
+            mediaTrackItems1[0] = mediaTrackItem1;
+
+            mediaTrack1.setTrackItems(mediaTrackItems1);
+
+            mediaTracks1[0] = mediaTrack1;
+
+            MediaTrack mediaTrack2 = new MediaTrack();
+            mediaTrack2.setType("Audio");
+
+            MediaTrackItem[] mediaTrackItems2 = new MediaTrackItem[1];
+            MediaTrackItem mediaTrackItem2 = new MediaTrackItem();
+            mediaTrackItem2.setType("Audio");
+            VideoTrackItem videoTrackItem2 = new VideoTrackItem();
+            videoTrackItem2.setSourceMedia("387702292668811825");
+            mediaTrackItem2.setVideoItem(videoTrackItem2);
+
+            mediaTrackItems2[0] = mediaTrackItem2;
+
+            mediaTrack2.setTrackItems(mediaTrackItems2);
+
+            mediaTracks1[1] = mediaTrack2;
+
+            req.setTracks(mediaTracks1);
+
+            // 返回的resp是一个ComposeMediaResponse的实例,与请求对象对应
+            ComposeMediaResponse resp = client.ComposeMedia(req);
+            // 输出json格式的字符串回包
+            System.out.println(ComposeMediaResponse.toJsonString(resp));
+        } catch (TencentCloudSDKException e) {
+            System.out.println(e.toString());
+        }
+    }
+*/
+
+/*
+    public static void main(String[] args) {
+
+//路径   这里写一个路径进去
+
+        String path = "D:\\file";
+
+//调用方法
+
+        getFiles(path);
+
+    }
+*/
+
+
+    /**
+     * 递归获取某路径下的所有文件,文件夹,并输出
+     *
+     * @return
+     */
+
+    public static JSONArray getFiles(String path) {
+
+        File file = new File(path);
+        JSONArray array = new JSONArray();
+        if (file.isDirectory()) {
+            File[] files = file.listFiles();
+            for (int i = 0; i < files.length; i++) {
+                if (files[i].isDirectory()) {
+                    getFiles(files[i].getPath());
+                } else {
+                    array.add(files[i].getPath());
+                    System.out.println("文件:" + files[i].getPath());
+                }
+            }
+        }
+        return array;
+    }
+
+
+}

+ 1 - 1
src/main/resources/application.yml

@@ -80,7 +80,7 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
       datasource:
         master:
         master:
-          url: jdbc:mysql://172.30.0.4:3390/track?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true
+          url: jdbc:mysql://139.186.27.96:3390/track?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true
           username: hcst
           username: hcst
           password: hcst@2020
           password: hcst@2020
           driver-class-name: com.mysql.jdbc.Driver
           driver-class-name: com.mysql.jdbc.Driver