PPTX‑to‑Video Conversion in C# with Interactive Navigation Capabilities

Hi,

We’re looking to convert PowerPoint presentations to video with interactive navigation capabilities. Our requirements are:

  1. Convert PPTX files to video format

  2. Enable users to navigate through slides with “Next” and “Previous” controls

  3. Handle click animations appropriately:

  • Video pauses before each click animation

  • Click Animation plays only when user clicks “Next”

  • Video stops after click animation completes or at the next click animation point

  1. “Previous” navigation returns to the beginning of the prior slide. (A state when its transition has completed, we do not want to play the transition in this case).

We’ve successfully used Aspose to create videos from PPTX files. However, we also need precise timestamp information for slide transitions and click animations within the video.

Is it possible for Aspose to provide this timing metadata along with the video conversion?

Thanks,
@bhav

@bhav

To achieve your goal of converting a PPTX to a video while retaining control over navigation and click animations, you can utilize Aspose.Slides to generate frames from the presentation slides. This allows you to create a video that can be played in an HTML iframe, where users can navigate through slides and trigger animations with clicks.

Steps to Implement Your Use Case

  1. Convert PPTX to Video: Use Aspose.Slides to convert your PowerPoint presentation into a series of frames. You can specify the frame rate (FPS) for the video.

  2. Capture Animation Timing: While generating the frames, you can also capture the timing information for slide transitions and click animations. This will allow you to know when to pause the video for user interactions.

  3. Control Video Playback: Implement a video player in your HTML iframe that can handle user inputs for ‘Next’ and ‘Prev’ navigation. You will need to manage the playback state based on the captured timing information.

Example Code

Here’s a simplified example in C# that demonstrates how to convert a PPTX to video frames and capture animation timings:

using System.Collections.Generic;
using Aspose.Slides;
using Aspose.Slides.Animation;
using FFMpegCore;

public class ConvertPPTXToVideo
{
    public static void Run()
    {
        using (Presentation presentation = new Presentation("YourPresentation.pptx"))
        {
            const int FPS = 30;
            List<string> frames = new List<string>();

            using (var animationsGenerator = new PresentationAnimationsGenerator(presentation))
            using (var player = new PresentationPlayer(animationsGenerator, FPS))
            {
                player.FrameTick += (sender, args) =>
                {
                    string frameFileName = $"frame_{sender.FrameIndex:D4}.png";
                    args.GetFrame().Save(frameFileName);
                    frames.Add(frameFileName);
                };

                animationsGenerator.Run(presentation.Slides);
            }

            // Use FFMpeg to compile frames into a video
            FFMpeg.JoinImageSequence("output_video.webm", FPS, frames.Select(frame => ImageInfo.FromPath(frame)).ToArray());
        }
    }
}

Managing User Interactions

To manage user interactions such as ‘Next’ and ‘Prev’, you will need to implement a JavaScript function that listens for button clicks and controls the video playback based on the timing information you captured during the frame generation. This will involve pausing the video at specific timestamps and resuming it when the user clicks to trigger animations.

Conclusion

While Aspose.Slides does not currently provide a built-in feature to directly output timing information for animations and transitions, you can implement a solution by generating frames and managing playback through your application logic. This approach allows you to create an interactive video experience from your PowerPoint presentations.

For more details on converting PowerPoint presentations to video, you can refer to the official documentation here.

If you have further questions or need assistance with specific implementation details, feel free to ask!

@bhav,
Please note that the PresentationAnimationsGenerator class provides the NewAnimation event, and the PresentationPlayer class provides the FrameTick event. I hope these events will help you to achieve your goal. Please let us know if you have any additional questions.

Hi Andrey,

Thank you for your suggestions. I have tried them already. The NewAnimation event gets fired for animations and transitions, but if a slide has multiple consecutive click animations, all of them happen all at once and only one event is fired. Therefore, I am not able to get individual click animation’s timestamp and frames.

@bhav

@bhav,
Thank you for the additional information.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESNET-44948

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hi Andrey,

Thank you for opening the ticket. I shall open a paid ticket for it.

@bhav

@bhav,
Thank you for using Aspose.Slides.