Search in sources :

Example 31 with InputProcessor

use of org.fagu.fmv.ffmpeg.operation.InputProcessor in project fmv by f-agu.

the class FFHelper method fade2.

/**
 * @param inFile
 * @param outFile
 * @param fadeType
 * @param duration
 * @throws IOException
 */
public static void fade2(File inFile, File outFile, FadeType fadeType, Duration duration) throws IOException {
    FFMPEGExecutorBuilder builder = FFMPEGExecutorBuilder.create();
    InputProcessor inputProcessor = builder.addMediaInputFile(inFile);
    Fade fade = Fade.create(fadeType, Time.valueOf(0), duration);
    fade.addInput(inputProcessor);
    builder.filter(fade);
    builder.addMediaOutputFile(outFile).overwrite();
    FFExecutor<Object> executor = builder.build();
    executor.execute();
}
Also used : FFMPEGExecutorBuilder(org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder) InputProcessor(org.fagu.fmv.ffmpeg.operation.InputProcessor) Fade(org.fagu.fmv.ffmpeg.filter.impl.Fade)

Example 32 with InputProcessor

use of org.fagu.fmv.ffmpeg.operation.InputProcessor in project fmv by f-agu.

the class FFMPEGExecutorBuilder method demux.

/**
 * @param muxer
 * @return
 */
public InputProcessor demux(Demuxer<?> demuxer) {
    MediaInput mediaInput = demuxer.getMediaInput();
    InputProcessor inputProcessor = addMediaInput(mediaInput);
    demuxer.eventAdded(inputProcessor, mediaInput);
    inputProcessor.format(demuxer.name());
    return inputProcessor;
}
Also used : InputProcessor(org.fagu.fmv.ffmpeg.operation.InputProcessor) IntMediaInput(org.fagu.fmv.ffmpeg.ioe.IntMediaInput) MediaInput(org.fagu.fmv.ffmpeg.operation.MediaInput) FileMediaInput(org.fagu.fmv.ffmpeg.ioe.FileMediaInput)

Example 33 with InputProcessor

use of org.fagu.fmv.ffmpeg.operation.InputProcessor in project fmv by f-agu.

the class FFMPEGExecutorBuilder method addMediaInput.

/**
 * @param input
 * @return
 */
public InputProcessor addMediaInput(MediaInput input) {
    if (input instanceof Demuxer) {
        return demux((Demuxer<?>) input);
    }
    Processor<?> processor = defaultFFMPEGOperation.getProcessor(input);
    if (processor != null && !(processor instanceof InputProcessor)) {
        throw new IllegalArgumentException("Already defined: " + input);
    }
    InputParameters inputParameters = defaultFFMPEGOperation.getInputParameters();
    return inputParameters.addInput(input);
}
Also used : Demuxer(org.fagu.fmv.ffmpeg.format.Demuxer) InputProcessor(org.fagu.fmv.ffmpeg.operation.InputProcessor) InputParameters(org.fagu.fmv.ffmpeg.operation.InputParameters)

Example 34 with InputProcessor

use of org.fagu.fmv.ffmpeg.operation.InputProcessor in project fmv by f-agu.

the class SourceSource method createAndAdd.

/**
 * @see org.fagu.fmv.core.exec.Source#createAndAdd(org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder)
 */
@Override
public FilterInput createAndAdd(FFMPEGExecutorBuilder builder) {
    InputProcessor inputProcessor = builder.addMediaInputFile(getProject().getSource(number).getFile());
    ObjectInvoker.invoke(inputProcessor, attributeMap);
    return inputProcessor;
}
Also used : InputProcessor(org.fagu.fmv.ffmpeg.operation.InputProcessor)

Example 35 with InputProcessor

use of org.fagu.fmv.ffmpeg.operation.InputProcessor in project fmv by f-agu.

the class FilterGraphUI method addRoot.

// **************************************************
/**
 */
private void addRoot() {
    Map<InputProcessor, Node> inputProcessorNodeMap = new HashMap<>();
    operation.getInputProcessorStream().forEach(ip -> {
        for (OutputKey outputKey : ip.getOutputKeys()) {
            Node node = createRootNode(ip, outputKey);
            inputProcessorNodeMap.put(ip, node);
        }
    });
    for (FilterComplex rootFC : filterGraph.getRoots()) {
        Map<IOKey, In> inputMap = rootFC.getInputMap();
        if (!inputMap.isEmpty()) {
            for (Entry<IOKey, In> entry : inputMap.entrySet()) {
                FilterInput filterInput = entry.getValue().getFilterInput();
                if (filterInput instanceof InputProcessor) {
                    Node node = inputProcessorNodeMap.get(filterInput);
                    Edge edge = graph.addEdge(node.getId() + "-" + rootFC.toString(), createOrGetNode(rootFC), node);
                // edge.addAttribute("ui.label", values);
                }
            }
        }
    }
}
Also used : IOKey(org.fagu.fmv.ffmpeg.filter.IOKey) FilterComplex(org.fagu.fmv.ffmpeg.filter.FilterComplex) HashMap(java.util.HashMap) In(org.fagu.fmv.ffmpeg.filter.FilterComplexBase.In) Node(org.graphstream.graph.Node) FilterInput(org.fagu.fmv.ffmpeg.filter.FilterInput) InputProcessor(org.fagu.fmv.ffmpeg.operation.InputProcessor) Edge(org.graphstream.graph.Edge) OutputKey(org.fagu.fmv.ffmpeg.filter.OutputKey)

Aggregations

InputProcessor (org.fagu.fmv.ffmpeg.operation.InputProcessor)43 FFMPEGExecutorBuilder (org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder)27 OutputProcessor (org.fagu.fmv.ffmpeg.operation.OutputProcessor)13 MovieMetadatas (org.fagu.fmv.ffmpeg.metadatas.MovieMetadatas)12 FilterComplex (org.fagu.fmv.ffmpeg.filter.FilterComplex)11 MediaInput (org.fagu.fmv.ffmpeg.operation.MediaInput)11 VideoStream (org.fagu.fmv.ffmpeg.metadatas.VideoStream)9 File (java.io.File)8 FilterInput (org.fagu.fmv.ffmpeg.filter.FilterInput)6 Test (org.junit.Test)6 NullSourceVideo (org.fagu.fmv.ffmpeg.filter.impl.NullSourceVideo)5 Duration (org.fagu.fmv.utils.time.Duration)5 Time (org.fagu.fmv.utils.time.Time)5 AudioGenerator (org.fagu.fmv.ffmpeg.filter.impl.AudioGenerator)4 MixAudioDuration (org.fagu.fmv.ffmpeg.filter.impl.AudioMix.MixAudioDuration)4 Blend (org.fagu.fmv.ffmpeg.filter.impl.Blend)4 Concat (org.fagu.fmv.ffmpeg.filter.impl.Concat)4 Format (org.fagu.fmv.ffmpeg.filter.impl.Format)4 SetSAR (org.fagu.fmv.ffmpeg.filter.impl.SetSAR)4 PixelFormat (org.fagu.fmv.ffmpeg.utils.PixelFormat)4