Supported Video Formats

Can you provide a list of video formats supported for insertion to a presentation by Aspose Slides Java? So far I’ve tried AVI, MPG, and WMV. The WMV did not work so we’d like a listing of what does work in order to decide what type of video compression to employ. AVI and MPG file sizes will be too big. Is it possible WMV did not work because we’re using Java and not .NET. Error from PPT when opening WMV file was:

A problem occurred in initializing MCI.

Thanks!

Dear cleesmith,

Aspose.Slides just add the video frame and video file name. According to my observation, it does not embed the video inside it. It just embeds the file name.

So, when you play it, it starts playing whatever file is present there with that filepath or filename.

You are getting error, then, it means, there is some problem with PowerPoint playing WMV files.

For example, I have written this program in .NET, which adds a video frame with the file sample.wmv, it runs fine on my PowerPoint.

If I replace it with sample.wmv with some other file wmv file, PowerPoint will start playing that file.

I have attached the presentation generated by the following C# code and also sample.ppt; it plays fine here. See do you get same MCI error there?

Presentation srcPres = new Presentation();

Slide srcSld = srcPres.GetSlideByPosition(1);
srcSld.Shapes.AddVideoFrame(500, 500, 3000, 3000, "sample.wmv");

srcPres.Write("c:\\outWMV.ppt");

Dear msfaiz:

I used your example to add a WMV to a slide and it worked great. Couple of follow-up questions:

(1) How do I make the video begin immediately when the slide is opened?

(2) What options are available in the AdvanceMode and how do I use it? e.g. srcSld.Shapes[0].AnimationSettings.AdvanceMode

Thanks.

I stumbled onto a solution to my own post; after the call to AddVideoFrame in msfaiz's 9-21-2007 post, I added the following...

srcSld.Shapes[0].AnimationSettings.EntryEffect = ShapeEntryEffect.Cut;
srcSld.Shapes[0].AnimationSettings.AdvanceMode = Aspose.Slides.ShapeAdvanceMode.AdvanceOnTime;
srcSld.Shapes[0].AnimationSettings.AdvanceTime = 0.0d;

Dear Steve,

Thank you for your code.

For the benefits of others, here is a complete code that adds a video frame which plays video automatically.

void AddingVideoFrame()
{
    Presentation srcPres = new Presentation();
    Slide srcSld = srcPres.GetSlideByPosition(1);

    Shape shp = srcSld.Shapes.AddVideoFrame(500, 500, 3000, 3000, "sample.wmv");
    shp.AnimationSettings.EntryEffect = ShapeEntryEffect.Cut;
    shp.AnimationSettings.AdvanceMode = Aspose.Slides.ShapeAdvanceMode.AdvanceOnTime;
    shp.AnimationSettings.AdvanceTime = 0.0d;

    srcPres.Write("c:\\outSample.ppt");
}

When playing the PPT, the animation begins immediately if the video format is WMV or AVI but requires me to click on it to start an SWF (flash) file. Any idea why that is the case?

Thank you.

How did you insert swf file? Did you use AddOLEObjectFrame? Or did you use AddVideoFrame? I used AddVideoFrame and it do not play it even after clicking.

Please show me your code.

Also, MS-PowerPoint 2002 do not let me insert SWF movie from menu Insert -- > Movies and Sound -- > Movie From File... and says it is either non-standard or Quick Time is not installed

When I play an SWF file in the PPT it creates, I must click on the video's play button to initiate the video. For AVI and WMV I do not have to do that. Here's my code:

Presentation srcPres = new Presentation();

Slide srcSld = srcPres.GetSlideByPosition(1);

srcSld.Shapes.AddVideoFrame(500, 500, 3000, 3000, TextBox1.Text);

srcSld.Shapes[0].AnimationSettings.EntryEffect = ShapeEntryEffect.Cut;

srcSld.Shapes[0].AnimationSettings.AdvanceMode = Aspose.Slides.ShapeAdvanceMode.AdvanceOnTime;

srcSld.Shapes[0].AnimationSettings.AdvanceTime = 0.0d;

srcPres.Write("c:\\sampleout.ppt");

Can you please explain, how were you able to play SWF file even after clicking, because I am not able to play it on MS-PowerPoint 2002.

Do I need to install something to be able to play it?

I want to play the attached SWF file, does it play on your computer in PowerPoint?

I use PPT2003, not 2002. I also have v10.00.00.4058 of Windows Media Player installed. I also have Flash Player installed.

The video frame displays the "play" button for SWF files and I must click on it to initiate the video. However, AVI and WMV files automatically start when the slide is loaded.

Flash player is also installed on my PC and I don’t think, it is because of Windows Media Player nor I think, it is because of PowerPoint 2002.

Any way, I will report it as a bug for a fix.

Meanwhile, please try your code modifying this way. Perhaps it would work, but I am unsure.

Shape shp = srcSld.Shapes.AddVideoFrame(500, 500, 3000, 3000, TextBox1.Text);
shp.AnimationSettings.EntryEffect = ShapeEntryEffect.Cut;
shp.AnimationSettings.AdvanceMode = Aspose.Slides.ShapeAdvanceMode.AdvanceOnTime;
shp.AnimationSettings.AdvanceTime = 0.0d;