PowerPoint をビデオに変換
PowerPoint プレゼンテーションをビデオに変換することで、次のメリットがあります
- アクセシビリティの向上: すべてのデバイス (プラットフォームに関係なく) はデフォルトでビデオプレーヤーを搭載しているため、プレゼンテーション用アプリケーションよりもビデオの再生や開くが容易です。
- リーチの拡大: ビデオを通じて多くの視聴者にリーチでき、プレゼンテーションで退屈に感じられる情報も提供できます。多くの調査や統計によれば、人々は他のコンテンツ形態よりもビデオを視聴・消費する傾向があり、一般的にそのようなコンテンツを好みます。
Aspose.Slides における PowerPoint からビデオへの変換
Aspose.Slides 22.11 では、プレゼンテーションからビデオへの変換機能を実装しました。
- Aspose.Slides を使用して、プレゼンテーションのスライドから特定の FPS (フレーム毎秒) に対応するフレームのセットを生成します
- ffmpeg のようなサードパーティユーティリティ (for java) を使用して、フレームからビデオを作成します
PowerPoint をビデオに変換
- ffmpeg を ここ からダウンロードします。
- PowerPoint からビデオへの JavaScript コードを実行します。
この JavaScript コードは、図と 2 つのアニメーション効果を含むプレゼンテーションをビデオに変換する方法を示しています:
var presentation = new aspose.slides.Presentation();
try {
// 笑顔のシェイプを追加し、アニメーションを適用します
var smile = presentation.getSlides().get_Item(0).getShapes().addAutoShape(aspose.slides.ShapeType.SmileyFace, 110, 20, 500, 500);
var mainSequence = presentation.getSlides().get_Item(0).getTimeline().getMainSequence();
var effectIn = mainSequence.addEffect(smile, aspose.slides.EffectType.Fly, aspose.slides.EffectSubtype.TopLeft, aspose.slides.EffectTriggerType.AfterPrevious);
var effectOut = mainSequence.addEffect(smile, aspose.slides.EffectType.Fly, aspose.slides.EffectSubtype.BottomRight, aspose.slides.EffectTriggerType.AfterPrevious);
effectIn.getTiming().setDuration(2.0);
effectOut.setPresetClassType(aspose.slides.EffectPresetClassType.Exit);
final var fps = 33;
var frames = java.newInstanceSync("java.util.ArrayList");
var animationsGenerator = new aspose.slides.PresentationAnimationsGenerator(presentation);
try {
var player = new aspose.slides.PresentationPlayer(animationsGenerator, fps);
try {
player.setFrameTick((sender, arguments) -> {
try {
var frame = java.callStaticMethodSync("java.lang.String", "format", "frame_%04d.png", sender.getFrameIndex());
arguments.getFrame().save(frame, aspose.slides.ImageFormat.Png);
frames.add(frame);
} catch (e) {console.log(e);
throw java.newInstanceSync("java.lang.RuntimeException", e);
}
});
animationsGenerator.run(presentation.getSlides());
} finally {
if (player != null) {
player.dispose();
}
}
} finally {
if (animationsGenerator != null) {
animationsGenerator.dispose();
}
}
// ffmpeg バイナリフォルダを設定します。このページをご参照ください: https://github.com/rosenbjerg/FFMpegCore#installation
var ffmpeg = java.newInstanceSync("FFmpeg", "path/to/ffmpeg");
var ffprobe = java.newInstanceSync("FFprobe", "path/to/ffprobe");
var builder = java.newInstanceSync("FFmpegBuilder").addExtraArgs("-start_number", "1").setInput("frame_%04d.png").addOutput("output.avi").setVideoFrameRate(java.getStaticFieldValue("FFmpeg", "FPS_24")).setFormat("avi").done();
var executor = java.newInstanceSync("FFmpegExecutor", ffmpeg, ffprobe);
executor.createJob(builder).run();
} catch (e) {console.log(e);
console.log(e);
}
ビデオエフェクト
スライド上のオブジェクトにアニメーションを適用したり、スライド間のトランジションを使用したりできます。
アニメーションとトランジションはスライドショーをより魅力的にし、ビデオでも同様の効果があります。前のプレゼンテーションのコードに別のスライドとトランジションを追加してみましょう:
// 笑顔のシェイプを追加し、アニメーションを適用します
// ...
// 新しいスライドを追加し、アニメーション付きトランジションを設定します
var newSlide = presentation.getSlides().addEmptySlide(presentation.getSlides().get_Item(0).getLayoutSlide());
newSlide.getBackground().setType(aspose.slides.BackgroundType.OwnBackground);
newSlide.getBackground().getFillFormat().setFillType(java.newByte(aspose.slides.FillType.Solid));
newSlide.getBackground().getFillFormat().getSolidFillColor().setColor(java.getStaticFieldValue("java.awt.Color", "MAGENTA"));
newSlide.getSlideShowTransition().setType(aspose.slides.TransitionType.Push);
Aspose.Slides はテキストのアニメーションもサポートしています。オブジェクト上の段落をアニメーションさせ、1 秒の遅延で順番に表示させます:
var presentation = new aspose.slides.Presentation();
try {
// テキストとアニメーションを追加します
var autoShape = presentation.getSlides().get_Item(0).getShapes().addAutoShape(aspose.slides.ShapeType.Rectangle, 210, 120, 300, 300);
var para1 = new aspose.slides.Paragraph();
para1.getPortions().add(new aspose.slides.Portion("Aspose Slides for Node.js via Java"));
var para2 = new aspose.slides.Paragraph();
para2.getPortions().add(new aspose.slides.Portion("convert PowerPoint Presentation with text to video"));
var para3 = new aspose.slides.Paragraph();
para3.getPortions().add(new aspose.slides.Portion("paragraph by paragraph"));
var paragraphCollection = autoShape.getTextFrame().getParagraphs();
paragraphCollection.add(para1);
paragraphCollection.add(para2);
paragraphCollection.add(para3);
paragraphCollection.add(new aspose.slides.Paragraph());
var mainSequence = presentation.getSlides().get_Item(0).getTimeline().getMainSequence();
var effect1 = mainSequence.addEffect(para1, aspose.slides.EffectType.Appear, aspose.slides.EffectSubtype.None, aspose.slides.EffectTriggerType.AfterPrevious);
var effect2 = mainSequence.addEffect(para2, aspose.slides.EffectType.Appear, aspose.slides.EffectSubtype.None, aspose.slides.EffectTriggerType.AfterPrevious);
var effect3 = mainSequence.addEffect(para3, aspose.slides.EffectType.Appear, aspose.slides.EffectSubtype.None, aspose.slides.EffectTriggerType.AfterPrevious);
var effect4 = mainSequence.addEffect(para3, aspose.slides.EffectType.Appear, aspose.slides.EffectSubtype.None, aspose.slides.EffectTriggerType.AfterPrevious);
effect1.getTiming().setTriggerDelayTime(1.0);
effect2.getTiming().setTriggerDelayTime(1.0);
effect3.getTiming().setTriggerDelayTime(1.0);
effect4.getTiming().setTriggerDelayTime(1.0);
final var fps = 33;
var frames = java.newInstanceSync("java.util.ArrayList");
var animationsGenerator = new aspose.slides.PresentationAnimationsGenerator(presentation);
try {
var player = new aspose.slides.PresentationPlayer(animationsGenerator, fps);
try {
player.setFrameTick((sender, arguments) -> {
try {
var frame = java.callStaticMethodSync("java.lang.String", "format", "frame_%04d.png", sender.getFrameIndex());
arguments.getFrame().save(frame, aspose.slides.ImageFormat.Png);
frames.add(frame);
} catch (e) {console.log(e);
throw java.newInstanceSync("java.lang.RuntimeException", e);
}
});
animationsGenerator.run(presentation.getSlides());
} finally {
if (player != null) {
player.dispose();
}
}
} finally {
if (animationsGenerator != null) {
animationsGenerator.dispose();
}
}
// ffmpeg バイナリフォルダを設定します。このページをご覧ください: https://github.com/rosenbjerg/FFMpegCore#installation
var ffmpeg = java.newInstanceSync("FFmpeg", "path/to/ffmpeg");
var ffprobe = java.newInstanceSync("FFprobe", "path/to/ffprobe");
var builder = java.newInstanceSync("FFmpegBuilder").addExtraArgs("-start_number", "1").setInput("frame_%04d.png").addOutput("output.avi").setVideoFrameRate(java.getStaticFieldValue("FFmpeg", "FPS_24")).setFormat("avi").done();
var executor = java.newInstanceSync("FFmpegExecutor", ffmpeg, ffprobe);
executor.createJob(builder).run();
} catch (e) {console.log(e);
console.log(e);
}
ビデオ変換クラス
PowerPoint からビデオへの変換タスクを実行できるように、Aspose.Slides は PresentationAnimationsGenerator と PresentationPlayer クラスを提供します。
PresentationAnimationsGenerator は、コンストラクタでビデオのフレームサイズを設定できます。プレゼンテーションのインスタンスを渡すと Presentation.getSlideSize が使用され、生成されたアニメーションは PresentationPlayer が使用します。
アニメーションが生成されると、各アニメーションごとに NewAnimation イベントが発生し、PresentationAnimationPlayer パラメータが渡されます。後者は個別アニメーション用のプレーヤークラスです。
PresentationAnimationPlayer を使用するには、getDuration (アニメーションの全長) メソッドと setTimePosition メソッドを利用します。各アニメーション位置は 0 から duration の範囲で設定され、getFrame メソッドはその時点のアニメーション状態に対応する BufferedImage を返します:
var presentation = new aspose.slides.Presentation();
try {
// 笑顔のシェイプを追加し、アニメーションさせます
var smile = presentation.getSlides().get_Item(0).getShapes().addAutoShape(aspose.slides.ShapeType.SmileyFace, 110, 20, 500, 500);
var mainSequence = presentation.getSlides().get_Item(0).getTimeline().getMainSequence();
var effectIn = mainSequence.addEffect(smile, aspose.slides.EffectType.Fly, aspose.slides.EffectSubtype.TopLeft, aspose.slides.EffectTriggerType.AfterPrevious);
var effectOut = mainSequence.addEffect(smile, aspose.slides.EffectType.Fly, aspose.slides.EffectSubtype.BottomRight, aspose.slides.EffectTriggerType.AfterPrevious);
effectIn.getTiming().setDuration(2.0);
effectOut.setPresetClassType(aspose.slides.EffectPresetClassType.Exit);
var animationsGenerator = new aspose.slides.PresentationAnimationsGenerator(presentation);
try {
animationsGenerator.setNewAnimation(animationPlayer -> {
console.log(java.callStaticMethodSync("java.lang.String", "format", "Animation total duration: %f", animationPlayer.getDuration()));
animationPlayer.setTimePosition(0);// 初期アニメーション状態
try {
// 初期アニメーション状態のビットマップ
animationPlayer.getFrame().save("firstFrame.png", aspose.slides.ImageFormat.Png);
} catch (e) {console.log(e);
throw java.newInstanceSync("java.lang.RuntimeException", e);
}
animationPlayer.setTimePosition(animationPlayer.getDuration());// アニメーションの最後のフレーム
try {
// アニメーションの最後のフレーム
animationPlayer.getFrame().save("lastFrame.png", aspose.slides.ImageFormat.Png);
} catch (e) {console.log(e);
throw java.newInstanceSync("java.lang.RuntimeException", e);
}
});
} finally {
if (animationsGenerator != null) {
animationsGenerator.dispose();
}
}
} finally {
if (presentation != null) {
presentation.dispose();
}
}
すべてのアニメーションを同時に再生するには、PresentationPlayer クラスを使用します。このクラスは PresentationAnimationsGenerator インスタンスと FPS をコンストラクタで受け取り、すべてのアニメーションに対して FrameTick イベントを呼び出して再生させます:
var presentation = new aspose.slides.Presentation("animated.pptx");
try {
var animationsGenerator = new aspose.slides.PresentationAnimationsGenerator(presentation);
try {
var player = new aspose.slides.PresentationPlayer(animationsGenerator, 33);
try {
player.setFrameTick((sender, arguments) -> {
try {
arguments.getFrame().save(("frame_" + sender.getFrameIndex()) + ".png", aspose.slides.ImageFormat.Png);
} catch (e) {console.log(e);
throw java.newInstanceSync("java.lang.RuntimeException", e);
}
});
animationsGenerator.run(presentation.getSlides());
} finally {
if (player != null) {
player.dispose();
}
}
} finally {
if (animationsGenerator != null) {
animationsGenerator.dispose();
}
}
} finally {
if (presentation != null) {
presentation.dispose();
}
}
その後、生成されたフレームをまとめてビデオにコンパイルできます。詳細は Convert PowerPoint to Video セクションをご参照ください。
サポートされているアニメーションとエフェクト
開始:
| アニメーションタイプ | Aspose.Slides | PowerPoint |
|---|---|---|
| Appear | ![]() |
![]() |
| Fade | ![]() |
![]() |
| Fly In | ![]() |
![]() |
| Float In | ![]() |
![]() |
| Split | ![]() |
![]() |
| Wipe | ![]() |
![]() |
| Shape | ![]() |
![]() |
| Wheel | ![]() |
![]() |
| Random Bars | ![]() |
![]() |
| Grow & Turn | ![]() |
![]() |
| Zoom | ![]() |
![]() |
| Swivel | ![]() |
![]() |
| Bounce | ![]() |
![]() |
強調:
| アニメーションタイプ | Aspose.Slides | PowerPoint |
|---|---|---|
| Pulse | ![]() |
![]() |
| Color Pulse | ![]() |
![]() |
| Teeter | ![]() |
![]() |
| Spin | ![]() |
![]() |
| Grow/Shrink | ![]() |
![]() |
| Desaturate | ![]() |
![]() |
| Darken | ![]() |
![]() |
| Lighten | ![]() |
![]() |
| Transparency | ![]() |
![]() |
| Object Color | ![]() |
![]() |
| Complementary Color | ![]() |
![]() |
| Line Color | ![]() |
![]() |
| Fill Color | ![]() |
![]() |
終了:
| アニメーションタイプ | Aspose.Slides | PowerPoint |
|---|---|---|
| Disappear | ![]() |
![]() |
| Fade | ![]() |
![]() |
| Fly Out | ![]() |
![]() |
| Float Out | ![]() |
![]() |
| Split | ![]() |
![]() |
| Wipe | ![]() |
![]() |
| Shape | ![]() |
![]() |
| Random Bars | ![]() |
![]() |
| Shrink & Turn | ![]() |
![]() |
| Zoom | ![]() |
![]() |
| Swivel | ![]() |
![]() |
| Bounce | ![]() |
![]() |
モーション パス:
| アニメーションタイプ | Aspose.Slides | PowerPoint |
|---|---|---|
| Lines | ![]() |
![]() |
| Arcs | ![]() |
![]() |
| Turns | ![]() |
![]() |
| Shapes | ![]() |
![]() |
| Loops | ![]() |
![]() |
| Custom Path | ![]() |
![]() |
FAQ
パスワードで保護されたプレゼンテーションの変換は可能ですか?
はい、Aspose.Slides はパスワードで保護されたプレゼンテーションの操作をサポートしています。これらのファイルを処理する際は、正しいパスワードを提供してライブラリがプレゼンテーションの内容にアクセスできるようにしてください。
Aspose.Slides はクラウド ソリューションでの使用をサポートしていますか?
はい、Aspose.Slides はクラウド アプリケーションやサービスに統合できます。このライブラリはサーバー環境での動作を前提に設計されており、バッチ処理において高いパフォーマンスとスケーラビリティを提供します。
変換時にプレゼンテーションのサイズ制限はありますか?
Aspose.Slides は事実上あらゆるサイズのプレゼンテーションを処理できます。ただし、非常に大きなファイルを扱う場合は追加のシステムリソースが必要になることがあり、パフォーマンス向上のためにプレゼンテーションを最適化することが推奨されることがあります。

