Spaces:
Runtime error
Runtime error
Update process_energy.py
Browse files- process_energy.py +5 -7
process_energy.py
CHANGED
@@ -174,7 +174,7 @@ def create_affirmation_frames(texts, width=640, height=480, duration=5):
|
|
174 |
font_size = 24
|
175 |
|
176 |
for text in texts:
|
177 |
-
frame = Image.new("
|
178 |
draw = ImageDraw.Draw(frame)
|
179 |
|
180 |
# Menggunakan font default
|
@@ -202,7 +202,7 @@ def create_affirmation_video_with_audio(tujuan, nama_anda, audio_filename, outpu
|
|
202 |
texts = [
|
203 |
f"HAI {nama_anda.upper()}! DENGARLAH SUARA ENERGI SEMESTA DIGITAL SELAMA 3 MENIT AGAR PROSES TRANSFER BERJALAN MULUS.",
|
204 |
f"{nama_anda.upper()}, BAYANGKAN ANDA MENCAPAI SEMUA TUJUAN ANDA DENGAN SUKSES DAN KEBAHAGIAAN.",
|
205 |
-
f"SAYA, {nama_anda.upper()}, ADALAH MAGNET
|
206 |
f"SAYA, {nama_anda.upper()}, MENARIK HAL-HAL POSITIF DALAM HIDUP SAYA. SAYA AKAN MENCAPAI TUJUAN SAYA SUKSES DI: {tujuan.upper()}",
|
207 |
]
|
208 |
|
@@ -217,17 +217,16 @@ def create_affirmation_video_with_audio(tujuan, nama_anda, audio_filename, outpu
|
|
217 |
image_filenames.append(image_filename)
|
218 |
|
219 |
# Load images as video clips
|
220 |
-
clips = [ImageClip(m).set_duration(
|
221 |
|
222 |
# Load background GIF and loop it
|
223 |
-
background_clip = VideoFileClip("spin_energy.gif").
|
224 |
|
225 |
# Load the generated audio file
|
226 |
audio_clip = AudioFileClip(audio_filename)
|
227 |
|
228 |
# Concatenate text clips with background
|
229 |
-
video = CompositeVideoClip([background_clip] + clips)
|
230 |
-
video = video.set_duration(len(clips) * 5).set_audio(audio_clip)
|
231 |
|
232 |
# Write the result to a file
|
233 |
video.write_videofile(output_filename, fps=24, codec='libx264')
|
@@ -236,7 +235,6 @@ def create_affirmation_video_with_audio(tujuan, nama_anda, audio_filename, outpu
|
|
236 |
for image_filename in image_filenames:
|
237 |
os.remove(image_filename)
|
238 |
|
239 |
-
|
240 |
"""
|
241 |
def create_affirmation_video_with_audio(tujuan, nama_anda, audio_filename, output_filename="affirmation_video.mp4"):
|
242 |
# Texts for the video
|
|
|
174 |
font_size = 24
|
175 |
|
176 |
for text in texts:
|
177 |
+
frame = Image.new("RGBA", (width, height), color=(0, 0, 0, 0)) # Transparan
|
178 |
draw = ImageDraw.Draw(frame)
|
179 |
|
180 |
# Menggunakan font default
|
|
|
202 |
texts = [
|
203 |
f"HAI {nama_anda.upper()}! DENGARLAH SUARA ENERGI SEMESTA DIGITAL SELAMA 3 MENIT AGAR PROSES TRANSFER BERJALAN MULUS.",
|
204 |
f"{nama_anda.upper()}, BAYANGKAN ANDA MENCAPAI SEMUA TUJUAN ANDA DENGAN SUKSES DAN KEBAHAGIAAN.",
|
205 |
+
f"SAYA, {nama_anda.upper()}, ADALAH MAGNET DAHSYAT BAGI REALITAS KESUKSESAN DAN KEBAHAGIAAN.",
|
206 |
f"SAYA, {nama_anda.upper()}, MENARIK HAL-HAL POSITIF DALAM HIDUP SAYA. SAYA AKAN MENCAPAI TUJUAN SAYA SUKSES DI: {tujuan.upper()}",
|
207 |
]
|
208 |
|
|
|
217 |
image_filenames.append(image_filename)
|
218 |
|
219 |
# Load images as video clips
|
220 |
+
clips = [ImageClip(m).set_duration(45) for m in image_filenames] # Durasi setiap teks 45 detik
|
221 |
|
222 |
# Load background GIF and loop it
|
223 |
+
background_clip = VideoFileClip("spin_energy.gif").fx(loop, duration=len(clips) * 45)
|
224 |
|
225 |
# Load the generated audio file
|
226 |
audio_clip = AudioFileClip(audio_filename)
|
227 |
|
228 |
# Concatenate text clips with background
|
229 |
+
video = CompositeVideoClip([background_clip] + clips).set_duration(len(clips) * 45).set_audio(audio_clip)
|
|
|
230 |
|
231 |
# Write the result to a file
|
232 |
video.write_videofile(output_filename, fps=24, codec='libx264')
|
|
|
235 |
for image_filename in image_filenames:
|
236 |
os.remove(image_filename)
|
237 |
|
|
|
238 |
"""
|
239 |
def create_affirmation_video_with_audio(tujuan, nama_anda, audio_filename, output_filename="affirmation_video.mp4"):
|
240 |
# Texts for the video
|