调整FFmpeg参数
This commit is contained in:
parent
a466ddfb68
commit
41d3dec536
@ -120,6 +120,9 @@ public class LiveService {
|
||||
long videoTime = FFmpegUtils.getVideoTime(videoFile);
|
||||
long startTime = Long.parseLong(videoId);
|
||||
long endTime = Long.parseLong(videoId) + videoTime;
|
||||
if(endTime==0){
|
||||
endTime=System.currentTimeMillis();
|
||||
}
|
||||
return database.getGiftInfo(startTime, endTime);
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,15 @@ public class LiveVideoDownloadService {
|
||||
.withNotSymbolParam("-threads", "8")
|
||||
.withNotSymbolParam("-c:v", "copy")
|
||||
.withNotSymbolParam("-fflags", "+genpts")
|
||||
.withNotSymbolParam("-y", "");
|
||||
.withNotSymbolParam("-y", "")
|
||||
//-reconnect 1 -reconnect_at_eof 1 -reconnect_streamed 1 -reconnect_delay_max 2
|
||||
.withNotSymbolParam("-reconnect", "1")
|
||||
.withNotSymbolParam("-reconnect_at_eof", "1")
|
||||
.withNotSymbolParam("-reconnect_streamed", "1")
|
||||
.withNotSymbolParam("-reconnect_delay_max", "2")
|
||||
.withNotSymbolParam("-loglevel", "error")
|
||||
// .withNotSymbolParam("-progress",new File("cache",config.getRoomId()+".txt").getAbsolutePath()); //输出进度日志,暂时没啥用
|
||||
;
|
||||
if (ck != null) {
|
||||
builder = builder.withParam("-cookies", cookie);
|
||||
}
|
||||
|
@ -155,6 +155,7 @@ public class FFmpegUtils extends AbsVideoRecord {
|
||||
* @param video 视频文件
|
||||
* @return 毫秒
|
||||
*/
|
||||
@Deprecated
|
||||
public static long getVideoTime(File video) {
|
||||
String ffprobe = ConfigTools.load(ConfigTools.CONFIG, "ffprobe", String.class);
|
||||
String exec = ffprobe + " -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 \"" + video.getAbsolutePath() + "\"";
|
||||
@ -172,7 +173,7 @@ public class FFmpegUtils extends AbsVideoRecord {
|
||||
return (long) (Double.parseDouble(data) * 1000);
|
||||
} catch (Exception e) {
|
||||
Log.e(e);
|
||||
throw new RuntimeException(e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user