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 24.4, 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 ffmpeg to create a video based on the frames.
Convert PowerPoint to Video
- Use the pip install command to add Aspose.Slides to your project:
- run
pip install Aspose.Slides==24.4.0
- run
- Download ffmpeg here or install via package manager.
- Make sure that ffmpeg is in the
PATH
, otherwise launch ffmpeg using full path to binary (e.g.C:\ffmpeg\ffmpeg.exe
on Windows or/opt/ffmpeg/ffmpeg
on Linux) - Run the PowerPoint to video code.
This Python code shows you how to convert a presentation (containing a figure and two animation effects) to a video:
import aspose.slides as slides
import subprocess
with slides.Presentation() as presentation:
smile = presentation.slides[0].shapes.add_auto_shape(slides.ShapeType.SMILEY_FACE, 110, 20, 500, 500)
effect_in = presentation.slides[0].timeline.main_sequence.add_effect(smile, slides.animation.EffectType.FLY, slides.animation.EffectSubtype.TOP_LEFT, slides.animation.EffectTriggerType.AFTER_PREVIOUS)
effect_out = presentation.slides[0].timeline.main_sequence.add_effect(smile, slides.animation.EffectType.FLY, slides.animation.EffectSubtype.BOTTOM_RIGHT, slides.animation.EffectTriggerType.AFTER_PREVIOUS)
effect_in.timing.duration = 2
effect_out.preset_class_type = slides.animation.EffectPresetClassType.EXIT
fps = 33
with slides.export.PresentationEnumerableFramesGenerator(presentation, fps) as frames_stream:
for frame_args in frames_stream.enumerate_frames(presentation.slides):
frame = "frame_{:04d}.png".format(frame_args.frames_generator.frame_index)
frame_args.get_frame().save(frame)
cmd_line = ["ffmpeg", "-r", str(fps), "-i", "frame_%04d.png", "-y", "-s", "720x540", "-pix_fmt", "yuv420p", "smile.webm"]
subprocess.call(cmd_line)
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:
import aspose.pydrawing as drawing
# Adds a smile shape and animates it
# ...
# Adds a new slide and animated transition
new_slide = presentation.slides.add_empty_slide(presentation.slides[0].layout_slide)
new_slide.background.type = slides.BackgroundType.OWN_BACKGROUND
new_slide.background.fill_format.fill_type = slides.FillType.SOLID
new_slide.background.fill_format.solid_fill_color.color = drawing.Color.indigo
new_slide.slide_show_transition.type = slides.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):
import aspose.slides as slides
import subprocess
with slides.Presentation() as presentation:
# Adds text and animations
auto_shape = presentation.slides[0].shapes.add_auto_shape(slides.ShapeType.RECTANGLE, 210, 120, 300, 300)
para1 = slides.Paragraph()
para1.portions.add(slides.Portion("Aspose Slides for .NET"))
para2 = slides.Paragraph()
para2.portions.add(slides.Portion("convert PowerPoint Presentation with text to video"))
para3 = slides.Paragraph()
para3.portions.add(slides.Portion("paragraph by paragraph"))
auto_shape.text_frame.paragraphs.add(para1)
auto_shape.text_frame.paragraphs.add(para2)
auto_shape.text_frame.paragraphs.add(para3)
auto_shape.text_frame.paragraphs.add(slides.Paragraph())
effect = presentation.slides[0].timeline.main_sequence.add_effect(para1, slides.animation.EffectType.APPEAR, slides.animation.EffectSubtype.NONE, slides.animation.EffectTriggerType.AFTER_PREVIOUS)
effect2 = presentation.slides[0].timeline.main_sequence.add_effect(para2, slides.animation.EffectType.APPEAR, slides.animation.EffectSubtype.NONE, slides.animation.EffectTriggerType.AFTER_PREVIOUS)
effect3 = presentation.slides[0].timeline.main_sequence.add_effect(para3, slides.animation.EffectType.APPEAR, slides.animation.EffectSubtype.NONE, slides.animation.EffectTriggerType.AFTER_PREVIOUS)
effect4 = presentation.slides[0].timeline.main_sequence.add_effect(para3, slides.animation.EffectType.APPEAR, slides.animation.EffectSubtype.NONE, slides.animation.EffectTriggerType.AFTER_PREVIOUS)
effect.timing.trigger_delay_time = 1
effect2.timing.trigger_delay_time = 1
effect3.timing.trigger_delay_time = 1
effect4.timing.trigger_delay_time = 1
# Converts frames to video
fps = 33
with slides.export.PresentationEnumerableFramesGenerator(presentation, fps) as frames_stream:
for frame_args in frames_stream.enumerate_frames(presentation.slides):
frame = "frame_{:04d}.png".format(frame_args.frames_generator.frame_index)
frame_args.get_frame().save(frame)
cmd_line = ["ffmpeg", "-r", str(fps), "-i", "frame_%04d.png", "-y", "-s", "720x540", "-pix_fmt", "yuv420p", "text_animation.webm"]
subprocess.call(cmd_line)
Video Conversion Classes
To allow you to perform PowerPoint to video conversion tasks, Aspose.Slides provides the PresentationEnumerableAnimationsGenerator.
PresentationEnumerableAnimationsGenerator allows you to set the frame size for the video (that will be created later) and FPS value (frames per second) through its constructor. If you pass an instance of the presentation, Presentation.SlideSize
will be used.
To make all animations in a presentation play at once, use PresentationEnumerableAnimationsGenerator.enumerate_frames method. This method takes a collection of slides and allows to sequentially obtain EnumerableFrameArgs. Then, EnumerableFrameArgs.get_frame() allows you to get video frame:
import aspose.slides as slides
with slides.Presentation("animated.pptx") as presentation:
fps = 33
with slides.export.PresentationEnumerableFramesGenerator(presentation, fps) as frames_stream:
for frame_args in frames_stream.enumerate_frames(presentation.slides):
frame_args.get_frame().save(f"frame_{frame_args.frames_generator.frame_index:04d}.png")
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 | ||
Fade | ||
Fly In | ||
Float In | ||
Split | ||
Wipe | ||
Shape | ||
Wheel | ||
Random Bars | ||
Grow & Turn | ||
Zoom | ||
Swivel | ||
Bounce |
Emphasis:
Animation Type | Aspose.Slides | PowerPoint |
---|---|---|
Pulse | ||
Color Pulse | ||
Teeter | ||
Spin | ||
Grow/Shrink | ||
Desaturate | ||
Darken | ||
Lighten | ||
Transparency | ||
Object Color | ||
Complementary Color | ||
Line Color | ||
Fill Color |
Exit:
Animation Type | Aspose.Slides | PowerPoint |
---|---|---|
Disappear | ||
Fade | ||
Fly Out | ||
Float Out | ||
Split | ||
Wipe | ||
Shape | ||
Random Bars | ||
Shrink & Turn | ||
Zoom | ||
Swivel | ||
Bounce |
Motion Paths:
Animation Type | Aspose.Slides | PowerPoint |
---|---|---|
Lines | ||
Arcs | ||
Turns | ||
Shapes | ||
Loops | ||
Custom Path |
Supported Slide Transition Effects
Subtle:
Animation Type | Aspose.Slides | PowerPoint |
---|---|---|
Morph | ||
Fade | ||
Push | ||
Pull | ||
Wipe | ||
Split | ||
Reveal | ||
Random Bars | ||
Shape | ||
Uncover | ||
Cover | ||
Flash | ||
Strips |
Exciting:
Animation Type | Aspose.Slides | PowerPoint |
---|---|---|
Fall Over | ||
Drape | ||
Curtains | ||
Wind | ||
Prestige | ||
Fracture | ||
Crush | ||
Peel Off | ||
Page Curl | ||
Airplane | ||
Origami | ||
Dissolve | ||
Checkerboard | ||
Blinds | ||
Clock | ||
Ripple | ||
Honeycomb | ||
Glitter | ||
Vortex | ||
Shred | ||
Switch | ||
Flip | ||
Gallery | ||
Cube | ||
Doors | ||
Box | ||
Comb | ||
Zoom | ||
Random |
Dynamic Content:
Animation Type | Aspose.Slides | PowerPoint |
---|---|---|
Pan | ||
Ferris Wheel | ||
Conveyor | ||
Rotate | ||
Orbit | ||
Fly Through |