Set FFmpeg maximum stream analyze duration to 10ms
This decreases the startup delay for streams processed by FFmpeg, such as H263 and rotated streams.
This commit is contained in:
parent
c6f0a82bba
commit
3701fce721
@ -51,6 +51,7 @@ public class H263Converter {
|
||||
ffmpeg.setFormat("flv");
|
||||
ffmpeg.setOutput(output);
|
||||
ffmpeg.setLoglevel("warning");
|
||||
ffmpeg.setAnalyzeDuration("10000"); // 10ms
|
||||
|
||||
this.addListener();
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ public class VideoRotator {
|
||||
ffmpeg.setOutput(output);
|
||||
ffmpeg.setLoglevel("warning");
|
||||
ffmpeg.setRotation(direction);
|
||||
ffmpeg.setAnalyzeDuration("10000"); // 10ms
|
||||
|
||||
start();
|
||||
}
|
||||
|
@ -22,6 +22,9 @@ public class FFmpegCommand {
|
||||
private String input;
|
||||
private String output;
|
||||
|
||||
/* Analyze duration is a special parameter that MUST come before the input */
|
||||
private String analyzeDuration;
|
||||
|
||||
public FFmpegCommand() {
|
||||
this.args = new HashMap();
|
||||
this.x264Params = new HashMap();
|
||||
@ -44,6 +47,12 @@ public class FFmpegCommand {
|
||||
|
||||
comm.add(this.ffmpegPath);
|
||||
|
||||
/* Analyze duration MUST come before the input */
|
||||
if(analyzeDuration != null && !analyzeDuration.isEmpty()) {
|
||||
comm.add("-analyzeduration");
|
||||
comm.add(analyzeDuration);
|
||||
}
|
||||
|
||||
comm.add("-i");
|
||||
comm.add(input);
|
||||
|
||||
@ -142,4 +151,15 @@ public class FFmpegCommand {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set how much time FFmpeg should analyze stream
|
||||
* data to get stream information. Note that this
|
||||
* affects directly the delay to start the stream.
|
||||
*
|
||||
* @param duration Rotate direction
|
||||
*/
|
||||
public void setAnalyzeDuration(String duration) {
|
||||
this.analyzeDuration = duration;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user