Convert PowerPoint to Video

By converting your PowerPoint presentation to video, you get

  • Increase in accessibility: All devices (regardless of platform) are equipped with video players by default compared to presentation-opening applications, so users find it easier to open or play videos.
  • More reach: Through videos, you can reach a large audience and target them with information that might otherwise seem tedious in a presentation. Most surveys and statistics suggest that people watch and consume videos more than other forms of content, and they generally prefer such content.

PowerPoint to Video Conversion in Aspose.Slides

In Aspose.Slides 22.11, we implemented support for presentation to video conversion.

  • Use Aspose.Slides to generate a set of frames (from the presentation slides) that correspond to a certain FPS (frames per second)
  • Use a third-party utility like FFMpegCore (ffmpeg) to create a video based on the frames.

Convert PowerPoint to Video

  1. Use the dotnet add package command to add Aspose.Slides and the FFMpegCore library to your project:
    • run dotnet add package Aspose.Slides.NET --version 22.11.0
    • run dotnet add package FFMpegCore --version 4.8.0
  2. Dowload ffmpeg here.
  3. FFMpegCore requires you to specify the path to the downloaded ffmpeg (e.g. extracted to “C:\tools\ffmpeg”): GlobalFFOptions.Configure(new FFOptions { BinaryFolder = @"c:\tools\ffmpeg\bin",} );
  4. Run the PowerPoint to video code.

This C# code shows you how to convert a presentation (containing a figure and two animation effects) to a video:

using System.Collections.Generic;
using Aspose.Slides;
using FFMpegCore; // Will use FFmpeg binaries we extracted to "c:\tools\ffmpeg" before
using Aspose.Slides.Animation;
using (Presentation presentation = new Presentation())

{
    // Adds a smile shape and then animates it
    IAutoShape smile = presentation.Slides[0].Shapes.AddAutoShape(ShapeType.SmileyFace, 110, 20, 500, 500);
    IEffect effectIn = presentation.Slides[0].Timeline.MainSequence.AddEffect(smile, EffectType.Fly, EffectSubtype.TopLeft, EffectTriggerType.AfterPrevious);
    IEffect effectOut = presentation.Slides[0].Timeline.MainSequence.AddEffect(smile, EffectType.Fly, EffectSubtype.BottomRight, EffectTriggerType.AfterPrevious);
    effectIn.Timing.Duration = 2f;
    effectOut.PresetClassType = EffectPresetClassType.Exit;

   const int Fps = 33;
   List<string> frames = new List<string>();

   using (var animationsGenerator = new PresentationAnimationsGenerator(presentation))
    using (var player = new PresentationPlayer(animationsGenerator, Fps))
    {
        player.FrameTick += (sender, args) =>
        {
            string frame = $"frame_{(sender.FrameIndex):D4}.png";
            args.GetFrame().Save(frame);
            frames.Add(frame);
        };
        animationsGenerator.Run(presentation.Slides);
    }

    // Configure ffmpeg binaries folder. See this page: https://github.com/rosenbjerg/FFMpegCore#installation
    GlobalFFOptions.Configure(new FFOptions { BinaryFolder = @"c:\tools\ffmpeg\bin", });
    // Converts frames to webm video
    FFMpeg.JoinImageSequence("smile.webm", Fps, frames.Select(frame => ImageInfo.FromPath(frame)).ToArray());

}

Video Effects

You can apply animations to objects on slides and use transitions between slides.

Animations and transitions make slideshows more engaging and interesting—and they do the same thing for videos. Let’s add another slide and transition to the code for the previous presentation:

// Adds a smile shape and animates it

// ...

// Adds a new slide and animated transition

ISlide newSlide = presentation.Slides.AddEmptySlide(presentation.Slides[0].LayoutSlide);

newSlide.Background.Type = BackgroundType.OwnBackground;

newSlide.Background.FillFormat.FillType = FillType.Solid;

newSlide.Background.FillFormat.SolidFillColor.Color = Color.Indigo;

newSlide.SlideShowTransition.Type = TransitionType.Push;

Aspose.Slides also supports animation for texts. So we animate paragraphs on objects, which will appear one after the other (with the delay set to a second):

