Search in sources :

Example 1 with Drawtext

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();
}
Also used : FFMPEGExecutorBuilder(org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder) Size(org.fagu.fmv.utils.media.Size) OutputInfos(org.fagu.fmv.core.project.OutputInfos) Drawtext(org.fagu.fmv.ffmpeg.filter.impl.Drawtext)

Aggregations

OutputInfos (org.fagu.fmv.core.project.OutputInfos)1 FFMPEGExecutorBuilder (org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder)1 Drawtext (org.fagu.fmv.ffmpeg.filter.impl.Drawtext)1 Size (org.fagu.fmv.utils.media.Size)1