Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relates to Issue #2: modified code to handle moviepy v2 update #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions movie_director.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import numpy as np
import os
import io
from moviepy.editor import (
from moviepy import (
ImageClip,
concatenate_videoclips,
concatenate_audioclips,
AudioFileClip,
)
import moviepy.editor as mpe
import moviepy as mpe


async def make_movie(movie_script, manga, volume_number, narration_client):
Expand All @@ -33,7 +33,7 @@ async def fetch_narration(entry):
# Since convert is an async generator, we use async for to iterate over it
async for audio_bytes in client.text_to_speech.convert(
text=entry["text"],
voice_id="sZmNxSXCR0zfeTkqqiQD", # Replace with your chosen voice ID
voice_id="pNInz6obpgDQGcFmaJgB", # Replace with your chosen voice ID
):
audio_bytes_io.write(audio_bytes)
# After collecting all bytes, we can optionally seek to the start
Expand Down Expand Up @@ -91,7 +91,7 @@ def create_movie_from_script(script, manga, volume_number):
image
) # Assume this function adds image to background

image_clip = mpe.ImageClip(np.array(final_image)).set_duration(
image_clip = mpe.ImageClip(np.array(final_image)).with_duration(
image_display_duration
)
segment_clips.append(image_clip)
Expand All @@ -107,7 +107,7 @@ def create_movie_from_script(script, manga, volume_number):
final_audio_clip = concatenate_audioclips(audio_clips)

# Set the concatenated audio clip to the final video clip
final_video_clip = final_video_clip.set_audio(final_audio_clip)
final_video_clip = final_video_clip.with_audio(final_audio_clip)

# Final movie path
final_movie_path = f"{manga}/v{volume_number}/recap.mp4"
Expand Down