Creating Presentation Animation as Video and Extract Embedded Video/Audio

Hi,

I have a requirement where I can upload a PPT/PPTX presentation file and extract each slide of presentation as Image, Video or Audio.
I am successfully able to create the images of each slide using Aspose.Slides.
What I need next is as below:
I am iterating through slides and for each slides I want to perform following steps:
- If Slide has animation, then I want to generate a Video of that slide.
- If Slide has embedded video in it, then I want to find the location of video file or save it as video
- If slide has embedded audio, then i want to find the location of audio file.
- If slide has no animation, no video and no audio part, then just export slide as an Image.

Please help me with what is possible through Aspose.Slides so that I can proceed and use library.

Hi Sudhir,

Thanks for your interest in Aspose.Slides.

I have observed the requirements shared by you and like to share that Aspose.Slides fulfill all the requirements shared by you except support of creating video for animated slide. Please try using the following sample code on your end to extract the audio and video data from presentation slides.

public static void ExtractVideo()
{
String path = @"D:\Aspose Data";

Presentation template = new Presentation(path + “VideoSample.pptx”);

foreach (ISlide slide in template.Slides)
{
foreach (IShape shape in template.Slides[0].Shapes)
{
if (shape is VideoFrame)
{
IVideoFrame vf = shape as IVideoFrame;
String type = vf.EmbeddedVideo.ContentType;
int ss = type.LastIndexOf(‘-’);
type = type.Remove(0, type.LastIndexOf(‘-’) + 1);
Byte[] buffer = vf.EmbeddedVideo.BinaryData;
using (FileStream stream = new FileStream(path + “NewVideo.” + type, FileMode.Create, FileAccess.Write, FileShare.Read))
{ stream.Write(buffer, 0, buffer.Length); }

}
}
}

}

public static void ExtractAudio()
{
String path = @"D:\Aspose Data";

Presentation template = new Presentation(path + “AudioSample.pptx”);

foreach (ISlide slide in template.Slides)
{
foreach (IShape shape in template.Slides[0].Shapes)
{
if (shape is VideoFrame)
{
IAudioFrame af = shape as IAudioFrame;
String type = af.EmbeddedAudio.ContentType;
int ss = type.LastIndexOf(‘-’);
type = type.Remove(0, type.LastIndexOf(‘-’) + 1);
Byte[] buffer = af.EmbeddedAudio.BinaryData;
using (FileStream stream = new FileStream(path + “NewAudio.” + type, FileMode.Create, FileAccess.Write, FileShare.Read))
{ stream.Write(buffer, 0, buffer.Length); }

}
}
}

}


You can also generate the slide thumbnail by using the sample code given over this documentation link. I regret to share that the support for generating the video for animated slide is unavailable in Aspose.Slides. An issue with ID SLIDESNET-36753 has been created in our issue tracking system to further investigate the possibility of implementing the requested support. This thread has been linked with the issue so that you may be automatically notified once the support will be available.

Many Thanks,

Thank you very much for the sample code.

It will surely help me with the implementation.

The issues you have found earlier (filed as SLIDESNET-36753) have been fixed in Aspose.Slides for .NET 22.11 (ZIP, MSI).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.