use of org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder in project fmv by f-agu.
the class FFHelper method audioGenerator.
/**
* @param outFile
* @throws IOException
*/
public static void audioGenerator(File outFile) throws IOException {
FFMPEGExecutorBuilder builder = FFMPEGExecutorBuilder.create();
AudioGenerator ag = AudioGenerator.build().expr("sin(440*2*PI*t)").sampleRate(44100).duration(Duration.valueOf(5));
builder.addMediaInput(ag.forInput());
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 encodeTox264_KeepChaptersAndSubtitles.
/**
* @param inMkvFile
* @param outMp4File
* @param locales
* @throws IOException
*/
public static void encodeTox264_KeepChaptersAndSubtitles(File inFile, File outFile, Collection<Locale> locales) throws IOException {
FFMPEGExecutorBuilder builder = FFMPEGExecutorBuilder.create();
builder.hideBanner();
InputProcessor inputProcessor = builder.addMediaInputFile(inFile);
MovieMetadatas videoMetadatas = inputProcessor.getMovieMetadatas();
OutputProcessor outputProcessor = builder.addMediaOutputFile(outFile);
for (Stream stream : videoMetadatas.getStreams()) {
// exclude some subtitles
// if(stream.is(Type.SUBTITLE) && ! locales.contains(stream.locale())) {
// continue;
// }
// if(stream.is(Type.AUDIO) && ! locales.contains(stream.locale())) {
// continue;
// }
outputProcessor.map().streams(stream).input(inputProcessor);
}
outputProcessor.codec(H264.findRecommanded().strict(Strict.EXPERIMENTAL).quality(23)).codecAutoSelectAAC().codecCopy(Type.SUBTITLE).overwrite();
FFExecutor<Object> executor = builder.build();
// System.out.println(executor.getCommandLine());
executor.execute();
}
use of org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder in project fmv by f-agu.
the class FFHelper method captureWebCam.
/**
* @param outFile
* @param duration
* @throws IOException
*/
public static void captureWebCam(File outFile, Duration duration) throws IOException {
FFMPEGExecutorBuilder builder = FFMPEGExecutorBuilder.create();
builder.addMediaInputWebCam().duration(duration);
builder.addMediaOutputFile(outFile);
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 speed.
/**
* @param inFile
* @param outFile
* @param multiplyBy
* @throws IOException
*/
public static void speed(File inFile, File outFile, float multiplyBy) throws IOException {
FFMPEGExecutorBuilder builder = FFMPEGExecutorBuilder.create();
InputProcessor inputProcessor = builder.addMediaInputFile(inFile);
Speed speed = Speed.multiply(multiplyBy);
speed.addInput(inputProcessor);
builder.filter(speed);
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 reencodeToH264.
/**
* @param inFile
* @throws IOException
*/
public static void reencodeToH264(File inFile, File outFile) throws IOException {
FFMPEGExecutorBuilder builder = FFMPEGExecutorBuilder.create();
builder.addMediaInputFile(inFile);
//
builder.mux(MP4Muxer.to(outFile)).codec(//
H264.findRecommanded().mostCompatible()).overwrite();
FFExecutor<Object> executor = builder.build();
System.out.println(executor.getCommandLine());
long startTime = System.currentTimeMillis();
executor.execute();
long endTime = System.currentTimeMillis();
System.out.println(endTime - startTime);
}
Aggregations