更新时间 : 2021-07-09 11:40:17
替换方法需要根据规范组织参数内容,请先点击以下链接了解
/**
* 设置替换素材 json
*
* 参考 https://www.seeshiontech.com/docs/page_103.html
*
* @param json
* */
public void setReplaceableJson(String json) {
this.replaceableJson = json;
}
File f = new File("");
String basePath = f.getAbsolutePath();
String tplFolder = basePath + "/workspace/template/kenbentuya/";
String outputPath = basePath + "/workspace/output/kenbentuya.mp4";
List<Asset> list = new ArrayList<>();
Asset asset = new Asset( basePath + "/workspace/assets/1.jpeg");
asset.addPrefixTextReplaceAsset("hello", "dtext");
list.add(asset);
Asset asset2 = new Asset( basePath + "/workspace/assets/2.jpeg");
asset2.addPrefixTextReplaceAsset("你好", "dtext");
list.add(asset2);
Asset asset3 = new Asset();
asset3.addTextReplaceAsset("你好", "title");
list.add(asset3);
VeProcessRenderTask task = new VeProcessRenderTask(license, tplFolder, outputPath);
// 设置替换素材 json
task.setReplaceableJson(JSON.toJSONString(list));
// 文字绘制工具路径
task.setTextPainterDir("/home/slayer/workspace/textpainter/");
// 设置素材保存目录, 必须设置, 以 / 结尾
task.setAssetDir(basePath + "/workspace/assets/");
boolean ret = task.render();
替换方法需要根据规范组织参数内容,请先点击以下链接了解
/**
* 设置替换素材 json
*
* 参考 https://www.seeshiontech.com/docs/page_103.html
*
* @param json
* */
public void setReplaceableJson(String json) {
this.replaceableJson = json;
}
File f = new File("");
String basePath = f.getAbsolutePath();
String tplFolder = basePath + "/workspace/template/kenbentuya/";
String outputPath = basePath + "/workspace/output/kenbentuya.mp4";
List<Asset> list = new ArrayList<>();
Asset asset = new Asset( basePath + "/workspace/assets/1.jpeg");
asset.addPrefixTextReplaceAsset("hello", "dtext");
list.add(asset);
Asset asset2 = new Asset( basePath + "/workspace/assets/2.jpeg");
asset2.addPrefixTextReplaceAsset("你好", "dtext");
list.add(asset2);
Asset asset3 = new Asset();
asset3.addTextReplaceAsset("你好", "title");
list.add(asset3);
VeProcessRenderTask task = new VeProcessRenderTask(license, tplFolder, outputPath);
// 设置替换素材 json
task.setReplaceableJson(JSON.toJSONString(list));
// 文字绘制工具路径
task.setTextPainterDir("/home/slayer/workspace/textpainter/");
// 设置素材保存目录, 必须设置, 以 / 结尾
task.setAssetDir(basePath + "/workspace/assets/");
boolean ret = task.render();