Update app.py
Browse files
app.py
CHANGED
@@ -186,7 +186,7 @@ def create_subtitle_clips(subtitles, videosize, fontsize, font, color, debug):
|
|
186 |
video_width, video_height = videosize
|
187 |
#reshaped_text = arabic_reshaper.reshape(subtitle.text)
|
188 |
#bidi_text = get_display(reshaped_text)
|
189 |
-
text_clip = TextClip(font, subtitle.text, font_size=fontsize, margin=(5,5) ,text_align="center" ,color=color, bg_color='black', method='label').with_start(start_time).with_duration(duration)
|
190 |
subtitle_x_position = 'center'
|
191 |
subtitle_y_position = video_height * 4 / 5
|
192 |
text_position = (subtitle_x_position, subtitle_y_position)
|
@@ -212,7 +212,7 @@ def process_video(url):
|
|
212 |
print(video)
|
213 |
subtitles = pysrt.open("google_translate.srt", encoding="utf-8")
|
214 |
output_video_file = input_video_name + '_subtitled' + ".mp4"
|
215 |
-
subtitle_clips = create_subtitle_clips(subtitles, video.size,
|
216 |
final_video = CompositeVideoClip([video] + subtitle_clips)
|
217 |
final_video.write_videofile(output_video_file, codec="libx264", audio_codec="aac", logger=None)
|
218 |
print('final')
|
|
|
186 |
video_width, video_height = videosize
|
187 |
#reshaped_text = arabic_reshaper.reshape(subtitle.text)
|
188 |
#bidi_text = get_display(reshaped_text)
|
189 |
+
text_clip = TextClip(font, subtitle.text, font_size=fontsize, size=(video_width*3/4, None), margin=(5,5) ,text_align="center" ,color=color, bg_color='black', method='label').with_start(start_time).with_duration(duration)
|
190 |
subtitle_x_position = 'center'
|
191 |
subtitle_y_position = video_height * 4 / 5
|
192 |
text_position = (subtitle_x_position, subtitle_y_position)
|
|
|
212 |
print(video)
|
213 |
subtitles = pysrt.open("google_translate.srt", encoding="utf-8")
|
214 |
output_video_file = input_video_name + '_subtitled' + ".mp4"
|
215 |
+
subtitle_clips = create_subtitle_clips(subtitles, video.size, 24, 'arial.ttf', 'yellow', False)
|
216 |
final_video = CompositeVideoClip([video] + subtitle_clips)
|
217 |
final_video.write_videofile(output_video_file, codec="libx264", audio_codec="aac", logger=None)
|
218 |
print('final')
|