This commit is contained in:
2025-05-30 10:31:21 +08:00
parent 115edc19fa
commit 80f4491836
73 changed files with 310 additions and 485 deletions

View File

@@ -77,7 +77,7 @@ public class VideoPieceGetter {
public Long templateId;
public boolean force;
public static interface Callback {
public interface Callback {
void onInvoke();
}
}
@@ -134,7 +134,7 @@ public class VideoPieceGetter {
List<FaceSampleEntity> list = faceSampleMapper.listByIds(task.getFaceSampleIds());
Map<Long, Long> pairDeviceMap = new ConcurrentHashMap<>();
if (!list.isEmpty()) {
Long scenicId = list.get(0).getScenicId();
Long scenicId = list.getFirst().getScenicId();
List<DeviceEntity> allDeviceByScenicId = deviceRepository.getAllDeviceByScenicId(scenicId);
allDeviceByScenicId.forEach(device -> {
Long deviceId = device.getId();
@@ -258,10 +258,10 @@ public class VideoPieceGetter {
log.info("查询到可用的文件: {}", listByDtRange);
// 如果完全一致,就不需要裁切
String url;
if (listByDtRange.size() == 1 && listByDtRange.get(0).isExact()) {
url = listByDtRange.get(0).getUrl();
if (listByDtRange.size() == 1 && listByDtRange.getFirst().isExact()) {
url = listByDtRange.getFirst().getUrl();
} else {
long offset = baseTime.getTime() - cutPre.multiply(BigDecimal.valueOf(1000)).longValue() - listByDtRange.get(0).getCreateTime().getTime();
long offset = baseTime.getTime() - cutPre.multiply(BigDecimal.valueOf(1000)).longValue() - listByDtRange.getFirst().getCreateTime().getTime();
FfmpegTask ffmpegTask = new FfmpegTask();
ffmpegTask.setFileList(listByDtRange);
ffmpegTask.setDuration(duration);
@@ -422,7 +422,7 @@ public class VideoPieceGetter {
private boolean runFfmpegForSingleFile(FfmpegTask task) {
try {
return quickVideoCut(task.getFileList().get(0).getUrl(), task.getOffsetStart(), task.getDuration(), task.getOutputFile());
return quickVideoCut(task.getFileList().getFirst().getUrl(), task.getOffsetStart(), task.getDuration(), task.getOutputFile());
} catch (IOException e) {
return false;
}