
Hello hk chen ,
Welcome to Microsoft Q&A!
Thank you for your post. I understand that you are having issue when using Office (PowerPoint) APIs to convert a PPTX file to MP4. I truly understand how you feel. Let me assist you go through this situation.
As your description, when you use:
presentation.CreateVideo(…);
```
PowerPoint will only “play” the animations if you have actual slide‐show timings recorded (or narrations). Otherwise, it simply uses the default slide duration you passed in and “snaps” each slide to a static image at that point.
There is no magic flag in CreateVideo that says “just run all of my click animations in order and export them”—you must first give PowerPoint concrete timings for each animation. You can do that in two ways:
Record slide timings – Manually via Slide Show → Record Slide Show (or Record Narration & Timings) in the UI – Programmatically by running through the slideshow and letting PowerPoint record the timestamps
Programmatically set per‐slide durations based on the number (and/or length) of animations on each slide
Once you have timings in your presentation, use:
@"e:\test.mp4",
UseTimingsAndNarrations: true, // ← important!
DefaultSlideDuration: 5, // used only when a slide has *no* recorded timing
VertResolution: 1080,
FramesPerSecond: 30,
Quality: 85);
```
and your exported MP4 will include all of your animations.
Option 1: Record timings by running the slide show
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
using Office = Microsoft.Office.Core;
…
var app = new PowerPoint.Application();
app.Visible = Office.MsoTriState.msoTrue;
// Open with window so animations actually fire
var pres = app.Presentations.Open(
@"e:\test.pptx",
WithWindow: Office.MsoTriState.msoTrue);
// Tell PowerPoint to use slide timings when advancing
pres.SlideShowSettings.AdvanceMode = PowerPoint.PpSlideShowAdvanceMode.ppSlideShowUseSlideTimings;
pres.SlideShowSettings.Run();
That will force PowerPoint to walk through every click animation, record the timestamps, and then export them correctly.
Option 2: Set a time per slide based on its animations
If you know roughly how long each animation should take (or simply want “n seconds per animation plus a base duration”), you can set each slide’s transition time based on the count of its animation effects:
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
using Office = Microsoft.Office.Core;
…
var app = new PowerPoint.Application();
var pres = app.Presentations.Open(
@"e:\test.pptx",
WithWindow: Office.MsoTriState.msoFalse);
// For each slide, count the click‐on animations
foreach (PowerPoint.Slide slide in pres.Slides)
{
int animCount = slide.TimeLine.MainSequence.Count;
// Turn on “advance on time”
slide.SlideShowTransition.AdvanceOnTime = Office.MsoTriState.msoTrue;
// Set duration = 3 sec per animation + 3 sec base, for example
slide.SlideShowTransition.AdvanceTime = animCount * 3 + 3;
}
// Now export using those timings
pres.CreateVideo(
@"e:\test.mp4",
UseTimingsAndNarrations: true,
DefaultSlideDuration: 5,
VertResolution: 1080,
FramesPerSecond: 30,
Quality: 85);
while (pres.CreateVideoStatus
== PowerPoint.PpMediaTaskStatus.ppMediaTaskStatusInProgress)
System.Threading.Thread.Sleep(1000);
This approach is adapted from Onur Önder’s VBA/C# timing script, which shows how to set AdvanceTime
based on the animation count.
Here is why simply calling CreateVideo
with your original code didn’t work:
presentation.CreateVideo(
@"e:\test.mp4",
UseTimingsAndNarrations:true,
DefaultSlideDuration:5,
VertResolution:1080,
FramesPerSecond:30,
Quality:85);
– UseTimingsAndNarrations:true
only uses recorded timings/narrations – If no timings exist, PowerPoint falls back to DefaultSlideDuration
for every slide and never fires individual animations
By first creating real slide timings—either by recording the show or programmatically setting them—you give PowerPoint the data it needs to replay your click effects in the exported MP4.
I hope this will help with your situation. Please feel free to let me know if you have any further update.
Best Regards,
Katerina- MSFT | Microsoft Q&A Support Specialist
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment”.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.