use of org.fagu.fmv.ffmpeg.filter.impl.Fade in project fmv by f-agu.
the class FFHelper method splitTo3.
/**
* @param inFile
* @param outFile1
* @param outFile2
* @throws IOException
*/
public static void splitTo3(File inFile, File outFile1, File outFile2, File outFile3) throws IOException {
// outFile1 : no fade
// outFile2 : fade in
// outFile3 : fade out
FFMPEGExecutorBuilder builder = FFMPEGExecutorBuilder.create();
InputProcessor inputProcessor = builder.addMediaInputFile(inFile);
SplitVideo splitVideo = SplitVideo.build();
splitVideo.addInput(inputProcessor);
OutputKey outv1 = splitVideo.addOutput();
OutputKey outv2 = splitVideo.addOutput();
OutputKey outv3 = splitVideo.addOutput();
SplitAudio splitAudio = SplitAudio.build();
splitAudio.addInput(inputProcessor);
OutputKey outa1 = splitAudio.addOutput();
OutputKey outa2 = splitAudio.addOutput();
OutputKey outa3 = splitAudio.addOutput();
Fade fade2 = Fade.create(FadeType.IN, Time.valueOf(0), Duration.valueOf(1));
Fade fade3 = Fade.create(FadeType.OUT, Time.valueOf(0), Duration.valueOf(1));
fade2.addInput(outv2).addInput(outa2);
fade3.addInput(outv3).addInput(outa3);
builder.filter(splitVideo);
builder.filter(splitAudio);
builder.filter(fade2);
builder.filter(fade3);
OutputProcessor outputProcessor1 = builder.addMediaOutputFile(outFile1);
outputProcessor1.map().allStreams().label(outv1.getLabel()).label(outa1.getLabel());
outputProcessor1.overwrite();
OutputProcessor outputProcessor2 = builder.addMediaOutputFile(outFile2);
outputProcessor2.map().allStreams().input(fade2);
outputProcessor2.overwrite();
OutputProcessor outputProcessor3 = builder.addMediaOutputFile(outFile3);
outputProcessor3.map().allStreams().input(fade3);
outputProcessor3.overwrite();
FFExecutor<Object> executor = builder.build();
executor.execute();
}
use of org.fagu.fmv.ffmpeg.filter.impl.Fade 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();
}
Aggregations