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 | 110 | shyVideos1.setVideo_imgs(videoCoverUrl); |
| 111 | 111 | if (CommonUtils.isNotEmpty(videoCoverUrl)) { |
| 112 | 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 | 117 | shyVideos1.setVideo_poster(poster); |
| 114 | 118 | } |
| 115 | 119 | shyVideos1.setVideo_desc(json.getString("videoIntro")); |
| ... | ... | @@ -122,7 +126,10 @@ public class VideosControllerApi { |
| 122 | 126 | shyVideos1.setState(CommonConst.AUDIT_INTT); |
| 123 | 127 | shyVideos1.setBucket(json.getString("bucketName")); |
| 124 | 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 | 133 | boolean result = videosService.impotVideo(shyVideos1); |
| 127 | 134 | if (result == true) { |
| 128 | 135 | return new ResponseBean(ErrorEnum.SUCCESS); |
| ... | ... | @@ -147,13 +154,14 @@ public class VideosControllerApi { |
| 147 | 154 | |
| 148 | 155 | String path = video_url.replace("//", ""); |
| 149 | 156 | path = path.substring(path.indexOf("/"), path.length()); |
| 150 | - String domian = video_url.replace(path,""); | |
| 157 | + String domian = video_url.replace(path, ""); | |
| 151 | 158 | path = "/" + bucket + path; |
| 152 | 159 | |
| 153 | 160 | JSONObject attach = new JSONObject(); |
| 154 | 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 | 165 | if (CommonConst.KS_PLAT == plat) { |
| 158 | 166 | //金山 |
| 159 | 167 | params.put("plat", 0); |
| ... | ... | @@ -185,7 +193,7 @@ public class VideosControllerApi { |
| 185 | 193 | httpUtil.setParamMap(dataMap); |
| 186 | 194 | Map<String, String> resultMap = httpUtil.post(url); |
| 187 | 195 | JSONObject result = JSON.parseObject(resultMap.get("result")); |
| 188 | - logger.info("请求抽帧结果:result:{}",result); | |
| 196 | + logger.info("请求抽帧结果:result:{}", result); | |
| 189 | 197 | Integer code = result.getInteger("code"); |
| 190 | 198 | if (code == 0) { |
| 191 | 199 | video.setAvsample(CommonConst.AVSAMPLE_ING); | ... | ... |
src/main/java/com/cnlive/shenhe/entity/ShyVideos.java
| 1 | 1 | package com.cnlive.shenhe.entity; |
| 2 | 2 | |
| 3 | -import javax.persistence.Id; | |
| 4 | -import javax.persistence.Table; | |
| 5 | -import javax.persistence.Transient; | |
| 6 | 3 | import java.util.Date; |
| 4 | +import javax.persistence.*; | |
| 7 | 5 | |
| 8 | 6 | @Table(name = "shy_videos") |
| 9 | 7 | public class ShyVideos { |
| ... | ... | @@ -126,8 +124,10 @@ public class ShyVideos { |
| 126 | 124 | private Integer plat; |
| 127 | 125 | |
| 128 | 126 | /** |
| 129 | - * 审核员 | |
| 127 | + * 视频时长,单位s | |
| 130 | 128 | */ |
| 129 | + private Integer duration; | |
| 130 | + | |
| 131 | 131 | @Transient |
| 132 | 132 | private String auditor; |
| 133 | 133 | |
| ... | ... | @@ -600,4 +600,22 @@ public class ShyVideos { |
| 600 | 600 | public void setPlat(Integer plat) { |
| 601 | 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 | 622 | \ No newline at end of file | ... | ... |
src/main/resources/mapper/ShyVideosMapper.xml
| ... | ... | @@ -32,5 +32,6 @@ |
| 32 | 32 | <result column="task_id" jdbcType="VARCHAR" property="task_id" /> |
| 33 | 33 | <result column="bucket" jdbcType="VARCHAR" property="bucket" /> |
| 34 | 34 | <result column="plat" jdbcType="INTEGER" property="plat" /> |
| 35 | + <result column="duration" jdbcType="INTEGER" property="duration" /> | |
| 35 | 36 | </resultMap> |
| 36 | 37 | </mapper> |
| 37 | 38 | \ No newline at end of file | ... | ... |