Search in sources :

Example 41 with FFMPEGExecutorBuilder

use of org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder in project fmv by f-agu.

the class FFHelper method autoRotate.

/**
 * @param inFile
 * @param outFile
 * @param size
 * @throws IOException
 */
public static void autoRotate(File inFile, File outFile) throws IOException {
    FFMPEGExecutorBuilder builder = FFMPEGExecutorBuilder.create();
    InputProcessor inputProcessor = builder.addMediaInputFile(inFile);
    builder.filter(AutoRotate.create(inputProcessor.getMovieMetadatas()));
    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)

Example 42 with FFMPEGExecutorBuilder

use of org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder in project fmv by f-agu.

the class FFHelper method extractOneThumbnail.

/**
 * @param inFile
 * @param outImageFile
 * @param time
 * @return
 * @throws IOException
 */
public static void extractOneThumbnail(File inFile, File outImageFile, Time time) throws IOException {
    FFMPEGExecutorBuilder builder = FFMPEGExecutorBuilder.create();
    builder.addMediaInputFile(inFile);
    builder.mux(Image2Muxer.to(outImageFile)).timeSeek(time).numberOfVideoFrameToRecord(// only one thumbnail
    1).overwrite();
    FFExecutor<Object> executor = builder.build();
    executor.execute();
}
Also used : FFMPEGExecutorBuilder(org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder)

Example 43 with FFMPEGExecutorBuilder

use of org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder in project fmv by f-agu.

the class FFHelper method cropDetect.

/**
 * @param inFile
 * @throws IOException
 */
public static CropDetection cropDetect(File inFile) throws IOException {
    FFMPEGExecutorBuilder builder = FFMPEGExecutorBuilder.create();
    builder.addMediaInputFile(inFile).timeSeek(Time.parse("36:05")).duration(Duration.valueOf(3));
    CropDetect cropDetect = CropDetect.build();
    builder.filter(cropDetect);
    builder.addMediaOutput(NullMuxer.build()).overwrite();
    FFExecutor<Object> executor = builder.build();
    System.out.println(executor.getCommandLine());
    executor.execute();
    return cropDetect.getCropSizeDetected();
}
Also used : FFMPEGExecutorBuilder(org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder) CropDetect(org.fagu.fmv.ffmpeg.filter.impl.CropDetect)

Example 44 with FFMPEGExecutorBuilder

use of org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder 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 45 with FFMPEGExecutorBuilder

use of org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder in project fmv by f-agu.

the class FFHelper method extractPart.

/**
 * @param inFile
 * @param outFolder
 * @param startTime
 * @param duration
 * @throws IOException
 */
public static void extractPart(File inFile, File outFile, Time startTime, Duration duration) throws IOException {
    FFMPEGExecutorBuilder builder = FFMPEGExecutorBuilder.create();
    // input
    builder.addMediaInputFile(inFile).timeSeek(startTime);
    // ouput
    builder.mux(MP4Muxer.to(outFile).avoidNegativeTs(AvoidNegativeTs.MAKE_NON_NEGATIVE)).duration(duration).qualityScale(0).codec(H264.findRecommanded().mostCompatible()).overwrite();
    // execute
    builder.build().execute();
}
Also used : FFMPEGExecutorBuilder(org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder)

Aggregations

FFMPEGExecutorBuilder (org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder)55 InputProcessor (org.fagu.fmv.ffmpeg.operation.InputProcessor)27 OutputProcessor (org.fagu.fmv.ffmpeg.operation.OutputProcessor)19 MovieMetadatas (org.fagu.fmv.ffmpeg.metadatas.MovieMetadatas)16 File (java.io.File)12 FilterComplex (org.fagu.fmv.ffmpeg.filter.FilterComplex)11 VideoStream (org.fagu.fmv.ffmpeg.metadatas.VideoStream)9 Size (org.fagu.fmv.utils.media.Size)6 Concat (org.fagu.fmv.ffmpeg.filter.impl.Concat)5 IOException (java.io.IOException)4 OptionalInt (java.util.OptionalInt)4 AudioGenerator (org.fagu.fmv.ffmpeg.filter.impl.AudioGenerator)4 NullSourceVideo (org.fagu.fmv.ffmpeg.filter.impl.NullSourceVideo)4 Progress (org.fagu.fmv.ffmpeg.operation.Progress)4 Duration (org.fagu.fmv.utils.time.Duration)4 Executable (org.fagu.fmv.core.exec.Executable)3 Source (org.fagu.fmv.core.exec.Source)3 OutputInfos (org.fagu.fmv.core.project.OutputInfos)3 MixAudioDuration (org.fagu.fmv.ffmpeg.filter.impl.AudioMix.MixAudioDuration)3 Blend (org.fagu.fmv.ffmpeg.filter.impl.Blend)3