# PyToon
[![Downloads](https://static.pepy.tech/badge/pytoon)](https://pepy.tech/project/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.
[Example Output Video](https://youtu.be/fX2loRnr7II)
## 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
1. Install pytoon: `pip3 install pytoon`
2. Install ffmpeg
- Mac: `brew install ffmpeg`
- Linux: `sudo apt install ffmpeg`
- Windows: Install from [ffmpeg.org](https://ffmpeg.org/download.html)
## 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](https://github.com/carykh/lazykh).
Raw data
{
"_id": null,
"home_page": "https://github.com/lukerbs/apple",
"name": "pytoon",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "animation, forced alignment, lip-sync, audio forced alignment, phoneme, generate subtitles",
"author": "Luke Kerbs",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/23/7b/c03273c08954f460cc0e67b1b9ea16e78e4baf99898aa559c70b3dfb7b1c/pytoon-1.4.3.tar.gz",
"platform": null,
"description": "# PyToon\n[![Downloads](https://static.pepy.tech/badge/pytoon)](https://pepy.tech/project/pytoon)\n## Overview \nPyToon 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.\n\n[Example Output Video](https://youtu.be/fX2loRnr7II)\n\n## Features\n- Automatically create cartoon animated lip-sync videos from just an audio file.\n- Programmatically generate videos.\n- OS Independent! PyToon works on Mac, Windows, and Linux \n- Optimized for both CPU and GPU\n- Fast Processing! A 60 second audio clip takes ~52 seconds to generate a lip-synced video.\n\n## Getting Started \n1. Install pytoon: `pip3 install pytoon`\n2. Install ffmpeg\n - Mac: `brew install ffmpeg`\n - Linux: `sudo apt install ffmpeg`\n - Windows: Install from [ffmpeg.org](https://ffmpeg.org/download.html)\n\n## Basic Usage\n### Generating a Lip-Sync animation and saving to .mp4 file.\n```\nfrom pytoon.animator import animate\nfrom moviepy.editor import VideoFileClip\n\n# Read audio transcript to a string.\ntranscript_path = \"./.temp/speech.txt\"\nwith open(transcript_path, \"r\") as file:\n transcript = file.read()\n\n# Create a Pytoon animation \nanimation = animate(\n audio_file=\"speech.mp3\", # input audio\n transcript=transcript, # audio transcript\n)\n\n# Overlay the animation on top of another video and save as an .mp4 file.\nbackground_video = VideoFileClip(\"./path/to/background_video.mp4\")\nanimation.export(path='video.mp4', background=background_video, scale=0.7)\n```\n\n## Acknowledgements\nThis project uses character images created by [lazykh](https://github.com/carykh/lazykh).\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python library for lip-syncing cartoons to voice recordings.",
"version": "1.4.3",
"project_urls": {
"Homepage": "https://github.com/lukerbs/apple"
},
"split_keywords": [
"animation",
" forced alignment",
" lip-sync",
" audio forced alignment",
" phoneme",
" generate subtitles"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "80bc39aebd2151688fa19a93521082ae79442828be09181cb8a9760f39964759",
"md5": "a1556cdd00c87aa13851ad639cfb0d07",
"sha256": "fecfec665b766bbc4267cf35f21d44a769817a26e7e45987510302f93518a873"
},
"downloads": -1,
"filename": "pytoon-1.4.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a1556cdd00c87aa13851ad639cfb0d07",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3831359,
"upload_time": "2024-10-15T01:38:46",
"upload_time_iso_8601": "2024-10-15T01:38:46.458086Z",
"url": "https://files.pythonhosted.org/packages/80/bc/39aebd2151688fa19a93521082ae79442828be09181cb8a9760f39964759/pytoon-1.4.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "237bc03273c08954f460cc0e67b1b9ea16e78e4baf99898aa559c70b3dfb7b1c",
"md5": "0684420a63c5d6603fad942ac3a9cd0f",
"sha256": "b82c517b6aff68cf6379b4037eb60a6a651823781b8ac80ef78dae9aac3f46fe"
},
"downloads": -1,
"filename": "pytoon-1.4.3.tar.gz",
"has_sig": false,
"md5_digest": "0684420a63c5d6603fad942ac3a9cd0f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3828142,
"upload_time": "2024-10-15T01:38:51",
"upload_time_iso_8601": "2024-10-15T01:38:51.554805Z",
"url": "https://files.pythonhosted.org/packages/23/7b/c03273c08954f460cc0e67b1b9ea16e78e4baf99898aa559c70b3dfb7b1c/pytoon-1.4.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-15 01:38:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "lukerbs",
"github_project": "apple",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "annotated-types",
"specs": [
[
"==",
"0.6.0"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2024.2.2"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
"==",
"3.3.2"
]
]
},
{
"name": "click",
"specs": [
[
"==",
"8.1.7"
]
]
},
{
"name": "decorator",
"specs": [
[
"==",
"4.4.2"
]
]
},
{
"name": "Distance",
"specs": [
[
"==",
"0.1.3"
]
]
},
{
"name": "filelock",
"specs": [
[
"==",
"3.13.2"
]
]
},
{
"name": "forcealign",
"specs": [
[
"==",
"1.0.1"
]
]
},
{
"name": "fsspec",
"specs": [
[
"==",
"2024.3.1"
]
]
},
{
"name": "g2p-en",
"specs": [
[
"==",
"2.1.0"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.6"
]
]
},
{
"name": "imageio",
"specs": [
[
"==",
"2.34.0"
]
]
},
{
"name": "imageio-ffmpeg",
"specs": [
[
"==",
"0.4.9"
]
]
},
{
"name": "inflect",
"specs": [
[
"==",
"7.0.0"
]
]
},
{
"name": "Jinja2",
"specs": [
[
"==",
"3.1.3"
]
]
},
{
"name": "joblib",
"specs": [
[
"==",
"1.3.2"
]
]
},
{
"name": "MarkupSafe",
"specs": [
[
"==",
"2.1.5"
]
]
},
{
"name": "moviepy",
"specs": [
[
"==",
"1.0.3"
]
]
},
{
"name": "mpmath",
"specs": [
[
"==",
"1.3.0"
]
]
},
{
"name": "networkx",
"specs": [
[
"==",
"3.2.1"
]
]
},
{
"name": "nltk",
"specs": [
[
"==",
"3.8.1"
]
]
},
{
"name": "numpy",
"specs": [
[
"==",
"1.26.4"
]
]
},
{
"name": "opencv-python",
"specs": [
[
"==",
"4.9.0.80"
]
]
},
{
"name": "pillow",
"specs": [
[
"==",
"10.2.0"
]
]
},
{
"name": "proglog",
"specs": [
[
"==",
"0.1.10"
]
]
},
{
"name": "pydantic",
"specs": [
[
"==",
"2.6.4"
]
]
},
{
"name": "pydantic_core",
"specs": [
[
"==",
"2.16.3"
]
]
},
{
"name": "pydub",
"specs": [
[
"==",
"0.25.1"
]
]
},
{
"name": "regex",
"specs": [
[
"==",
"2023.12.25"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.31.0"
]
]
},
{
"name": "scipy",
"specs": [
[
"==",
"1.12.0"
]
]
},
{
"name": "sympy",
"specs": [
[
"==",
"1.12"
]
]
},
{
"name": "torch",
"specs": [
[
"==",
"2.2.1"
]
]
},
{
"name": "torchaudio",
"specs": [
[
"==",
"2.2.1"
]
]
},
{
"name": "tqdm",
"specs": [
[
"==",
"4.66.2"
]
]
},
{
"name": "typing_extensions",
"specs": [
[
"==",
"4.10.0"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"2.2.1"
]
]
}
],
"lcname": "pytoon"
}