How to Add Video in Presentation using Python

In this simple article, we will focus on how to add video in Presentation using Python by configuring the environment using the well defined steps and executing the example code. This application can be used in any of Python and .NET Core configured environment in operating systems like Windows, macOS or Linux to embed video in PPTX using Python.

Steps to Insert Video in Presentation using Python

  1. Configure the environment to use Aspose.Slides for Python via .NET in your application to add a video frame
  2. Instantiate the Presentation class object to create an empty presentation to embed a video inside the presentation
  3. Load the first slide from the presentation slides collection to insert a video frame
  4. Load the video file from the disk and create an Video frame on the slide holding that video
  5. Set the volume control and auto play properties for the added video frame
  6. Save the PPTX presentation having an embedded video on the disk

By adhering to aforementioned steps in Python inserting video in PowerPoint presentation is easily possible, whereby first of all we will create an empty presentation using the Presentation class object and gain access to first slide inside the slides collection. Then we will add a video frame in the selected slide by loading the source video from the disk along with setting the options for volume control and auto playback. Finally, we will save the PPTX presentation with an embedded video file on the disk.

Code to Insert Video in Presentation using Python

By using a very simple code in Python saving MP4 video in PPT presentation is easily achieved in the above example using a very simple API interface. The IVideoFrame class is used to insert the video, which also contains the setters for the properties like rewind mode, play video in a loop, play mode and hiding a video to name a few. You can also add the link to a video file by setting the complete path of the video file and avoid embedding that inside the presentation. This will reduce the presentation size but will have a video frame linked a to video file on the disk.

In this example, we have learnt about how to insert video in Presentation using Python. If you are interested in learning about hiding a slide inside the presentation, refer to the article on how to hide a slide in presentation using Python.

 English