use of org.fagu.fmv.ffmpeg.filter.FilterInput in project fmv by f-agu.
the class ConcatExecutable method populateWithIdentifiables.
// *****************************************************
/**
* @see org.fagu.fmv.core.exec.executable.GenericExecutable#populateWithIdentifiables(java.io.File,
* org.fagu.fmv.core.exec.FileCache.Cache, org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder)
*/
@Override
protected List<FilterInput> populateWithIdentifiables(File toFile, Cache cache, FFMPEGExecutorBuilder builder) {
List<FilterInput> filterInputs = super.populateWithIdentifiables(toFile, cache, builder);
Concat concat = Concat.create(builder, filterInputs).countInputs(filterInputs.size());
builder.filter(concat);
filterInputs.add(concat);
return filterInputs;
}
use of org.fagu.fmv.ffmpeg.filter.FilterInput in project fmv by f-agu.
the class ConcatFadeExecutable method execute.
/**
* @see org.fagu.fmv.core.exec.Executable#execute()
*/
@Override
public void execute(File toFile, Cache cache) throws IOException {
if (!hasChildren()) {
return;
}
FFMPEGExecutorBuilder builder = FFUtils.builder(getProject());
List<InputProcessor> inputProcessors = new ArrayList<>();
// executable
for (Executable executable : executables) {
File file = getProject().getFileCache().getFile(executable, cache);
InputProcessor inputProcessor = builder.addMediaInputFile(file);
// audioMix.addInput(inputProcessor);
inputProcessors.add(inputProcessor);
}
// source
for (Source source : sources) {
FilterInput filterInput = source.createAndAdd(builder);
if (filterInput instanceof InputProcessor) {
inputProcessors.add((InputProcessor) filterInput);
// MovieMetadatas movieMetadatas = ((InputProcessor)filterInput).getMovieMetadatas();
// if(movieMetadatas.contains(Type.AUDIO)) {
// audioMix.addInput(filterInput, audioStart);
// } else {
// throw new RuntimeException("Source is not an audio stream: " + source);
// }
} else {
throw new RuntimeException("Source is not a InputProcessor: " + source);
}
}
applyConcatFade(builder, inputProcessors, toFile, cache);
FFExecutor<Object> executor = builder.build();
executor.execute();
}
use of org.fagu.fmv.ffmpeg.filter.FilterInput in project fmv by f-agu.
the class GenericExecutable method populateWithIdentifiables.
// *******************************************************
/**
* @param toFile
* @param cache
* @param builder
*/
protected List<FilterInput> populateWithIdentifiables(File toFile, Cache cache, FFMPEGExecutorBuilder builder) {
List<FilterInput> filterInputs = new ArrayList<>();
// executable
for (Executable executable : executables) {
File file = getProject().getFileCache().getFile(executable, cache);
filterInputs.add(builder.addMediaInputFile(file));
}
// source
for (Source source : sources) {
filterInputs.add(source.createAndAdd(builder));
}
// filters
for (FilterExec filterExec : getFilters()) {
Filter filter = filterExec.makeFilter(builder, cache);
builder.filter(filter);
if (filter instanceof FilterComplexBase) {
filterInputs.add((FilterComplexBase) filter);
}
}
return filterInputs;
}
use of org.fagu.fmv.ffmpeg.filter.FilterInput in project fmv by f-agu.
the class SpeedExecutable method populateWithIdentifiables.
/**
* @see org.fagu.fmv.core.exec.executable.GenericExecutable#populateWithIdentifiables(java.io.File,
* org.fagu.fmv.core.exec.FileCache.Cache, org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder)
*/
@Override
protected List<FilterInput> populateWithIdentifiables(File toFile, Cache cache, FFMPEGExecutorBuilder builder) {
List<FilterInput> filterInputs = super.populateWithIdentifiables(toFile, cache, builder);
if (filterInputs.size() != 1) {
throw new RuntimeException("For speed, only one input: " + filterInputs);
}
Speed speed = Speed.multiply(multiply);
speed.addInput(filterInputs.get(0));
builder.filter(speed);
filterInputs.add(speed);
return filterInputs;
}
Aggregations