Hanabi is a open-source Python framework that automate the creation of music videos with lyrics.
Imagine that you would like to create a music video for Eminem - Lose your self. You can use hanabi cli, as follows:
hanabi create-video --music-name "eminem lose your self"
When running the code above, hanabi will search for the lyrics, image, music and create the video.
Hanabi cli has some other arguments such as:
Allows you to create the video from the specified image.
hanabi create-video --music-name "eminem lose your self" --image-file "eminem.jpg"
Allows you to create the video from the specified audio.
hanabi create-video --music-name "eminem lose your self" --audio-file "lose_your_self.mp3"
Allows you to create the video from the specified path.
hanabi create-video --music-name "eminem lose your self" --save-path "eminem_lose_your_self.mp4"
You can also use the direct API.
from hanabi.lyrics import Lyrics
from hanabi.audio import Audio
from hanabi.image import Image
from hanabi.video import Video
HANABI_PATH = "/tmp/hanabi"
MUSIC_NAME = "eminem lose your self"
# Get music lyrics
music_lyrics = Lyrics(MUSIC_NAME).get_lyrics()
# Download the image
Image(MUSIC_NAME).download()
image_file = f"{HANABI_PATH}/image/{MUSIC_NAME}/000001.jpg"
# Download the music audio
Audio(MUSIC_NAME).download()
audio_file = f"{HANABI_PATH}/audio/{MUSIC_NAME}.mp3"
# Create the video
video = Video(
texts=music_lyrics,
audio=audio_file,
image=image_file,
)
video.create_video_clip(save_path=f"{MUSIC_NAME}.mp4")To make contributions to the repository, it is necessary to open a PR(Pull Request), which has good code writing and the CI is passing.
