|
@@ -90,6 +90,7 @@ def download_mp4(url,name):
|
|
|
return True
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -125,7 +126,7 @@ def text_to_short_vedio_create(title_ad="input/people/peggy1_1_long.mp4",op="inp
|
|
|
pwd_=str(csv_use.loc[i,['音檔']].values[0])
|
|
|
|
|
|
|
|
|
- locals()['anchor_music'+str(i)] = openshot.FFmpegReader("導盲犬協會影片素材/"+pwd_)
|
|
|
+ locals()['anchor_music'+str(i)] = openshot.FFmpegReader("導盲犬協會影片素材2/"+pwd_)
|
|
|
locals()['anchor_music'+str(i)].Open()
|
|
|
locals()['anchor_music'+str(i)+'clip'] = video_photo_clip(video=locals()['anchor_music'+str(i)],layer=3,scale_x=0,scale_y=0,
|
|
|
location_x=0,location_y=0,position=time_, end=locals()['anchor_music'+str(i)].info.duration,ck=ck_anchor,audio=True)
|
|
@@ -140,7 +141,7 @@ def text_to_short_vedio_create(title_ad="input/people/peggy1_1_long.mp4",op="inp
|
|
|
pwd_=str(csv_use.loc[i,['音檔']].values[0])
|
|
|
|
|
|
|
|
|
- locals()['anchor_music_t'+str(i)] = openshot.FFmpegReader("導盲犬協會影片素材/"+pwd_)
|
|
|
+ locals()['anchor_music_t'+str(i)] = openshot.FFmpegReader("導盲犬協會影片素材2/"+pwd_)
|
|
|
locals()['anchor_music_t'+str(i)].Open()
|
|
|
locals()['anchor_music_t'+str(i)+'clip'] = video_photo_clip(video=locals()['anchor_music_t'+str(i)],layer=3,scale_x=0,scale_y=0,
|
|
|
location_x=0,location_y=0,position=0, end=locals()['anchor_music_t'+str(i)].info.duration,ck=ck_anchor,audio=True)
|
|
@@ -178,7 +179,7 @@ def text_to_short_vedio_create(title_ad="input/people/peggy1_1_long.mp4",op="inp
|
|
|
|
|
|
|
|
|
if choose == 'mp4':
|
|
|
- locals()['anchor'+str(i)] = openshot.FFmpegReader("導盲犬協會影片素材/"+pwd_p1)
|
|
|
+ locals()['anchor'+str(i)] = openshot.FFmpegReader("導盲犬協會影片素材2/"+pwd_p1)
|
|
|
locals()['anchor'+str(i)].Open()
|
|
|
locals()['anchor'+str(i)+'clip'] = video_photo_clip(video=locals()['anchor'+str(i)],layer=4,scale_x=scale_x_use,scale_y=scale_y_use,
|
|
|
location_x=-0.04,location_y=-0.04,position=time_, end=locals()['anchor_music'+str(i)].info.duration,ck=ck_anchor,audio=False)
|
|
@@ -203,7 +204,7 @@ def text_to_short_vedio_create(title_ad="input/people/peggy1_1_long.mp4",op="inp
|
|
|
|
|
|
|
|
|
elif choose == 'jpg':
|
|
|
- locals()['anchor'+str(i)] = openshot.QtImageReader("導盲犬協會影片素材/"+pwd_p1)
|
|
|
+ locals()['anchor'+str(i)] = openshot.QtImageReader("導盲犬協會影片素材2/"+pwd_p1)
|
|
|
locals()['anchor'+str(i)].Open()
|
|
|
locals()['anchor'+str(i)+'clip'] = video_photo_clip(video=locals()['anchor'+str(i)],layer=4,scale_x=scale_x_use,scale_y=scale_y_use,
|
|
|
location_x=-0.04,location_y=-0.04,position=time_, end=locals()['anchor_music'+str(i)].info.duration,ck=ck_anchor,audio=False)
|
|
@@ -261,7 +262,7 @@ def text_to_short_vedio_create(title_ad="input/people/peggy1_1_long.mp4",op="inp
|
|
|
|
|
|
|
|
|
|
|
|
- w = video_writer_init("output/test6.mp4")
|
|
|
+ w = video_writer_init("output/test7.mp4")
|
|
|
w.Open()
|
|
|
|
|
|
frames = int(t.info.fps)*int(time_)
|
|
@@ -318,7 +319,7 @@ def text_border(draw,x,y,text,font,shadowcolor,fillcolor):
|
|
|
draw.text((x, y), text, font=font, fill=fillcolor)
|
|
|
|
|
|
def text_to_short_vedio(mp4_file = "input/example/test3.mp4",sound_file = None
|
|
|
- ,vedio_time = 30,output_filename="output/demo.mp4",text_font = "font/DFT_B7.ttc"):
|
|
|
+ ,output_filename="output/demo.mp4",text_font = "font/DFT_B7.ttc"):
|
|
|
t = openshot.Timeline(1280, 720, openshot.Fraction(30000, 1000), 44100, 2, openshot.LAYOUT_STEREO)
|
|
|
t.Open()
|
|
|
|
|
@@ -329,7 +330,7 @@ def text_to_short_vedio(mp4_file = "input/example/test3.mp4",sound_file = None
|
|
|
anchor = openshot.FFmpegReader(mp4_file)
|
|
|
anchor.Open()
|
|
|
anchor_clip = video_photo_clip(video=anchor,layer=2,scale_x=1,scale_y=1,
|
|
|
- location_x=0,location_y=0,position=0, end=vedio_time,audio=True)
|
|
|
+ location_x=0,location_y=0,position=0, end=anchor.info.duration,audio=True)
|
|
|
t.AddClip(anchor_clip)
|
|
|
anchor.Close()
|
|
|
number = 0
|
|
@@ -372,7 +373,7 @@ def text_to_short_vedio(mp4_file = "input/example/test3.mp4",sound_file = None
|
|
|
w = video_writer_init(output_filename)
|
|
|
w.Open()
|
|
|
|
|
|
- frames = int(t.info.fps)*int(vedio_time)
|
|
|
+ frames = int(t.info.fps)*int(anchor.info.duration)
|
|
|
for n in range(frames):
|
|
|
f=t.GetFrame(n)
|
|
|
w.WriteFrame(f)
|
|
@@ -388,5 +389,4 @@ def text_to_short_vedio(mp4_file = "input/example/test3.mp4",sound_file = None
|
|
|
if __name__ == '__main__':
|
|
|
# picture_change()
|
|
|
text_to_short_vedio_create()
|
|
|
- text_to_short_vedio(mp4_file = "output/test6.mp4",sound_file ='output/test6.mp4',vedio_time =284,text_font ="font/DFT_B7.ttc")
|
|
|
- print("down")
|
|
|
+ text_to_short_vedio(mp4_file = "output/test7.mp4",sound_file ='output/test7.mp4',text_font ="font/DFT_R7.ttc")
|