Search in sources :

Example 11 with MediaInput

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

the class FilterComplexBase method countVariousInput.

/**
 * @return
 */
public int countVariousInput() {
    Set<MediaInput> inputs = new HashSet<MediaInput>();
    int countSrcGen = 0;
    for (MediaInput input : getInputs()) {
        inputs.add(input);
        if (input instanceof GeneratedSource) {
            ++countSrcGen;
        }
    }
    return inputs.size() - (countSrcGen >= 1 ? 1 : 0);
}
Also used : MediaInput(org.fagu.fmv.ffmpeg.operation.MediaInput) HashSet(java.util.HashSet)

Example 12 with MediaInput

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

the class MockFFMPEGExecutorBuilder method mock.

/**
 * @param movieMetadatasSupplier
 * @param commandExecute
 */
public static void mock(Supplier<Function<String, MovieMetadatas>> movieMetadatasSupplier, final Consumer<String> commandExecute) {
    FFMPEGExecutorBuilder.setFactory(() -> {
        final FFExecutorFactory ffExecutorFactory = new FFExecutorFactory() {

            @Override
            public <R> FFExecutor<R> create(Operation<R, ?> operation, FFMPEGExecutorBuilder ffmpegExecutorBuilder) {
                return new FFExecutor<R>(operation) {

                    /**
                     * @see org.fagu.fmv.ffmpeg.executor.FFExecutor#execute()
                     */
                    @Override
                    public Executed<R> execute() throws IOException {
                        commandExecute.accept(getCommandLine());
                        return null;
                    }
                };
            }
        };
        Require require = new Require(false);
        DefaultFFMPEGOperation<?> defaultFFMPEGOperation = new DefaultFFMPEGOperation<Object>(new FilterNaming(), require);
        defaultFFMPEGOperation.getInputParameters().setInputProcessorFactory(new InputProcessorFactory() {

            /**
             * @see org.fagu.fmv.ffmpeg.operation.InputProcessorFactory#create(org.fagu.fmv.ffmpeg.operation.InputParameters,
             *      org.fagu.fmv.ffmpeg.operation.MediaInput, int, org.fagu.fmv.ffmpeg.require.Require)
             */
            @Override
            public InputProcessor create(InputParameters inputParameters, MediaInput input, int index, Require require) {
                return new MyInputProcessor(movieMetadatasSupplier.get(), inputParameters, input, index, require);
            }
        });
        return new MyFFMPEGExecutorBuilder(ffExecutorFactory, defaultFFMPEGOperation);
    });
}
Also used : FFExecutorFactory(org.fagu.fmv.ffmpeg.executor.FFExecutorFactory) FFMPEGExecutorBuilder(org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder) Require(org.fagu.fmv.ffmpeg.require.Require) InputProcessor(org.fagu.fmv.ffmpeg.operation.InputProcessor) Operation(org.fagu.fmv.ffmpeg.operation.Operation) DefaultFFMPEGOperation(org.fagu.fmv.ffmpeg.operation.DefaultFFMPEGOperation) DefaultFFMPEGOperation(org.fagu.fmv.ffmpeg.operation.DefaultFFMPEGOperation) FFExecutor(org.fagu.fmv.ffmpeg.executor.FFExecutor) InputProcessorFactory(org.fagu.fmv.ffmpeg.operation.InputProcessorFactory) FilterNaming(org.fagu.fmv.ffmpeg.filter.FilterNaming) InputParameters(org.fagu.fmv.ffmpeg.operation.InputParameters) MediaInput(org.fagu.fmv.ffmpeg.operation.MediaInput)

Example 13 with MediaInput

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

the class FFMPEGExecutorBuilderTestCase method testInputProcessor_frameRate.

/**
 */
@Test
public void testInputProcessor_frameRate() {
    MediaInput input = mockInput("/path/file");
    InputProcessor inputProcessor = ffmpegExecutorBuilder.addMediaInput(input);
    inputProcessor.frameRate(FrameRate.PAL);
    assertArgs("-r", "25", "-i", "/path/file");
}
Also used : InputProcessor(org.fagu.fmv.ffmpeg.operation.InputProcessor) MediaInput(org.fagu.fmv.ffmpeg.operation.MediaInput) Test(org.junit.Test)

Example 14 with MediaInput

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

the class FFMPEGExecutorBuilderTestCase method testInputProcessor_size.

/**
 */
@Test
public void testInputProcessor_size() {
    MediaInput input = mockInput("/path/file");
    InputProcessor inputProcessor = ffmpegExecutorBuilder.addMediaInput(input);
    inputProcessor.size(Size.HD720);
    assertArgs("-s", "hd720", "-i", "/path/file");
}
Also used : InputProcessor(org.fagu.fmv.ffmpeg.operation.InputProcessor) MediaInput(org.fagu.fmv.ffmpeg.operation.MediaInput) Test(org.junit.Test)

Example 15 with MediaInput

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

the class FFMPEGExecutorBuilderTestCase method testInputProcessor_timeSeek.

/**
 */
@Test
public void testInputProcessor_timeSeek() {
    MediaInput input = mockInput("/path/file");
    InputProcessor inputProcessor = ffmpegExecutorBuilder.addMediaInput(input);
    inputProcessor.timeSeek(new Time(1, 2, 3.4));
    assertArgs("-ss", "01:02:03.400", "-i", "/path/file");
}
Also used : InputProcessor(org.fagu.fmv.ffmpeg.operation.InputProcessor) Time(org.fagu.fmv.utils.time.Time) MediaInput(org.fagu.fmv.ffmpeg.operation.MediaInput) Test(org.junit.Test)

Aggregations

MediaInput (org.fagu.fmv.ffmpeg.operation.MediaInput)15 InputProcessor (org.fagu.fmv.ffmpeg.operation.InputProcessor)11 Test (org.junit.Test)7 FFExecutor (org.fagu.fmv.ffmpeg.executor.FFExecutor)2 FilterComplex (org.fagu.fmv.ffmpeg.filter.FilterComplex)2 FilterInput (org.fagu.fmv.ffmpeg.filter.FilterInput)2 GeneratedSource (org.fagu.fmv.ffmpeg.filter.GeneratedSource)2 FileMediaInput (org.fagu.fmv.ffmpeg.ioe.FileMediaInput)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 FFExecutorFactory (org.fagu.fmv.ffmpeg.executor.FFExecutorFactory)1 FFMPEGExecutorBuilder (org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder)1 Filter (org.fagu.fmv.ffmpeg.filter.Filter)1 In (org.fagu.fmv.ffmpeg.filter.FilterComplexBase.In)1 FilterNaming (org.fagu.fmv.ffmpeg.filter.FilterNaming)1 IOKey (org.fagu.fmv.ffmpeg.filter.IOKey)1 OutputKey (org.fagu.fmv.ffmpeg.filter.OutputKey)1 IntMediaInput (org.fagu.fmv.ffmpeg.ioe.IntMediaInput)1 MovieMetadatas (org.fagu.fmv.ffmpeg.metadatas.MovieMetadatas)1