|
@@ -130,14 +130,20 @@ def csv_to_text(csv_file,text_font):
|
|
# 讀取 CSV 檔案內容
|
|
# 讀取 CSV 檔案內容
|
|
rows = csv.reader(csvfile)
|
|
rows = csv.reader(csvfile)
|
|
|
|
|
|
|
|
+ j=0
|
|
# 以迴圈輸出每一列
|
|
# 以迴圈輸出每一列
|
|
for row in rows:
|
|
for row in rows:
|
|
|
|
+
|
|
|
|
+ if j==0:
|
|
|
|
+ j = 1
|
|
|
|
+ continue
|
|
|
|
+
|
|
start = datetime.strptime(row[1], "%H:%M:%S,%f")
|
|
start = datetime.strptime(row[1], "%H:%M:%S,%f")
|
|
end = datetime.strptime(row[2], "%H:%M:%S,%f") - datetime.strptime(row[1], "%H:%M:%S,%f")
|
|
end = datetime.strptime(row[2], "%H:%M:%S,%f") - datetime.strptime(row[1], "%H:%M:%S,%f")
|
|
end_timeStamp=end.seconds+0.000001*end.microseconds
|
|
end_timeStamp=end.seconds+0.000001*end.microseconds
|
|
start_timeStamp=start.minute*60+start.second+ 0.000001*start.microsecond
|
|
start_timeStamp=start.minute*60+start.second+ 0.000001*start.microsecond
|
|
text_form.append({'text':row[3],'start':start_timeStamp,'end':end_timeStamp,'size':36,'font':text_font})
|
|
text_form.append({'text':row[3],'start':start_timeStamp,'end':end_timeStamp,'size':36,'font':text_font})
|
|
-
|
|
|
|
|
|
+
|
|
return text_form
|
|
return text_form
|
|
def text_to_short_vedio(mp4_file ,sound_file,output_filename,text_font):
|
|
def text_to_short_vedio(mp4_file ,sound_file,output_filename,text_font):
|
|
t = openshot.Timeline(1280, 720, openshot.Fraction(30000, 1000), 44100, 2, openshot.LAYOUT_STEREO)
|
|
t = openshot.Timeline(1280, 720, openshot.Fraction(30000, 1000), 44100, 2, openshot.LAYOUT_STEREO)
|