Commit f6e9c77b3bd4c756fc0c38dd9e53ccc5a8df52b1
1 parent
3a5d76e5
修改抽帧方式
Showing
3 changed files
with
36 additions
and
9 deletions
src/main/java/com/cnlive/shenhe/api/VideosControllerApi.java
| @@ -110,6 +110,10 @@ public class VideosControllerApi { | @@ -110,6 +110,10 @@ public class VideosControllerApi { | ||
| 110 | shyVideos1.setVideo_imgs(videoCoverUrl); | 110 | shyVideos1.setVideo_imgs(videoCoverUrl); |
| 111 | if (CommonUtils.isNotEmpty(videoCoverUrl)) { | 111 | if (CommonUtils.isNotEmpty(videoCoverUrl)) { |
| 112 | String poster = json.getJSONObject("videoCoverUrl").getString("224*126"); | 112 | String poster = json.getJSONObject("videoCoverUrl").getString("224*126"); |
| 113 | + if(CommonUtils.isEmpty(poster)){ | ||
| 114 | + //ugc短视频只有一张图片 | ||
| 115 | + poster = json.getJSONObject("videoCoverUrl").getString("key"); | ||
| 116 | + } | ||
| 113 | shyVideos1.setVideo_poster(poster); | 117 | shyVideos1.setVideo_poster(poster); |
| 114 | } | 118 | } |
| 115 | shyVideos1.setVideo_desc(json.getString("videoIntro")); | 119 | shyVideos1.setVideo_desc(json.getString("videoIntro")); |
| @@ -122,7 +126,10 @@ public class VideosControllerApi { | @@ -122,7 +126,10 @@ public class VideosControllerApi { | ||
| 122 | shyVideos1.setState(CommonConst.AUDIT_INTT); | 126 | shyVideos1.setState(CommonConst.AUDIT_INTT); |
| 123 | shyVideos1.setBucket(json.getString("bucketName")); | 127 | shyVideos1.setBucket(json.getString("bucketName")); |
| 124 | shyVideos1.setPlat(json.getInteger("bucketType")); | 128 | shyVideos1.setPlat(json.getInteger("bucketType")); |
| 125 | - shyVideos1 = avsample(shyVideos1);//请求抽帧 | 129 | + //Integer duration = json.getInteger(""); |
| 130 | + //if (CommonUtils.isNotNull(duration) && duration > 10) { | ||
| 131 | + shyVideos1 = avsample(shyVideos1);//视频长度超过10秒,请求抽帧 | ||
| 132 | + //} | ||
| 126 | boolean result = videosService.impotVideo(shyVideos1); | 133 | boolean result = videosService.impotVideo(shyVideos1); |
| 127 | if (result == true) { | 134 | if (result == true) { |
| 128 | return new ResponseBean(ErrorEnum.SUCCESS); | 135 | return new ResponseBean(ErrorEnum.SUCCESS); |
| @@ -147,13 +154,14 @@ public class VideosControllerApi { | @@ -147,13 +154,14 @@ public class VideosControllerApi { | ||
| 147 | 154 | ||
| 148 | String path = video_url.replace("//", ""); | 155 | String path = video_url.replace("//", ""); |
| 149 | path = path.substring(path.indexOf("/"), path.length()); | 156 | path = path.substring(path.indexOf("/"), path.length()); |
| 150 | - String domian = video_url.replace(path,""); | 157 | + String domian = video_url.replace(path, ""); |
| 151 | path = "/" + bucket + path; | 158 | path = "/" + bucket + path; |
| 152 | 159 | ||
| 153 | JSONObject attach = new JSONObject(); | 160 | JSONObject attach = new JSONObject(); |
| 154 | JSONObject extParam = new JSONObject(); | 161 | JSONObject extParam = new JSONObject(); |
| 155 | - attach.put("num", 24); | ||
| 156 | - extParam.put("domain",domian); | 162 | + attach.put("interval", 10); |
| 163 | + attach.put("strategy", 1); | ||
| 164 | + extParam.put("domain", domian); | ||
| 157 | if (CommonConst.KS_PLAT == plat) { | 165 | if (CommonConst.KS_PLAT == plat) { |
| 158 | //金山 | 166 | //金山 |
| 159 | params.put("plat", 0); | 167 | params.put("plat", 0); |
| @@ -185,7 +193,7 @@ public class VideosControllerApi { | @@ -185,7 +193,7 @@ public class VideosControllerApi { | ||
| 185 | httpUtil.setParamMap(dataMap); | 193 | httpUtil.setParamMap(dataMap); |
| 186 | Map<String, String> resultMap = httpUtil.post(url); | 194 | Map<String, String> resultMap = httpUtil.post(url); |
| 187 | JSONObject result = JSON.parseObject(resultMap.get("result")); | 195 | JSONObject result = JSON.parseObject(resultMap.get("result")); |
| 188 | - logger.info("请求抽帧结果:result:{}",result); | 196 | + logger.info("请求抽帧结果:result:{}", result); |
| 189 | Integer code = result.getInteger("code"); | 197 | Integer code = result.getInteger("code"); |
| 190 | if (code == 0) { | 198 | if (code == 0) { |
| 191 | video.setAvsample(CommonConst.AVSAMPLE_ING); | 199 | video.setAvsample(CommonConst.AVSAMPLE_ING); |
src/main/java/com/cnlive/shenhe/entity/ShyVideos.java
| 1 | package com.cnlive.shenhe.entity; | 1 | package com.cnlive.shenhe.entity; |
| 2 | 2 | ||
| 3 | -import javax.persistence.Id; | ||
| 4 | -import javax.persistence.Table; | ||
| 5 | -import javax.persistence.Transient; | ||
| 6 | import java.util.Date; | 3 | import java.util.Date; |
| 4 | +import javax.persistence.*; | ||
| 7 | 5 | ||
| 8 | @Table(name = "shy_videos") | 6 | @Table(name = "shy_videos") |
| 9 | public class ShyVideos { | 7 | public class ShyVideos { |
| @@ -126,8 +124,10 @@ public class ShyVideos { | @@ -126,8 +124,10 @@ public class ShyVideos { | ||
| 126 | private Integer plat; | 124 | private Integer plat; |
| 127 | 125 | ||
| 128 | /** | 126 | /** |
| 129 | - * 审核员 | 127 | + * 视频时长,单位s |
| 130 | */ | 128 | */ |
| 129 | + private Integer duration; | ||
| 130 | + | ||
| 131 | @Transient | 131 | @Transient |
| 132 | private String auditor; | 132 | private String auditor; |
| 133 | 133 | ||
| @@ -600,4 +600,22 @@ public class ShyVideos { | @@ -600,4 +600,22 @@ public class ShyVideos { | ||
| 600 | public void setPlat(Integer plat) { | 600 | public void setPlat(Integer plat) { |
| 601 | this.plat = plat; | 601 | this.plat = plat; |
| 602 | } | 602 | } |
| 603 | + | ||
| 604 | + /** | ||
| 605 | + * 获取视频时长,单位s | ||
| 606 | + * | ||
| 607 | + * @return duration - 视频时长,单位s | ||
| 608 | + */ | ||
| 609 | + public Integer getDuration() { | ||
| 610 | + return duration; | ||
| 611 | + } | ||
| 612 | + | ||
| 613 | + /** | ||
| 614 | + * 设置视频时长,单位s | ||
| 615 | + * | ||
| 616 | + * @param duration 视频时长,单位s | ||
| 617 | + */ | ||
| 618 | + public void setDuration(Integer duration) { | ||
| 619 | + this.duration = duration; | ||
| 620 | + } | ||
| 603 | } | 621 | } |
| 604 | \ No newline at end of file | 622 | \ No newline at end of file |
src/main/resources/mapper/ShyVideosMapper.xml
| @@ -32,5 +32,6 @@ | @@ -32,5 +32,6 @@ | ||
| 32 | <result column="task_id" jdbcType="VARCHAR" property="task_id" /> | 32 | <result column="task_id" jdbcType="VARCHAR" property="task_id" /> |
| 33 | <result column="bucket" jdbcType="VARCHAR" property="bucket" /> | 33 | <result column="bucket" jdbcType="VARCHAR" property="bucket" /> |
| 34 | <result column="plat" jdbcType="INTEGER" property="plat" /> | 34 | <result column="plat" jdbcType="INTEGER" property="plat" /> |
| 35 | + <result column="duration" jdbcType="INTEGER" property="duration" /> | ||
| 35 | </resultMap> | 36 | </resultMap> |
| 36 | </mapper> | 37 | </mapper> |
| 37 | \ No newline at end of file | 38 | \ No newline at end of file |