Размер видео: 1280 X 720853 X 480640 X 360
Показать панель управления
Автовоспроизведение
Автоповтор
I forgotfrom moviepy.editor import *import random2def change_background(word): special_characters = ['.', '!', '?'] return any(char in word for char in special_characters)sentence = 'first. second. third.'words = sentence.split(' ')background_list = ['backgrounds_names']background_folder = 'backgrounds\\'background_extension = '.mp4'background = background_folder + random2.choice(background_list) + background_extensionaudioclip = AudioFileClip("background_music.mp3")sound = AudioFileClip("open.mp3")clip = VideoFileClip(background)logo = ImageClip("logo")logo.margin(top=20, left=20, opacity=0)logo.set_pos('left', 'top')name = 't'duration = 0res = len(words)video_clips = [clip]for word in words: duration += 0.3 text_clip = TextClip(word, fontsize=150, font="Franklin-Gothic-Medium", color="white", stroke_width=5, stroke_color="black") text_clip = text_clip.set_start(duration) text_clip = text_clip.set_pos('center') text_clip = text_clip.set_duration(0.2) video_clips.append(text_clip) if change_background(word): duration += 0.7 next_background = VideoFileClip(background_folder + random2.choice(background_list) + background_extension).set_start(duration) video_clips.append(next_background)video_clips.append(logo)duration += 0.3final_video = CompositeVideoClip(video_clips).set_duration(duration)final_video = vfx.fadeout(final_video, duration=0.6, final_color=[0, 0, 0])audio = CompositeAudioClip([sound, audioclip]).set_duration(duration)final_video = final_video.set_audio(audio)final_video.write_videofile("name.mp4")
1:47 Polska moment
Poland mentioned rrahhh
cool
the code is so messy aghhhh
I forgot
from moviepy.editor import *
import random2
def change_background(word):
special_characters = ['.', '!', '?']
return any(char in word for char in special_characters)
sentence = 'first. second. third.'
words = sentence.split(' ')
background_list = ['backgrounds_names']
background_folder = 'backgrounds\\'
background_extension = '.mp4'
background = background_folder + random2.choice(background_list) + background_extension
audioclip = AudioFileClip("background_music.mp3")
sound = AudioFileClip("open.mp3")
clip = VideoFileClip(background)
logo = ImageClip("logo")
logo.margin(top=20, left=20, opacity=0)
logo.set_pos('left', 'top')
name = 't'
duration = 0
res = len(words)
video_clips = [clip]
for word in words:
duration += 0.3
text_clip = TextClip(word, fontsize=150, font="Franklin-Gothic-Medium", color="white", stroke_width=5, stroke_color="black")
text_clip = text_clip.set_start(duration)
text_clip = text_clip.set_pos('center')
text_clip = text_clip.set_duration(0.2)
video_clips.append(text_clip)
if change_background(word):
duration += 0.7
next_background = VideoFileClip(background_folder + random2.choice(background_list) + background_extension).set_start(duration)
video_clips.append(next_background)
video_clips.append(logo)
duration += 0.3
final_video = CompositeVideoClip(video_clips).set_duration(duration)
final_video = vfx.fadeout(final_video, duration=0.6, final_color=[0, 0, 0])
audio = CompositeAudioClip([sound, audioclip]).set_duration(duration)
final_video = final_video.set_audio(audio)
final_video.write_videofile("name.mp4")
1:47 Polska moment
Poland mentioned rrahhh
cool
the code is so messy aghhhh