|
@@ -26,11 +26,12 @@ public class MpsUtils {
|
|
// String[] a = {"1","2","3","4","5"};
|
|
// String[] a = {"1","2","3","4","5"};
|
|
// combinationSelect(a,3);
|
|
// combinationSelect(a,3);
|
|
// arrangementSelect(a,3);
|
|
// arrangementSelect(a,3);
|
|
- String t = "https://ctop-part.oss-cn-beijing.aliyuncs.com/input/VIDEO_HEAD/2019-12-11/25-1576044510677.mp4";
|
|
|
|
- int i = t.indexOf("/",10);
|
|
|
|
- System.out.println(t.substring(i+1,t.length()-1));
|
|
|
|
|
|
+// String t = "https://ctop-part.oss-cn-beijing.aliyuncs.com/input/VIDEO_HEAD/2019-12-11/25-1576044510677.mp4";
|
|
|
|
+// int i = t.indexOf("/",10);
|
|
|
|
+// System.out.println(t.substring(i+1,t.length()-1));
|
|
|
|
|
|
-// MpsUtils mpsUtils = new MpsUtils();
|
|
|
|
|
|
+ MpsUtils mpsUtils = new MpsUtils();
|
|
|
|
+ mpsUtils.videoWaterMark("video/2019-12-20/20%E7%BD%91%E6%9C%8D-1576822566069.mp4","watermark/water1080-1920.png","8bcf0c98021c40fc96a95d60f55b1f10",720);
|
|
// List<String> list = new ArrayList<>();
|
|
// List<String> list = new ArrayList<>();
|
|
// list.add("v1.mp4");
|
|
// list.add("v1.mp4");
|
|
// String jobId = mpsUtils.mergeOneVideo("v1.mp4",list,"v1.mp4");
|
|
// String jobId = mpsUtils.mergeOneVideo("v1.mp4",list,"v1.mp4");
|
|
@@ -271,13 +272,20 @@ public class MpsUtils {
|
|
|
|
|
|
public String videoWaterMark(String videoPath,String waterMarkPath,String watermarkTemplateId,Integer height){
|
|
public String videoWaterMark(String videoPath,String waterMarkPath,String watermarkTemplateId,Integer height){
|
|
String jobId = "";
|
|
String jobId = "";
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ String outputFilename = "watermark/"+sdf.format(new Date())+"/"+ UUID.randomUUID()+".mp4";
|
|
IAcsClient client = getClient();
|
|
IAcsClient client = getClient();
|
|
String pipelineId = getPipelineId(client);
|
|
String pipelineId = getPipelineId(client);
|
|
SubmitJobsRequest request = new SubmitJobsRequest();
|
|
SubmitJobsRequest request = new SubmitJobsRequest();
|
|
|
|
+ JSONObject input = new JSONObject();
|
|
|
|
+ input.put("Location", ossLocation);
|
|
|
|
+ input.put("Bucket", "ctop-media");
|
|
|
|
+ input.put("Object", videoPath);
|
|
|
|
+ request.setInput(input.toJSONString());
|
|
JSONObject videoWatermarkInput = new JSONObject();
|
|
JSONObject videoWatermarkInput = new JSONObject();
|
|
videoWatermarkInput.put("Location", ossLocation);
|
|
videoWatermarkInput.put("Location", ossLocation);
|
|
videoWatermarkInput.put("Bucket", "ctop-media");
|
|
videoWatermarkInput.put("Bucket", "ctop-media");
|
|
- videoWatermarkInput.put("Object", videoPath);
|
|
|
|
|
|
+ videoWatermarkInput.put("Object", waterMarkPath);
|
|
JSONObject videoWatermark = new JSONObject();
|
|
JSONObject videoWatermark = new JSONObject();
|
|
videoWatermark.put("WaterMarkTemplateId", watermarkTemplateId);
|
|
videoWatermark.put("WaterMarkTemplateId", watermarkTemplateId);
|
|
videoWatermark.put("Type", "Image");
|
|
videoWatermark.put("Type", "Image");
|
|
@@ -286,14 +294,8 @@ public class MpsUtils {
|
|
videoWatermark.put("Height", height);
|
|
videoWatermark.put("Height", height);
|
|
videoWatermark.put("Dx", "0");
|
|
videoWatermark.put("Dx", "0");
|
|
videoWatermark.put("Dy", "0");
|
|
videoWatermark.put("Dy", "0");
|
|
- String outputOSSObject;
|
|
|
|
- try {
|
|
|
|
- outputOSSObject = URLEncoder.encode(waterMarkPath, "utf-8");
|
|
|
|
- } catch (UnsupportedEncodingException e) {
|
|
|
|
- throw new RuntimeException("output URL encode failed");
|
|
|
|
- }
|
|
|
|
JSONObject output = new JSONObject();
|
|
JSONObject output = new JSONObject();
|
|
- output.put("OutputObject", outputOSSObject);
|
|
|
|
|
|
+ output.put("OutputObject", outputFilename);
|
|
JSONArray watermarks = new JSONArray();
|
|
JSONArray watermarks = new JSONArray();
|
|
watermarks.add(videoWatermark);
|
|
watermarks.add(videoWatermark);
|
|
output.put("WaterMarks", watermarks.toJSONString());
|
|
output.put("WaterMarks", watermarks.toJSONString());
|