A Python library for lip-syncing cartoons to voice recordings.
Project description
PyToon
Overview
PyToon is a Python based animation library for animating characters and their mouth movements. This tools uses machine learning based audio analysis techiques to automatically lip-sync animated character mouth mouth movements to a given audio recording of someone talking.
Features
- Automatically create cartoon animated lip-sync videos from just an audio file.
- Programmatically generate videos.
- OS Independent! PyToon works on Mac, Windows, and Linux
- Optimized for both CPU and GPU
- Fast Processing! A 60 second audio clip takes ~52 seconds to generate a lip-synced video.
Getting Started
- Install pytoon:
pip3 install pytoon
- Install ffmpeg
- Mac:
brew install ffmpeg
- Linux:
sudo apt install ffmpeg
- Windows: Install from ffmpeg.org
- Mac:
Basic Usage
Generating a Lip-Sync animation and saving to .mp4 file.
from pytoon.animator import animate
from moviepy.editor import VideoFileClip
# Read audio transcript to a string.
transcript_path = "./.temp/speech.txt"
with open(transcript_path, "r") as file:
transcript = file.read()
# Create a Pytoon animation
animation = animate(
audio_file="speech.mp3", # input audio
transcript=transcript, # audio transcript
)
# Overlay the animation on top of another video and save as an .mp4 file.
background_video = VideoFileClip("./path/to/background_video.mp4")
animation.export(path='video.mp4', background=background_video, scale=0.7)
Acknowledgements
This project uses character images created by lazykh.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytoon-1.4.3.tar.gz
(3.8 MB
view details)
Built Distribution
File details
Details for the file pytoon-1.4.3.tar.gz
.
File metadata
- Download URL: pytoon-1.4.3.tar.gz
- Upload date:
- Size: 3.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b82c517b6aff68cf6379b4037eb60a6a651823781b8ac80ef78dae9aac3f46fe |
|
MD5 | 0684420a63c5d6603fad942ac3a9cd0f |
|
BLAKE2b-256 | 237bc03273c08954f460cc0e67b1b9ea16e78e4baf99898aa559c70b3dfb7b1c |
File details
Details for the file pytoon-1.4.3-py3-none-any.whl
.
File metadata
- Download URL: pytoon-1.4.3-py3-none-any.whl
- Upload date:
- Size: 3.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fecfec665b766bbc4267cf35f21d44a769817a26e7e45987510302f93518a873 |
|
MD5 | a1556cdd00c87aa13851ad639cfb0d07 |
|
BLAKE2b-256 | 80bc39aebd2151688fa19a93521082ae79442828be09181cb8a9760f39964759 |