Extract Media from PowerPoint using C#

This quick article describes how to extract media from PowerPoint using C#. It has all the details to set up the IDE, a list of steps, and a sample code demonstrating how to extract a video from PowerPoint using C#. This code is not limited to fetching video only, as it can also extract audio. You will learn techniques to fetch all types of video and audio file formats supported by PowerPoint.

Steps to Extract Video from PowerPoint using C#

  1. Set the environment to use Aspose.Slides for .NET to extract media from a presentation
  2. Set the license optionally, define the input PPTX file name and output folder for saving all the extracted media files
  3. Load the source PPTX file into the Presentation class object for reading the contents
  4. Iterate through all the slides in the presentation and parse all the shapes in each slide
  5. If an embedded video is found in the shape, determine its format using the custom function, and save it in the output folder
  6. If the shape contains an embedded audio clip, determine its format with the help of the custom function, and save it in the output folder
  7. Define the custom function for determining the media file format

These steps describe how to get video from PowerPoint using C#. Load the source PPTX file, loop through all the slides, get a collection of shapes in each slide and check the presence of embedded audio and video clips in it. If a media file is found, determine its type and save it in the output folder.

Code to Extract Audio from PPTX using C#

This code demonstrates how to extract a video from a PowerPoint using C#. The sample code includes separate sections for fetching embedded video and audio clips that you can use as needed. The ContentType property is exposed by the Aspose.Slides media object contains the exact file extension which was used to save the clip in the slide.

This article explains the process to extract audio and video from the PowerPoint presentation. To extract text from PowerPoint, refer to the article Extract Text from PowerPoint using C#.