use of org.fagu.fmv.ffmpeg.executor.FFExecFallback in project fmv by f-agu.
the class FFHelper method resize.
/**
* @param inFile
* @param size
* @param outFile
* @throws IOException
*/
public static void resize(File inFile, Size size, File outFile) throws IOException {
FFMPEGExecutorBuilder builder = FFMPEGExecutorBuilder.create();
InputProcessor inputProcessor = builder.addMediaInputFile(inFile);
builder.filter(Scale.to(size, ScaleMode.fitToBoxKeepAspectRatio()));
builder.mux(MP4Muxer.to(outFile)).qualityScaleVideo(0).codecCopy(Type.AUDIO).codecCopy(Type.SUBTITLE).mapAllStreams(inputProcessor).overwrite();
FFExecutor<Object> executor = builder.build();
executor.addListener(new FFExecListener() {
@Override
public void eventExecFailed(IOException e, CommandLine command) {
System.out.println("FAILED: " + CommandLineUtils.toLine(command));
}
@Override
public void eventPreExecFallbacks(CommandLine command, Collection<FFExecFallback> fallbacks) {
System.out.println("With fallback: " + fallbacks);
System.out.println(" -->: " + CommandLineUtils.toLine(command));
}
});
executor.execute();
}
Aggregations