|
@@ -4,17 +4,26 @@ import com.tzld.piaoquan.tencentad.common.base.CommonResponse;
|
|
import com.tzld.piaoquan.tencentad.model.po.FetchKeyFramesParam;
|
|
import com.tzld.piaoquan.tencentad.model.po.FetchKeyFramesParam;
|
|
import com.tzld.piaoquan.tencentad.model.vo.AdVideoVo;
|
|
import com.tzld.piaoquan.tencentad.model.vo.AdVideoVo;
|
|
import com.tzld.piaoquan.tencentad.service.FfmpegUtilService;
|
|
import com.tzld.piaoquan.tencentad.service.FfmpegUtilService;
|
|
|
|
+import com.tzld.piaoquan.tencentad.utils.FfmpegUtil;
|
|
import com.tzld.piaoquan.tencentad.utils.page.Page;
|
|
import com.tzld.piaoquan.tencentad.utils.page.Page;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
+import java.io.File;
|
|
|
|
+import java.util.UUID;
|
|
|
|
+
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/ffmpeg")
|
|
@RequestMapping("/ffmpeg")
|
|
public class FfmpegUtilController {
|
|
public class FfmpegUtilController {
|
|
|
|
|
|
|
|
+ @Value("${image_path}")
|
|
|
|
+ private String imagePath;
|
|
|
|
+
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private FfmpegUtilService ffmpegUtilService;
|
|
private FfmpegUtilService ffmpegUtilService;
|
|
|
|
|
|
@@ -23,4 +32,16 @@ public class FfmpegUtilController {
|
|
return ffmpegUtilService.fetchKeyFrames(fetchKeyFramesParam);
|
|
return ffmpegUtilService.fetchKeyFrames(fetchKeyFramesParam);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @PostMapping("/test")
|
|
|
|
+ public CommonResponse<String> test(@RequestBody FetchKeyFramesParam fetchKeyFramesParam) {
|
|
|
|
+ String imageFolder = imagePath + "/" + UUID.randomUUID();
|
|
|
|
+ File dir = new File(imageFolder);
|
|
|
|
+ if (!dir.exists()) {
|
|
|
|
+ boolean mkdir = dir.mkdir();
|
|
|
|
+ }
|
|
|
|
+ String imagePath = imageFolder + "/" + "%04d.jpg";
|
|
|
|
+ FfmpegUtil.getTargetThumbnail("https://rescdn.yishihui.com/long_articles/video/8b4b2e6a-e556-4d06-8b4e-65a25654ebce", imagePath);
|
|
|
|
+ return CommonResponse.create("ok");
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|