-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvdo_sec.py
More file actions
36 lines (25 loc) · 1.23 KB
/
Copy pathvdo_sec.py
File metadata and controls
36 lines (25 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import moviepy.editor as mpe
bg_video_file = "video/news-tv-studio-set-42.mp4"
sec_bg_video_file = "video/wind-turbines-in-the-english.mp4"
output_file = "bg_sec.mp4"
bgwidth = 546 #673 #646
bgheight = 308 #348 #338
bgtop = 126 #280 #310
bgleft = 1142 #1050 #1058
''' ***** ***** ***** ***** ***** ***** *****
Video background with Secondary Video - Start
***** ***** ***** ***** ***** ***** ***** '''
def vdo_with_bgvdo(bg_video_file, sec_bg_video_file, output_file, bgwidth, bgheight, bgtop, bgleft):
bg_video = mpe.VideoFileClip(bg_video_file, audio=False)
w,h = moviesize = bg_video.size
sec_bg_video = (mpe.VideoFileClip(sec_bg_video_file, audio=False).
resize( (bgwidth, bgheight)).
margin(0, color=(255, 255, 255)).
margin(top = bgtop, left = bgleft, opacity = 0).
set_pos(('left', 'top')) )
final = mpe.CompositeVideoClip([bg_video, sec_bg_video])
final.write_videofile(output_file)
''' ***** ***** ***** ***** ***** ***** *****
Video background with Secondary Video - End
***** ***** ***** ***** ***** ***** ***** '''
vdo_with_bgvdo(bg_video_file, sec_bg_video_file, output_file, bgwidth, bgheight, bgtop, bgleft)