use of org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder in project fmv by f-agu.
the class FFHelper method audioVolumeAdjustToMax.
/**
* @param inFile
* @param outFile
* @throws IOException
*/
public static void audioVolumeAdjustToMax(File inFile, File outFile) throws IOException {
VolumeDetected volumeDetected = audioVolumeDetect(inFile);
System.out.println(volumeDetected);
FFMPEGExecutorBuilder builder = FFMPEGExecutorBuilder.create();
builder.addMediaInputFile(inFile);
Volume volume = Volume.build().increaseToMax(volumeDetected);
builder.filter(volume);
builder.addMediaOutputFile(outFile).videoCodecCopy().overwrite();
FFExecutor<Object> executor = builder.build();
executor.execute();
}
use of org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder in project fmv by f-agu.
the class FFHelper method audioConvert2AAC.
/**
* @param inFile
* @param outFile
* @throws IOException
*/
public static void audioConvert2AAC(File inFile, File outFile) throws IOException {
FFMPEGExecutorBuilder builder = FFMPEGExecutorBuilder.create();
builder.addMediaInputFile(inFile);
builder.mux(BasicStreamMuxer.to(outFile).movflags(Movflags.FASTSTART)).codec(LibFDK_AAC.build()).overwrite();
FFExecutor<Object> executor = builder.build();
executor.execute();
}
use of org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder in project fmv by f-agu.
the class FFHelper method m4aToMp3.
/**
* @param inFile
* @param outFile
* @throws IOException
*/
public static void m4aToMp3(File inFile, File outFile) throws IOException {
final int SAMPLE_RATE = 44100;
final String bitRate = "128k";
FFMPEGExecutorBuilder builder = FFMPEGExecutorBuilder.create();
builder.hideBanner();
InputProcessor inputProcessor = builder.addMediaInputFile(inFile);
MovieMetadatas movieMetadatas = inputProcessor.getMovieMetadatas();
int sampleRate = Math.min(movieMetadatas.getAudioStream().sampleRate().orElse(SAMPLE_RATE), SAMPLE_RATE);
FilterComplex filter = FilterComplex.create(ResampleAudio.build().frequency(sampleRate));
builder.filter(filter);
OutputProcessor outputProcessor = builder.addMediaOutputFile(outFile).audioChannel(2).audioBitRate(bitRate).format("mp3").overwrite();
outputProcessor.map().allStreams().input(filter);
FFExecutor<Object> executor = builder.build();
System.out.println(executor.getCommandLine());
// Integer numberOfFrames =
// movieMetadatas.getAudioStream().countEstimateFrames();
// prepareProgressBar(numberOfFrames, executor, consolePrefixMessage);
// executor.execute();
}
use of org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder in project fmv by f-agu.
the class FFHelper method fade1.
/**
* @param inFile
* @param outFile
* @param fadeType
* @param duration
* @throws IOException
*/
public static void fade1(File inFile, File outFile, FadeType fadeType, Duration duration) throws IOException {
FFMPEGExecutorBuilder builder = FFMPEGExecutorBuilder.create();
builder.addMediaInputFile(inFile);
FadeVideo fadeVideo = FadeVideo.build().type(fadeType).startTime(Time.valueOf(0)).duration(duration);
FadeAudio fadeAudio = FadeAudio.build().type(fadeType).startTime(Time.valueOf(0)).duration(duration);
builder.filter(fadeVideo).filter(fadeAudio);
builder.addMediaOutputFile(outFile).overwrite();
FFExecutor<Object> executor = builder.build();
executor.execute();
}
use of org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder in project fmv by f-agu.
the class FFHelper method mixAudio.
/**
* @param inVideoFile
* @param inAudioFile
* @param outFile
* @throws IOException
*/
public static void mixAudio(File inVideoFile, File inAudioFile, File outFile, Time audioStart) throws IOException {
FFMPEGExecutorBuilder builder = FFMPEGExecutorBuilder.create();
InputProcessor videoInputProcessor = builder.addMediaInputFile(inVideoFile);
InputProcessor audioInputProcessor = builder.addMediaInputFile(inAudioFile);
// audioInputProcessor.timeSeek(audioStart);
AudioMix audioMix = AudioMix.build();
audioMix.addInput(audioInputProcessor, audioStart);
audioMix.addInput(videoInputProcessor);
audioMix.duration(MixAudioDuration.SHORTEST);
builder.filter(audioMix);
builder.addMediaOutputFile(outFile).videoCodecCopy().overwrite();
FFExecutor<Object> executor = builder.build();
executor.execute();
}
Aggregations