Makes video filters automatically combine to allow de-interlacing when filters are executed
All checks were successful
KnarCraft/FFmpegConvert/pipeline/head This commit looks good
All checks were successful
KnarCraft/FFmpegConvert/pipeline/head This commit looks good
This commit is contained in:
parent
506273cbcd
commit
5db760d1a1
@ -18,6 +18,7 @@ public class FFMpegCommand implements Cloneable {
|
|||||||
private @NotNull List<String> outputFileOptions;
|
private @NotNull List<String> outputFileOptions;
|
||||||
private @Nullable String outputVideoCodec;
|
private @Nullable String outputVideoCodec;
|
||||||
private @NotNull String outputFile;
|
private @NotNull String outputFile;
|
||||||
|
private @NotNull String videoFilter = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new FFMPEG command
|
* Instantiates a new FFMPEG command
|
||||||
@ -83,6 +84,21 @@ public class FFMpegCommand implements Cloneable {
|
|||||||
* @param argument <p>The output file option(s) to add</p>
|
* @param argument <p>The output file option(s) to add</p>
|
||||||
*/
|
*/
|
||||||
public void addOutputFileOption(@NotNull String... argument) {
|
public void addOutputFileOption(@NotNull String... argument) {
|
||||||
|
StringBuilder filterBuilder = new StringBuilder(this.videoFilter);
|
||||||
|
for (int i = 0; i < argument.length; i++) {
|
||||||
|
if (argument[i].equals("-vf") || argument[i].equals("-filter:v")) {
|
||||||
|
if (!filterBuilder.toString().isBlank()) {
|
||||||
|
filterBuilder.append(", ").append(argument[i + 1]);
|
||||||
|
} else {
|
||||||
|
filterBuilder.append(argument[i + 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!this.videoFilter.contentEquals(filterBuilder)) {
|
||||||
|
this.videoFilter = filterBuilder.toString();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.outputFileOptions.addAll(List.of(argument));
|
this.outputFileOptions.addAll(List.of(argument));
|
||||||
|
|
||||||
// Detect when the output video codec is set
|
// Detect when the output video codec is set
|
||||||
@ -129,6 +145,10 @@ public class FFMpegCommand implements Cloneable {
|
|||||||
result.add(inputFile);
|
result.add(inputFile);
|
||||||
}
|
}
|
||||||
result.addAll(outputFileOptions);
|
result.addAll(outputFileOptions);
|
||||||
|
if (!videoFilter.isBlank()) {
|
||||||
|
result.add("-vf");
|
||||||
|
result.add("\"" + videoFilter + "\"");
|
||||||
|
}
|
||||||
if (!outputFile.isEmpty()) {
|
if (!outputFile.isEmpty()) {
|
||||||
result.add(outputFile);
|
result.add(outputFile);
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ public class LetterboxCropper extends AbstractConverter {
|
|||||||
probeCommand.addOutputFileOption("-vframes", "10");
|
probeCommand.addOutputFileOption("-vframes", "10");
|
||||||
probeCommand.addOutputFileOption("-vf", "cropdetect");
|
probeCommand.addOutputFileOption("-vf", "cropdetect");
|
||||||
probeCommand.addOutputFileOption("-f", "null");
|
probeCommand.addOutputFileOption("-f", "null");
|
||||||
probeCommand.addOutputFileOption("-");
|
probeCommand.setOutputFile("-");
|
||||||
|
|
||||||
double duration;
|
double duration;
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user