改成切片保存
This commit is contained in:
parent
d9919f4d26
commit
b5c2153ad0
@ -109,6 +109,6 @@ public class VideoFileController {
|
||||
@RequestMapping("/video/play")
|
||||
@ResponseBody
|
||||
public JSONObject getVideoUrl(String roomId, String videoId) {
|
||||
return ResultData.success("/play/"+videoService.getVideoPlay(roomId, videoId));
|
||||
return ResultData.success("/live/"+videoService.getVideoPlay(roomId, videoId));
|
||||
}
|
||||
}
|
||||
|
@ -134,10 +134,10 @@ public class LiveVideoDownloadService {
|
||||
public void run() {
|
||||
if (roomInfo.getLiveStatus() == 1) {
|
||||
String time = DateUtils.format(new Date().getTime(), DATE_FORMAT_10_DASH);
|
||||
rootPath = new File(bean.getRecordPath() + File.separator + bean.getAnchorName() + File.separator + time + File.separator + roomInfo.getTitle());
|
||||
savePath = rootPath.getAbsolutePath() + File.separator + "[" +
|
||||
rootPath = new File(bean.getRecordPath() + File.separator + bean.getAnchorName() + File.separator + time + File.separator + "[" +
|
||||
DateUtils.format(new Date(),
|
||||
"yyyy-MM-dd HH-mm-ss") + "]" + roomInfo.getTitle() + ".flv";
|
||||
"yyyy-MM-dd HH-mm-ss") + "]" + roomInfo.getTitle());
|
||||
savePath = rootPath.getAbsolutePath() + File.separator + roomInfo.getTitle() + "-%04d.ts";
|
||||
if (!rootPath.exists()) {
|
||||
rootPath.mkdirs();
|
||||
}
|
||||
@ -286,7 +286,11 @@ public class LiveVideoDownloadService {
|
||||
// .withNotSymbolParam("-progress", "-")
|
||||
// .withNotSymbolParam("-fflags", "+genpts")
|
||||
.withNotSymbolParam("-threads", "8")
|
||||
.withNotSymbolParam("-bufsize", "10M")
|
||||
// .withNotSymbolParam("-bufsize", "10M")
|
||||
.withNotSymbolParam("-f", "segment")
|
||||
.withNotSymbolParam("-segment_time", "60")
|
||||
.withNotSymbolParam("-segment_format", "flv")
|
||||
.withParam("-segment_list", rootPath + File.separator + roomInfo.getTitle() + ".m3u8")
|
||||
.withNotSymbolParam("-c", "copy")
|
||||
.withNotSymbolParam("-bsf:a", "aac_adtstoasc")
|
||||
// .withNotSymbolParam("-loglevel", "debug")
|
||||
@ -423,9 +427,11 @@ public class LiveVideoDownloadService {
|
||||
}
|
||||
liveDatabase.close();
|
||||
if (videoInfo != null) {
|
||||
File videoFile = new File(videoInfo.getPath().replace(".flv", ".mp4"));
|
||||
File videoFile = new File(videoInfo.getPath().replace("-%04d.ts", ".m3u8"));
|
||||
if (!videoFile.exists()) {
|
||||
videoFile = new File(videoInfo.getPath());
|
||||
}else{
|
||||
return videoInfo.getPath().replace(new File("live").getAbsolutePath(),"").replace(File.separator,"/").replace("-%04d.ts", ".m3u8");
|
||||
}
|
||||
FFmpegUtils ffmpeg = FFmpegUtils.segment(videoId, ffmpegPath, videoFile, ConfigTools.load(ConfigTools.CONFIG, "outVideoPath", String.class));
|
||||
System.out.println(ffmpeg.getCommandDecode());
|
||||
|
Loading…
Reference in New Issue
Block a user