downloadToStream 添加 -t 参数

/video ffmpegRecord 调整
This commit is contained in:
shikong 2024-03-15 10:32:25 +08:00
parent c9af1a4dc3
commit 8c5b6f6021
2 changed files with 6 additions and 4 deletions

View File

@ -24,10 +24,10 @@ public class FfmpegSupportService {
String inputParam = debug.getDownload() ? rtp.getDownload() : StringUtils.joinWith(" ", "-y", rtp.getDownload(), input);
log.info("视频输入参数 {}", inputParam);
String outputParam = debug.getOutput() ? rtp.getOutput() : StringUtils.joinWith(" ", rtp.getOutput(), out);
String outputParam = debug.getOutput() ? rtp.getOutput() : StringUtils.joinWith(" ", "-t", unit.toSeconds(time), rtp.getOutput(), out);
log.info("视频输出参数 {}", outputParam);
return ffmpegExecutor(inputParam, outputParam, time, unit, streamHandler, executeResultHandler);
return ffmpegExecutor(inputParam, outputParam, time + 15, unit, streamHandler, executeResultHandler);
}
@SneakyThrows

View File

@ -230,7 +230,9 @@ public class Gb28181DownloadService {
} else if (videoInfo == null) {
writeErrorToResponse(asyncResponse, JsonResponse.error("下载失败"));
} else if (wvpProxyConfig.getUseFfmpeg()) {
videoService.ffmpegRecord(asyncResponse, videoInfo.getUrl(), DateUtil.between(startTime, endTime, DateUnit.SECOND) + 15, videoInfo.getDevice(), videoInfo.getCallId());
executor.execute(()-> {
videoService.ffmpegRecord(asyncResponse, videoInfo.getUrl(), DateUtil.between(startTime, endTime, DateUnit.SECOND), videoInfo.getDevice(), videoInfo.getCallId());
});
} else {
videoService.javaCVrecord(asyncResponse, videoInfo.getUrl(), DateUtil.between(startTime, endTime, DateUnit.SECOND) + 15);
}
@ -370,7 +372,7 @@ public class Gb28181DownloadService {
writeErrorToResponse(asyncResponse, JsonResponse.error("下载失败"));
} else if(wvpProxyConfig.getUseFfmpeg()){
executor.execute(()->{
videoService.ffmpegRecord(asyncResponse, videoInfo.getUrl(), DateUtil.between(startTime,endTime,DateUnit.SECOND) + 15,videoInfo.getDevice(),videoInfo.getCallId());
videoService.ffmpegRecord(asyncResponse, videoInfo.getUrl(), DateUtil.between(startTime,endTime,DateUnit.SECOND),videoInfo.getDevice(),videoInfo.getCallId());
});
} else {
videoService.javaCVrecord(asyncResponse, videoInfo.getUrl(), DateUtil.between(startTime,endTime,DateUnit.SECOND) + 15);