VBA Export embedded video from Powerpoint presenta

2019-09-08 06:28发布

问题:

I'm trying to convert an entire presentation to HTML, extracting all the embedded content etc along the way. I've got text, audio, narrations etc all working fine but am having trouble finding out how to export video content.

Im looping through all slides in the presentation, then all shapes on the slide, looking for shapes of type msoMedia. If I find one, then I check it's MediaType. If it's ppMediaTypeMovie, then I can find the source file of an externally linked video file using Shape.LinkFormat.SourceFullName, but I can't for the life of me find out how to access EMBEDDED content.

If I find a shape with a MediaType of ppMediaTypeSound then I can use Shape.SoundFormat.Export to export the audio. Does anybody know of an equivalent for VIDEO shapes? (There's no Shape.VideoFormat) I've spent days looking through every possible data member I can but to no avail.

回答1:

It appears Microsoft extract the contents of the media file to a temporary folder anyway, and embedded videos still provide a LinkFormat.SourceFullName to the extracted video:

?oshape.LinkFormat.SourceFullName

C:\Users\Alex\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.MSO\F26FF1D0.m4v

All that I need to do is fire this file through ffmpeg and I've got my video, in the format I want!

Thanks for your help :)



回答2:

Note: You may find that the .Export method doesn't work for embedded sounds either in recent PPT versions.

Alex's suggestion is what I'd look into first; otherwise you can unzip the PPTX/PPSX/etc and find the videos in the media folder. Or you might try saving as an XML presentation; you might be able to parse the video out of that.