如题 ppt自带的视频导出功能 aspose有相应的 方法支持么?
@LukeWoW,
感谢您发布问题。
Aspose.Slides 不会直接将 PowerPoint 演示文稿转换为视频。 它只允许您将演示文稿转换为图像(帧)序列。 然后你应该使用一些可以将图像序列转换为视频的工具(如 FFmpeg)。
final int FPS = 30;
Presentation presentation = new Presentation("animated.pptx");
try {
PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(presentation);
try {
PresentationPlayer player = new PresentationPlayer(animationsGenerator, FPS);
try {
player.setFrameTick((sender, args) ->
{
try {
ImageIO.write(args.getFrame(), "PNG", new File("frame_" + sender.getFrameIndex() + ".png"));
} catch (IOException e) {
throw new RuntimeException(e);
}
});
animationsGenerator.run(presentation.getSlides());
} finally {
if (player != null) player.dispose();
}
} finally {
if (animationsGenerator != null) animationsGenerator.dispose();
}
} finally {
if (presentation != null) presentation.dispose();
}