use of org.fagu.fmv.ffmpeg.filter.impl.Drawtext in project fmv by f-agu.
the class FileCache method scaleForPreview.
/**
* @param inFile
* @param toFile
* @param id
* @throws IOException
*/
private void scaleForPreview(File inFile, File toFile, Identifiable identifiable) throws IOException {
OutputInfos outputInfos = project.getOutputInfos();
Size previewSize = outputInfos.getSize().fitAndKeepRatioTo(PREVIEW_SIZE);
FFMPEGExecutorBuilder builder = FFUtils.builder(project);
builder.addMediaInputFile(inFile);
builder.filter(Scale.to(previewSize, ScaleMode.fitToBox()));
Drawtext drawtext = Drawtext.build().x(0);
drawtext.y(16 * identifiable.getDepth(i -> i instanceof Executable));
drawtext.text(identifiable.getId() + " - %{pts} / %{n}").fontColor(Color.WHITE).fontSize(15);
builder.filter(drawtext);
builder.addMediaOutputFile(toFile).format(outputInfos.getFormat()).overwrite();
FFExecutor<Object> build = builder.build();
build.execute();
}
Aggregations