This quick guide explains how to extract media from PowerPoint using Java. You will learn to set the IDE, get a list of steps, and a sample code showing how to extract a video from PowerPoint using Java. The sample code contains two separate sections to extract video and audio from each slide.
Steps to Extract Audio from PPTX using Java
- Set the IDE to use Aspose.Slides for Java to extract media from a presentation
- Apply the license and perform the initial configuration by declaring different variables
- Load the source PPTX into the Presentation class object
- Iterate through all the slides in the presentation and parse each shape in the respective slide
- If the current shape is an IVideoFrame with embedded video, fetch its stream and save it on the disk
- If the shape is an IAudioFrame with an embedded audio clip, fetch its stream data and save it on the disk
These steps show how to extract a video from PowerPoint using Java; however, the sample code also demonstrates the extraction of audio clips. To commence the process, load the source presentation, iterate through each slide in it and access its collection of shapes. Check the content type of each shape against the IVideoFrame for embedded video clip or against the IAudioFrame for audio clips. If video or audio type content is confirmed, fetch its stream and save the media with the appropriate extension determined using a custom function.
Code to Extract Video from PowerPoint using Java
This code shows how to get video from PowerPoint using Java. You can also extract other contents, such as text, speaker notes, extract text from grouped tapes, and export text to TXT or JSON format if required. If the content type is not found, i.e., not in the given list of content types, the default types MP4 or MP3 are used.
This article shows how to extract videos and audio from a presentation. To extract text from a presentation, refer to the article Extract text from PowerPoint using Java.