后台服务
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

112 wiersze
5.4 KiB

  1. package com.iformall.sm;
  2. import com.alibaba.fastjson.JSON;
  3. import com.alibaba.fastjson.JSONObject;
  4. import lombok.Data;
  5. import java.util.List;
  6. import java.util.Map;
  7. @Data
  8. public class AiVideoParam {
  9. /**
  10. * | 参数 | 必选 | 类型 | 说明 |
  11. * | ----------------- | ---- | ------- | ------------------------------------------------------------ |
  12. * | gen_txt | 是 | string | 需要生成的文字内容 |
  13. * | video_template_id | 是 | string | 使用的视频模板ID |
  14. * | voice_id | 是 | string | 音色ID,如:"zh-CN-YunxiNeural"。如果使用“default”,表示不指定具体的,由后端服务自动匹配 |
  15. * | voice_style | 是 | string | TTS语音风格,如:”angry“。如果使用“default”,表示默认风格 |
  16. * | video_files | 否 | array[] | 字典类型,包含背景、数字人、素材信息。缺省,使用默认模板。 |
  17. * | + back_ground | 否 | array[] | 字典类型,背景信息 |
  18. * | ++ image | 是 | string | 背景图片,base64编辑后的字符串类型数据 |
  19. * | ++ type | 是 | string | 背景图片类型,共两种。horizontal 表示横版,vertical 表示竖版 |
  20. * | + digital_human | 否 | array[] | 字典类型,数字人信息 |
  21. * | ++ coord | 是 | array[] | 集合类型,表示相对于左上角的位置,如[100, 200],表示相对于左边缘100像素,相对于上边缘200相素 |
  22. * | ++ level | 是 | uint32 | 数字人图片的层级,值越大表示越高层,0表示最底层 |
  23. * | ++ ratio | 是 | float32 | 相对于原数字人图片大小的缩放比例,如0.5表示宽高均变为原来的一半 |
  24. * | + material | 否 | array[] | 字典类型,素材信息。具体的值是集合类型,内部由每个素材信息(素材信息是字典类型)组成,如"material":[{素材1的信息},{素材2的信息},{素材3的信息}] |
  25. * | ++ | 否 | array[] | 集合类型,每个素材信息(素材信息是字典类型)组成 |
  26. * | +++ coord | 是 | array[] | 集合类型,表示相对于左上角的位置,如[100, 200],表示相对于左边缘100像素,相对于上边缘200相素 |
  27. * | +++ image | 是 | string | 素材图片,base64编辑后的字符串类型数据 |
  28. * | +++ level | 是 | uint32 | 素材图片的层级,值越大表示越高层,0表示最底层 |
  29. * | +++ ratio | 是 | float32 | 相对于原素材图片大小的缩放比例,如0.5表示宽高均变为原来的一半 |
  30. */
  31. private String gen_txt;
  32. private String video_template_id;
  33. private String voice_id;
  34. private String voice_style;
  35. private String url = "None";//预留音频url
  36. private VideoFiles video_files;
  37. private Map<String,Object> subtitle;
  38. public String neglectImgString(){
  39. StringBuffer str = new StringBuffer();
  40. str.append("{");
  41. str.append("\"gen_txt\":").append("\"").append(gen_txt).append("\",");
  42. str.append("\"video_template_id\":").append("\"").append(video_template_id).append("\",");
  43. str.append("\"voice_id\":").append("\"").append(voice_id).append("\",");
  44. str.append("\"voice_style\":").append("\"").append(voice_style).append("\",");
  45. if(video_files != null){
  46. str.append("\"video_files\":").append("{");
  47. if(video_files.getBack_ground() != null){
  48. str.append("\"back_ground\":").append("{")
  49. .append("\"image\":").append("\"").append("\",")
  50. .append("\"type\":").append("\"").append(video_files.getBack_ground().getType()).append("\"")
  51. .append("},");
  52. }
  53. if(video_files.getDigital_human() != null){
  54. str.append("\"digital_human\":").append("{")
  55. .append("\"coord\":").append(JSONObject.toJSONString(video_files.getDigital_human().getCoord())).append(",")
  56. .append("\"level\":").append(video_files.getDigital_human().getLevel()).append(",")
  57. .append("\"ratio\":").append(video_files.getDigital_human().getRatio())
  58. .append("},");
  59. }
  60. if(video_files.getMaterial() != null && video_files.getMaterial().size() > 0){
  61. str.append("\"material\":").append("[");
  62. for (Material material:video_files.getMaterial()) {
  63. if(material != null){
  64. str.append("{");
  65. str.append("\"coord\":").append(JSONObject.toJSONString(material.getCoord())).append(",")
  66. .append("\"image\":").append("\"").append("\",")
  67. .append("\"level\":").append(material.getLevel()).append(",")
  68. .append("\"ratio\":").append(material.getRatio());
  69. str.append("},");
  70. }
  71. }
  72. str.deleteCharAt(str.length()-1);
  73. str.append("]");
  74. }
  75. str.append("},");
  76. }
  77. str.deleteCharAt(str.length()-1);
  78. str.append("\"subtitle\":").append(JSON.toJSONString(subtitle));
  79. str.append("}");
  80. return str.toString();
  81. }
  82. @Data
  83. public static class VideoFiles {
  84. private BackGround back_ground;
  85. private Material digital_human;
  86. private List<Material> material;
  87. }
  88. @Data
  89. public static class BackGround {
  90. private String image;
  91. private String type;
  92. }
  93. @Data
  94. public static class Material {
  95. private int[] coord;
  96. private String image;
  97. private int level;
  98. private float ratio;
  99. }
  100. }