3
3
import sys
4
4
5
5
# PpSaveAsFileType enumeration (PowerPoint)
6
- ppSaveAsMP4 = 39
6
+ ppSaveAsMP4 = 39
7
+
7
8
8
9
def ppt2video (pptx , video , timing , duration , resolution , frames , quality ):
9
10
@@ -26,27 +27,32 @@ def ppt2video(pptx, video, timing, duration, resolution, frames, quality):
26
27
27
28
# Presentation.CreateVideo method (PowerPoint)
28
29
# https://docs.microsoft.com/en-us/office/vba/api/powerpoint.presentation.createvideo
29
- presentation .CreateVideo (video_path , timing , duration , resolution , frames , quality )
30
+ presentation .CreateVideo (video_path , timing , duration ,
31
+ resolution , frames , quality )
30
32
while True :
31
33
try :
32
34
# Update the video file, if already exists.
33
35
os .rename (video_path , video_path )
34
- print (f'The video from PowerPoint Presentation { pptx } has been created.' )
36
+ print (f'The video from PowerPoint Presentation \
37
+ { pptx } has been created.' )
35
38
break
36
39
except Exception :
37
40
pass
38
41
presentation .Close ()
39
42
ppt .Quit ()
40
43
pass
41
44
45
+
42
46
if __name__ == '__main__' :
43
- file_name = "test.pptx" # PPT file expected to be in the root folder
44
- video_name = "test_video" # Video will be created in the root folder
45
- UseTimingsAndNarrations = False # Boolean value
46
- DefaultSlideDuration = 2 # Int
47
- VertResolution = 480 # Int
48
- FramesPerSecond = 24 # Int
49
- Quality = 60
47
+ file_name = "" # e.g.:test.pptx, file expected to be in the root folder
48
+ video_name = "" # e.g.: test_video, will be created in the root folder
49
+ UseTimingsAndNarrations = False # Boolean value
50
+ DefaultSlideDuration = 2 # Int
51
+ VertResolution = 480 # Int
52
+ FramesPerSecond = 24 # Int
53
+ Quality = 60 # Int
50
54
51
55
ppt2video (f"./{ file_name } " , f"./{ video_name } .mp4" ,
52
- UseTimingsAndNarrations , DefaultSlideDuration , VertResolution , FramesPerSecond , Quality )
56
+ UseTimingsAndNarrations ,
57
+ DefaultSlideDuration , VertResolution ,
58
+ FramesPerSecond , Quality )
0 commit comments