using System.Collections.Generic;
using Aspose.Slides.Export;
using Aspose.Slides;
using FFMpegCore;
using Aspose.Slides.Animation;

using (Presentation presentation = new Presentation())
{
    // Adds text and animations
    IAutoShape autoShape = presentation.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 210, 120, 300, 300);
    Paragraph para1 = new Paragraph();
    para1.Portions.Add(new Portion("Aspose Slides for .NET"));
    Paragraph para2 = new Paragraph();
    para2.Portions.Add(new Portion("convert PowerPoint Presentation with text to video"));

    Paragraph para3 = new Paragraph();
    para3.Portions.Add(new Portion("paragraph by paragraph"));
    autoShape.TextFrame.Paragraphs.Add(para1);
    autoShape.TextFrame.Paragraphs.Add(para2);
    autoShape.TextFrame.Paragraphs.Add(para3);
    autoShape.TextFrame.Paragraphs.Add(new Paragraph());

    IEffect effect = presentation.Slides[0].Timeline.MainSequence.AddEffect(para1, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);

    IEffect effect2 = presentation.Slides[0].Timeline.MainSequence.AddEffect(para2, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);

    IEffect effect3 = presentation.Slides[0].Timeline.MainSequence.AddEffect(para3, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);

    IEffect effect4 = presentation.Slides[0].Timeline.MainSequence.AddEffect(para3, EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);

    effect.Timing.TriggerDelayTime = 1f;
    effect2.Timing.TriggerDelayTime = 1f;
    effect3.Timing.TriggerDelayTime = 1f;
    effect4.Timing.TriggerDelayTime = 1f;

    // Converts frames to video
    const int Fps = 33;
    List<string> frames = new List<string>();
    
    using (var animationsGenerator = new PresentationAnimationsGenerator(presentation))

    using (var player = new PresentationPlayer(animationsGenerator, Fps))

    {
        player.FrameTick += (sender, args) =>
        {
            string frame = $"frame_{(sender.FrameIndex):D4}.png";
            args.GetFrame().Save(frame);
            frames.Add(frame);
        };
        animationsGenerator.Run(presentation.Slides);
    }
    // Configure ffmpeg binaries folder. See this page: https://github.com/rosenbjerg/FFMpegCore#installation

    GlobalFFOptions.Configure(new FFOptions { BinaryFolder = @"c:\tools\ffmpeg\bin", });
    // Converts frames to webm video
    FFMpeg.JoinImageSequence("text_animation.webm", Fps, frames.Select(frame => ImageInfo.FromPath(frame)).ToArray());

}

Video Conversion Classes

To allow you to perform PowerPoint to video conversion tasks, Aspose.Slides provides the PresentationAnimationsGenerator and PresentationPlayer classes.

PresentationAnimationsGenerator allows you to set the frame size for the video (that will be created later) through its constructor. If you pass an instance of the presentation, Presentation.SlideSize will be used and it generates animations that PresentationPlayer uses.

When animations are generated, a NewAnimation event is generated for each subsequent animation, which has the IPresentationAnimationPlayer parameter. The latter is a class that represents a player for a separate animation.

To work with IPresentationAnimationPlayer, the Duration (the full duration of the animation) property and SetTimePosition method are used. Each animation position is set within the 0 to duration range, and then the GetFrame method will return a Bitmap that corresponds to the animation state at that moment.

using (Presentation presentation = new Presentation())
{
    // Adds a smile shape and animates it
    IAutoShape smile = presentation.Slides[0].Shapes.AddAutoShape(ShapeType.SmileyFace, 110, 20, 500, 500);
    IEffect effectIn = presentation.Slides[0].Timeline.MainSequence.AddEffect(smile, EffectType.Fly, EffectSubtype.TopLeft, EffectTriggerType.AfterPrevious);
    IEffect effectOut = presentation.Slides[0].Timeline.MainSequence.AddEffect(smile, EffectType.Fly, EffectSubtype.BottomRight, EffectTriggerType.AfterPrevious);
    effectIn.Timing.Duration = 2f;
    effectOut.PresetClassType = EffectPresetClassType.Exit;

    using (var animationsGenerator = new PresentationAnimationsGenerator(presentation))
    {
        animationsGenerator.NewAnimation += animationPlayer =>
        {
            Console.WriteLine($"Total animation duration: {animationPlayer.Duration}");
            
            animationPlayer.SetTimePosition(0); // initial animation state
            Bitmap bitmap = animationPlayer.GetFrame(); // initial animation state bitmap

            animationPlayer.SetTimePosition(animationPlayer.Duration); // final state of the animation
            Bitmap lastBitmap = animationPlayer.GetFrame(); // last frame of the animation
            lastBitmap.Save("last.png");
        };
    }
}

