mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-10 19:36:50 +08:00
szx-1283 修改ffmpeg路径
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package com.xboe.config;
|
||||
|
||||
import ws.schild.jave.process.ffmpeg.DefaultFFMPEGLocator;
|
||||
|
||||
/**
|
||||
* @author guo jia
|
||||
*/
|
||||
public class CustomFFMPEGLocator extends DefaultFFMPEGLocator {
|
||||
|
||||
@Override
|
||||
public String getExecutablePath() {
|
||||
return "/usr/local/opt/ffmpeg/ffmpeg";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.xboe.config.CustomFFMPEGLocator;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.orm.ObjectOptimisticLockingFailureException;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -47,11 +48,8 @@ import com.xboe.standard.BaseConstant;
|
||||
import com.xboe.standard.enums.BoedxCourseFileType;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import ws.schild.jave.Encoder;
|
||||
import ws.schild.jave.MultimediaObject;
|
||||
import ws.schild.jave.info.MultimediaInfo;
|
||||
import ws.schild.jave.process.ffmpeg.DefaultFFMPEGLocator;
|
||||
import ws.schild.jave.process.ffmpeg.FFMPEGProcess;
|
||||
|
||||
/**
|
||||
* 课件资源表,课程的相关文件内容
|
||||
@@ -262,12 +260,7 @@ public class CourseFileApi extends ApiBaseController {
|
||||
log.info("上传 "+file.getFileType()+"文件:"+file.getFilePath());
|
||||
try {
|
||||
//System.out.println(fileFullPath);
|
||||
MultimediaInfo m = new MultimediaObject(new File(fileFullPath), new DefaultFFMPEGLocator() {
|
||||
@Override
|
||||
public String getExecutablePath() {
|
||||
return "/usr/local/opt/ffmpeg/ffmpeg";
|
||||
}
|
||||
}).getInfo();
|
||||
MultimediaInfo m = new MultimediaObject(new File(fileFullPath), new CustomFFMPEGLocator()).getInfo();
|
||||
Long ls = m.getDuration() / 1000;//秒
|
||||
log.info("文件时长 "+ls);
|
||||
//System.out.print("视频时长:" + ls + "秒");
|
||||
|
||||
Reference in New Issue
Block a user