Search in sources :

Example 6 with FilterInput

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;
}
Also used : Concat(org.fagu.fmv.ffmpeg.filter.impl.Concat) FilterInput(org.fagu.fmv.ffmpeg.filter.FilterInput)

Example 7 with FilterInput

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();
}
Also used : FFMPEGExecutorBuilder(org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder) FilterInput(org.fagu.fmv.ffmpeg.filter.FilterInput) ArrayList(java.util.ArrayList) InputProcessor(org.fagu.fmv.ffmpeg.operation.InputProcessor) Executable(org.fagu.fmv.core.exec.Executable) File(java.io.File) Source(org.fagu.fmv.core.exec.Source)

Example 8 with FilterInput

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;
}
Also used : FilterExec(org.fagu.fmv.core.exec.FilterExec) Filter(org.fagu.fmv.ffmpeg.filter.Filter) FilterInput(org.fagu.fmv.ffmpeg.filter.FilterInput) ArrayList(java.util.ArrayList) FilterComplexBase(org.fagu.fmv.ffmpeg.filter.FilterComplexBase) Executable(org.fagu.fmv.core.exec.Executable) File(java.io.File) Source(org.fagu.fmv.core.exec.Source)

Example 9 with FilterInput

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;
}
Also used : Speed(org.fagu.fmv.ffmpeg.filter.impl.Speed) FilterInput(org.fagu.fmv.ffmpeg.filter.FilterInput)

Aggregations

FilterInput (org.fagu.fmv.ffmpeg.filter.FilterInput)9 InputProcessor (org.fagu.fmv.ffmpeg.operation.InputProcessor)6 File (java.io.File)5 ArrayList (java.util.ArrayList)4 Executable (org.fagu.fmv.core.exec.Executable)3 Source (org.fagu.fmv.core.exec.Source)3 Filter (org.fagu.fmv.ffmpeg.filter.Filter)3 FilterComplex (org.fagu.fmv.ffmpeg.filter.FilterComplex)3 FilterExec (org.fagu.fmv.core.exec.FilterExec)2 FFMPEGExecutorBuilder (org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder)2 In (org.fagu.fmv.ffmpeg.filter.FilterComplexBase.In)2 GeneratedSource (org.fagu.fmv.ffmpeg.filter.GeneratedSource)2 IOKey (org.fagu.fmv.ffmpeg.filter.IOKey)2 OutputKey (org.fagu.fmv.ffmpeg.filter.OutputKey)2 MediaInput (org.fagu.fmv.ffmpeg.operation.MediaInput)2 Type (org.fagu.fmv.ffmpeg.operation.Type)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Identifiable (org.fagu.fmv.core.exec.Identifiable)1 FilterComplexBase (org.fagu.fmv.ffmpeg.filter.FilterComplexBase)1