use of org.fagu.fmv.core.exec.Executable in project fmv by f-agu.
the class Append method getConcatExecutable.
// ********************************************
/**
* @return
*/
private ConcatExecutable getConcatExecutable() {
Executable currentExecutable = environnement.getCurrentExecutable();
if (currentExecutable != null && currentExecutable instanceof ConcatExecutable) {
return (ConcatExecutable) currentExecutable;
}
List<ConcatExecutable> execs = BaseIdentifiable.stream(project).filter(id -> id instanceof ConcatExecutable).map(id -> (ConcatExecutable) id).collect(Collectors.toList());
int size = execs.size();
if (size == 0) {
return new ConcatExecutable(project);
}
if (size == 1) {
return execs.get(0);
}
Printer printer = getPrinter();
printer.println("Too many executable.");
printer.println("List all executables: execlist");
printer.println("And select one: toexecutable <id>");
return null;
}
use of org.fagu.fmv.core.exec.Executable 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.core.exec.Executable 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.core.exec.Executable in project fmv by f-agu.
the class Make method run.
/**
* @see org.fagu.fmv.cli.Command#run(java.lang.String[])
*/
@Override
public void run(String[] args) {
List<Executable> executables = project.getExecutables();
if (executables.isEmpty()) {
return;
}
File file = project.getFileCache().getFile(executables.get(0), Cache.MAKE);
System.out.println(file);
OpenFile openFile = new OpenFile(fmvCliConfig, getPrinter());
openFile.open(file, FileType.VIDEO);
}
use of org.fagu.fmv.core.exec.Executable in project fmv by f-agu.
the class Preview method run.
/**
* @see org.fagu.fmv.cli.Command#run(java.lang.String[])
*/
@Override
public void run(String[] args) {
List<Executable> executables = project.getExecutables();
if (executables.isEmpty()) {
return;
}
File file = project.getFileCache().getFile(executables.get(0), Cache.PREVIEW);
System.out.println(file);
OpenFile openFile = new OpenFile(fmvCliConfig, getPrinter());
openFile.open(file, FileType.VIDEO);
}
Aggregations