package com.iformall.sm; import lombok.Data; import java.util.List; @Data public class AiVideoParam { /** * | 参数 | 必选 | 类型 | 说明 | * | ----------------- | ---- | ------- | ------------------------------------------------------------ | * | gen_txt | 是 | string | 需要生成的文字内容 | * | video_template_id | 是 | string | 使用的视频模板ID | * | voice_id | 是 | string | 音色ID,如:"zh-CN-YunxiNeural"。如果使用“default”,表示不指定具体的,由后端服务自动匹配 | * | voice_style | 是 | string | TTS语音风格,如:”angry“。如果使用“default”,表示默认风格 | * | video_files | 否 | array[] | 字典类型,包含背景、数字人、素材信息。缺省,使用默认模板。 | * | + back_ground | 否 | array[] | 字典类型,背景信息 | * | ++ image | 是 | string | 背景图片,base64编辑后的字符串类型数据 | * | ++ type | 是 | string | 背景图片类型,共两种。horizontal 表示横版,vertical 表示竖版 | * | + digital_human | 否 | array[] | 字典类型,数字人信息 | * | ++ coord | 是 | array[] | 集合类型,表示相对于左上角的位置,如[100, 200],表示相对于左边缘100像素,相对于上边缘200相素 | * | ++ level | 是 | uint32 | 数字人图片的层级,值越大表示越高层,0表示最底层 | * | ++ ratio | 是 | float32 | 相对于原数字人图片大小的缩放比例,如0.5表示宽高均变为原来的一半 | * | + material | 否 | array[] | 字典类型,素材信息。具体的值是集合类型,内部由每个素材信息(素材信息是字典类型)组成,如"material":[{素材1的信息},{素材2的信息},{素材3的信息}] | * | ++ | 否 | array[] | 集合类型,每个素材信息(素材信息是字典类型)组成 | * | +++ coord | 是 | array[] | 集合类型,表示相对于左上角的位置,如[100, 200],表示相对于左边缘100像素,相对于上边缘200相素 | * | +++ image | 是 | string | 素材图片,base64编辑后的字符串类型数据 | * | +++ level | 是 | uint32 | 素材图片的层级,值越大表示越高层,0表示最底层 | * | +++ ratio | 是 | float32 | 相对于原素材图片大小的缩放比例,如0.5表示宽高均变为原来的一半 | */ private String gen_txt; private String video_template_id; private String voice_id; private String voice_style; private VideoFiles video_files; public String neglectImgString(){ StringBuffer str = new StringBuffer(); str.append("{"); str.append("\"gen_txt\":").append("\"").append(gen_txt).append("\","); str.append("\"video_template_id\":").append("\"").append(video_template_id).append("\","); str.append("\"voice_id\":").append("\"").append(voice_id).append("\","); str.append("\"voice_style\":").append("\"").append(voice_style).append("\","); if(video_files != null){ str.append("\"video_files\":").append("{"); if(video_files.getBack_ground() != null){ str.append("\"back_ground\":").append("{") .append("\"image\":").append("\"").append("\",") .append("\"type\":").append("\"").append(video_files.getBack_ground().getType()).append("\"") .append("},"); } if(video_files.getDigital_human() != null){ str.append("\"digital_human\":").append("{") .append("\"coord\":").append(video_files.getDigital_human().getCoord().toString()).append(",") .append("\"level\":").append(video_files.getDigital_human().getLevel()).append(",") .append("\"ratio\":").append(video_files.getDigital_human().getRatio()) .append("},"); } if(video_files.getMaterial() != null && video_files.getMaterial().size() > 0){ str.append("\"material\":").append("["); for (Material material:video_files.getMaterial()) { if(material != null){ str.append("{"); str.append("\"coord\":").append(material.getCoord().toString()).append(",") .append("\"image\":").append("\"").append("\",") .append("\"level\":").append(material.getLevel()).append(",") .append("\"ratio\":").append(material.getRatio()); str.append("},"); } } str.deleteCharAt(str.length()-1); str.append("]"); } str.append("},"); } str.deleteCharAt(str.length()-1); str.append("}"); return str.toString(); } @Data public static class VideoFiles { private BackGround back_ground; private Material digital_human; private List material; } @Data public static class BackGround { private String image; private String type; } @Data public static class Material { private int[] coord; private String image; private int level; private float ratio; } }