飞行视频缺少封面优化
This commit is contained in:
parent
69b89434b9
commit
44b0221f5c
|
|
@ -23,7 +23,6 @@ import com.multictrl.modules.business.entity.*;
|
|||
import com.multictrl.modules.business.influxdb.UavReport;
|
||||
import com.multictrl.modules.business.service.*;
|
||||
import com.multictrl.modules.job.dao.ScheduleJobDao;
|
||||
import com.multictrl.modules.job.dto.ScheduleJobDTO;
|
||||
import com.multictrl.modules.job.entity.ScheduleJobEntity;
|
||||
import com.multictrl.modules.security.user.SecurityUser;
|
||||
import com.multictrl.modules.sys.dto.SysUserDTO;
|
||||
|
|
@ -341,8 +340,8 @@ public class FlightTaskServiceImpl extends CrudServiceImpl<FlightTaskDao, Flight
|
|||
String file = srsRecordEntity.getFile();
|
||||
srsRecordEntity.setRecordDate(DateUtils.getBeforeHour(srsRecordEntity.getRecordDate(), 8));
|
||||
srsRecordEntity.setUrl(BusinessConstant.VIDEO_PATH + file);
|
||||
// srsRecordEntity.setCover(BusinessConstant.IMAGE_PATH + getVideoCover(srsRecordEntity.getFile(), srsRecordEntity.getStreamUrl()));
|
||||
srsRecordEntity.setCover(BusinessConstant.IMAGE_PATH + file.replaceAll(".mp4", BusinessConstant.VIDEO_COVER_SUFFIX));
|
||||
srsRecordEntity.setCover(BusinessConstant.IMAGE_PATH + getVideoCover(srsRecordEntity.getFile(), srsRecordEntity.getStreamUrl()));
|
||||
// srsRecordEntity.setCover(BusinessConstant.IMAGE_PATH + file.replaceAll(".mp4", BusinessConstant.VIDEO_COVER_SUFFIX));
|
||||
}
|
||||
|
||||
return list;
|
||||
|
|
@ -366,11 +365,13 @@ public class FlightTaskServiceImpl extends CrudServiceImpl<FlightTaskDao, Flight
|
|||
}
|
||||
|
||||
//使用ffmpeg 用视频提取封面
|
||||
/* private String getVideoCover(String file, String streamUrl) {
|
||||
private String getVideoCover(String file, String streamUrl) {
|
||||
String fileName = file.replace("live_record" + streamUrl + "/", "");
|
||||
String videoCoverPath = "live_record" + streamUrl + "/" + FileUtil.getPrefix(fileName) + BusinessConstant.VIDEO_COVER_SUFFIX;
|
||||
FfmpegUtils.generateVideoCover("/" + file, "/" + videoCoverPath);
|
||||
if (!FileUtil.exist("/" + videoCoverPath)) {
|
||||
FfmpegUtils.generateVideoCover("/" + file, "/" + videoCoverPath);
|
||||
}
|
||||
|
||||
return videoCoverPath;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
@ -44,11 +44,7 @@ public class SrsServiceImpl implements SrsService {
|
|||
SrsRecordEntity srsRecordEntity = new SrsRecordEntity();
|
||||
srsRecordEntity.setApp(srsCallBack.getApp());
|
||||
srsRecordEntity.setStream(srsCallBack.getStream());
|
||||
if (callBackFile.startsWith("/")) {
|
||||
srsRecordEntity.setFile(callBackFile.substring(1));
|
||||
} else {
|
||||
srsRecordEntity.setFile(callBackFile);
|
||||
}
|
||||
srsRecordEntity.setFile(callBackFile.substring(1));
|
||||
srsRecordEntity.setStreamUrl(srsCallBack.getStream_url());
|
||||
String file = callBackFile;
|
||||
// /live_record/aaa/bbb/2025-04-03_16-33-43-404.mp4
|
||||
|
|
@ -63,7 +59,7 @@ public class SrsServiceImpl implements SrsService {
|
|||
|
||||
//设置封面
|
||||
String videoCoverPath = srsRecordEntity.getFile().replaceAll(".mp4", BusinessConstant.VIDEO_COVER_SUFFIX);
|
||||
FfmpegUtils.generateVideoCover("/" + file, "/" + videoCoverPath);
|
||||
FfmpegUtils.generateVideoCover("/" + srsRecordEntity.getFile(), "/" + videoCoverPath);
|
||||
srsRecordDao.insert(srsRecordEntity);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue