如何将ffmpeg部署到服务器里,让其自动切片成m3u8文件
答案:1 悬赏:70 手机版
解决时间 2021-11-10 11:10
- 提问者网友:
- 2021-11-10 02:41
如何将ffmpeg部署到服务器里,让其自动切片成m3u8文件
最佳答案
- 五星知识达人网友:逐風
- 2021-11-10 03:33
我们现在是把ffmpeg放在项目里,然后用java调用exe。
public void fileTom3u8(Video video){
//
video.setStatus(2);
videoService.update(video);
String fileName = String.valueOf(System.currentTimeMillis());
String dest = Configue.getUploadUrl()+ UploadUtil.getImagesUpladPath() + fileName + ".m3u8"; // 目标文件
// 调用bat文件转换流化视频
String batpath = "cmd /c start " + Configue.getFfmpegPath() + "ffmpeg.exe -i";
// 加参数
batpath += " " + Configue.getUploadUrl() + "/" + video.getPath();
batpath += " -c:v libx264 -c:a aac -strict -2 -f hls -hls_list_size 0 ";
batpath += " " + Configue.getUploadPath() + UploadUtil.getImagesUpladPath() + fileName + ".m3u8";
CommonUtils.runbat(batpath);
video.setStreamingPath(UploadUtil.getImagesUpladPath() + fileName + ".m3u8");
video.setStatus(1);
videoService.update(video);
System.out.println(batpath);
}
public void fileTom3u8(Video video){
//
video.setStatus(2);
videoService.update(video);
String fileName = String.valueOf(System.currentTimeMillis());
String dest = Configue.getUploadUrl()+ UploadUtil.getImagesUpladPath() + fileName + ".m3u8"; // 目标文件
// 调用bat文件转换流化视频
String batpath = "cmd /c start " + Configue.getFfmpegPath() + "ffmpeg.exe -i";
// 加参数
batpath += " " + Configue.getUploadUrl() + "/" + video.getPath();
batpath += " -c:v libx264 -c:a aac -strict -2 -f hls -hls_list_size 0 ";
batpath += " " + Configue.getUploadPath() + UploadUtil.getImagesUpladPath() + fileName + ".m3u8";
CommonUtils.runbat(batpath);
video.setStreamingPath(UploadUtil.getImagesUpladPath() + fileName + ".m3u8");
video.setStatus(1);
videoService.update(video);
System.out.println(batpath);
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