|
@@ -433,7 +433,6 @@ def parse_script(file_path,gt_list):
|
|
ind_duration = duration * sub_dic['time_ratio']
|
|
ind_duration = duration * sub_dic['time_ratio']
|
|
new_dic['start'] = dic['start'] + accumulated_duration
|
|
new_dic['start'] = dic['start'] + accumulated_duration
|
|
accumulated_duration += ind_duration
|
|
accumulated_duration += ind_duration
|
|
-
|
|
|
|
new_dic['content'] = sub_dic['content']
|
|
new_dic['content'] = sub_dic['content']
|
|
new_dic['duration'] = ind_duration*0.7
|
|
new_dic['duration'] = ind_duration*0.7
|
|
splitted_dict.append(new_dic)
|
|
splitted_dict.append(new_dic)
|
|
@@ -599,6 +598,7 @@ def video_gen(name_hash,name,text_content, image_urls,multiLang,avatar):
|
|
t.AddClip(bg_left_clip)
|
|
t.AddClip(bg_left_clip)
|
|
bg_left.Close()
|
|
bg_left.Close()
|
|
|
|
|
|
|
|
+
|
|
title = openshot.QtImageReader(dir_title+name_hash+".png")
|
|
title = openshot.QtImageReader(dir_title+name_hash+".png")
|
|
title.Open() # Open the reader
|
|
title.Open() # Open the reader
|
|
title_clip = video_photo_clip(vid=title, layer=4,location_x=-0.047, location_y=0.801,position=0,end=head_duration+main_timer)
|
|
title_clip = video_photo_clip(vid=title, layer=4,location_x=-0.047, location_y=0.801,position=0,end=head_duration+main_timer)
|
|
@@ -622,6 +622,7 @@ def video_gen(name_hash,name,text_content, image_urls,multiLang,avatar):
|
|
sub_dict = parse_script(tmp_video_dir+name_hash+"script.txt",split_by_pun(text_content[0]))
|
|
sub_dict = parse_script(tmp_video_dir+name_hash+"script.txt",split_by_pun(text_content[0]))
|
|
for subd in sub_dict:
|
|
for subd in sub_dict:
|
|
print(subd)
|
|
print(subd)
|
|
|
|
+
|
|
generate_subtitle_image_from_dict(name_hash, sub_dict)
|
|
generate_subtitle_image_from_dict(name_hash, sub_dict)
|
|
|
|
|
|
#sv_path = dir_subtitle + name_hash + '/' + str(script['index'])+'.png'
|
|
#sv_path = dir_subtitle + name_hash + '/' + str(script['index'])+'.png'
|
|
@@ -634,6 +635,8 @@ def video_gen(name_hash,name,text_content, image_urls,multiLang,avatar):
|
|
raw_clip = video_photo_clip(vid=raw,layer=2,position=0, end=raw.info.duration)
|
|
raw_clip = video_photo_clip(vid=raw,layer=2,position=0, end=raw.info.duration)
|
|
t.AddClip(raw_clip)
|
|
t.AddClip(raw_clip)
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
sub_img_list = [None] * len(sub_dict)
|
|
sub_img_list = [None] * len(sub_dict)
|
|
sub_clip_list = [None] * len(sub_dict)
|
|
sub_clip_list = [None] * len(sub_dict)
|
|
for sub_obj in sub_dict:
|
|
for sub_obj in sub_dict:
|
|
@@ -644,6 +647,21 @@ def video_gen(name_hash,name,text_content, image_urls,multiLang,avatar):
|
|
t.AddClip(sub_clip_list[idx])
|
|
t.AddClip(sub_clip_list[idx])
|
|
sub_img_list[idx].Close()
|
|
sub_img_list[idx].Close()
|
|
|
|
|
|
|
|
+
|
|
|
|
+ text_parser tp = parser()
|
|
|
|
+ img_dict_ls = tp.image_clip_info(sub_dict)
|
|
|
|
+ #if 'image_idx' in dic:
|
|
|
|
+ # new_dic['image_obj'] = {'start':dic['start'],'idx':dic['image_idx']}
|
|
|
|
+ img_clip_list = [None]*len(text_content)
|
|
|
|
+ img_list = [None]*len(text_content)
|
|
|
|
+ for p in listdir(dir_photo+name_hash):
|
|
|
|
+ img_list[idx] = openshot.FFmpegReader(dir_photo+name_hash+'/'+p)
|
|
|
|
+ img_list[idx].Open()
|
|
|
|
+ img_clip_list[idx] = video_photo_clip(vid=img_list[idx],layer=3
|
|
|
|
+ ,scale_x=0.81,scale_y=0.68,location_y=-0.03,position=img_dict_ls[int(p)+1]['start'],end=img_dict_ls[int(p)+1]['duration'],audio=False)
|
|
|
|
+ t.AddClip(img_clip_list[idx])
|
|
|
|
+ img_list[idx].Close()
|
|
|
|
+
|
|
anchor = openshot.FFmpegReader(dir_anchor+name_hash+"/0.mp4")
|
|
anchor = openshot.FFmpegReader(dir_anchor+name_hash+"/0.mp4")
|
|
anchor.Open()
|
|
anchor.Open()
|
|
anchor_clip = video_photo_clip(vid=anchor,layer=4,scale_x=0.65,scale_y=0.65,
|
|
anchor_clip = video_photo_clip(vid=anchor,layer=4,scale_x=0.65,scale_y=0.65,
|