To make all animations in a presentation play at once, the PresentationPlayer class is used. This class takes a PresentationAnimationsGenerator instance and FPS for effects in its constructor and then calls the FrameTick event for all the animations to get them played:

using (Presentation presentation = new Presentation("animated.pptx"))
{
    using (var animationsGenerator = new PresentationAnimationsGenerator(presentation))
    using (var player = new PresentationPlayer(animationsGenerator, 33))
    {
        player.FrameTick += (sender, args) =>
        {
            args.GetFrame().Save($"frame_{sender.FrameIndex}.png");
        };
        animationsGenerator.Run(presentation.Slides);
    }
}

Then the generated frames can be compiled to produce a video. See the Convert PowerPoint to Video section.

Supported Animations and Effects

Entrance:

Animation Type Aspose.Slides PowerPoint
Appear not supported supported
Fade supported supported
Fly In supported supported
Float In supported supported
Split supported supported
Wipe supported supported
Shape supported supported
Wheel supported supported
Random Bars supported supported
Grow & Turn not supported supported
Zoom supported supported
Swivel supported supported
Bounce supported supported

Emphasis:

Animation Type Aspose.Slides PowerPoint
Pulse not supported supported
Color Pulse not supported supported
Teeter supported supported
Spin supported supported
Grow/Shrink not supported supported
Desaturate not supported supported
Darken not supported supported
Lighten not supported supported
Transparency not supported supported
Object Color not supported supported
Complementary Color not supported supported
Line Color not supported supported
Fill Color not supported supported

Exit:

Animation Type Aspose.Slides PowerPoint
Disappear not supported supported
Fade supported supported
Fly Out supported supported
Float Out supported supported
Split supported supported
Wipe supported supported
Shape supported supported
Random Bars supported supported
Shrink & Turn not supported supported
Zoom supported supported
Swivel supported supported
Bounce supported supported

Motion Paths:

Animation Type Aspose.Slides PowerPoint
Lines supported supported
Arcs supported supported
Turns supported supported
Shapes supported supported
Loops supported supported
Custom Path supported supported

Supported Slide Transition Effects

Subtle:

Animation Type Aspose.Slides PowerPoint
Morph not supported supported
Fade supported supported
Push supported supported
Pull supported supported
Wipe supported supported
Split supported supported
Reveal not supported supported
Random Bars supported supported
Shape not supported supported
Uncover not supported supported
Cover supported supported
Flash supported supported
Strips supported supported

Exciting:

Animation Type Aspose.Slides PowerPoint
Fall Over not supported supported
Drape not supported supported
Curtains not supported supported
Wind not supported supported
Prestige not supported supported
Fracture not supported supported
Crush not supported supported
Peel Off not supported supported
Page Curl not supported supported
Airplane not supported supported
Origami not supported supported
Dissolve supported supported
Checkerboard not supported supported
Blinds not supported supported
Clock supported supported
Ripple not supported supported
Honeycomb not supported supported
Glitter not supported supported
Vortex not supported supported
Shred not supported supported
Switch not supported supported
Flip not supported supported
Gallery not supported supported
Cube not supported supported
Doors not supported supported
Box not supported supported
Comb not supported supported
Zoom supported supported
Random not supported supported

Dynamic Content:

Animation Type Aspose.Slides PowerPoint
Pan not supported supported
Ferris Wheel supported supported
Conveyor not supported supported
Rotate not supported supported
Orbit not supported supported
Fly Through supported supported