EmojiVidGen은 텍스트 파일로 비디오를 생성하는 재미있는 도구입니다. 스크립트(스토리나 대화와 유사)가 포함된 일반 텍스트 파일 형태로 입력을 받습니다. 그런 다음 이 스크립트를 멋진 비디오로 변환합니다. EmojiVidGen은 다양한 모델과 언어를 실험할 수 있는 플러그인 시스템을 기반으로 합니다. 필요한 것은 약간의 상상력과 타이핑 기술뿐입니다!
주요 특징
EmojiVidGen
처음에는 GenAI를 통한 엔터테인먼트용으로 제작되었지만 특히 유능한 사람이 참여하고 멋진 콘텐츠를 제작할 수 있는 상당한 잠재력을 가지고 있습니다. 이 프로젝트는 실험적이며 주로 교육 목적으로 제작되어 AI 기반 비디오 제작의 가능성을 탐구합니다.
이 소프트웨어는 교육 목적으로만 제작되었습니다. 이는 귀하의 재량과 위험에 따라 사용됩니다. 본 코드에 활용된 AI 모델은 상업적 이용에 제한이 있을 수 있으니 주의하시기 바랍니다.
sudo apt update
sudo apt install espeak ffmpeg
git clone https://github.com/code2k13/emoji_vid_gen
cd emoji_vid_gen
wget https://github.com/googlefonts/noto-emoji/raw/main/fonts/NotoColorEmoji.ttf
pip install -r requirements.txt
참고: 스크립트는 항상
Image:
지시문으로 시작해야 합니다.
Image: Cartoon illustration showing a beautiful landscape with mountains and a road.
Audio: Tranquil calm music occasional chirping of birds.
Title: EmojiVidGen
?: Emoji vid gen is a tool to create videos from text files using AI.
python generate_video.py stories/hello.txt hello.mp4
Image: A single trophy kept on table. comic book style.
Audio: Upbeat introduction music for cartoon show.
Title: Emoji Quiz Showdown
?: " Welcome to the Emoji Quiz Showdown! Are you ready to test your knowledge? "
?: " Meow! I'm ready! "
?: " Woof! Let's do this! "
Image: Cartoon illustration of the Eiffel Tower.
?: " First question What is the capital of France? "
Audio: suspenseful music playing.
?: " Paris! "
Audio: people applauding sound
Image: Cartoon illustration of Mount Everest.
?: " Correct! One point for the cat! Next question What is the tallest mountain in the world? "
Audio: suspenseful music playing.
?: " Mount Everest! "
Audio: people applauding sound
Image: Cartoon illustration of a water molecule.
?: " Right again! One point for the dog! Next question What is the chemical symbol for water? "
Audio: suspenseful music playing.
?: " H2O! "
Audio: people applauding sound
Image: Cartoon illustration of a globe with seven continents.
?: " Correct! Another point for the cat! Last question How many continents are there on Earth? "
Audio: suspenseful music playing.
?: " Seven! "
Audio: people applauding sound
?: " Correct! It's a tie! You both did great! Thanks for playing the Emoji Quiz Showdown! "
이모티콘 ?️
내레이터로 예약되어 있습니다. 라인 시작 시 이를 사용하면 시스템이 사운드만 생성하고 배경에는 이미지를 출력하지 않습니다.
비디오 생성에 대한 이전 지침을 따랐다면 기본 설정에서 espeak
텍스트 음성 변환 엔진으로 사용하여 로봇처럼 들리는 출력을 생성한다는 것을 알 수 있습니다. EmojiVidGen은 작업 실행 방법이나 사용되는 모델을 수정할 수 있는 플러그인으로 구성된 내부 구조로 구축되었습니다.
예를 들어, 텍스트-이미지, 텍스트-오디오, 텍스트-음성 등 각 생성 작업 유형에 대해 특정 플러그인을 지정할 수 있습니다. 각 플러그인은 고유한 모델과 방법으로 작동하기 때문에 이러한 설정을 개별적으로 구성하는 것은 부담스러울 수 있습니다. 이 프로세스를 단순화하기 위해 사전 설정 개념을 도입했습니다. generate_video.py
파일에 --preset
옵션을 제공하여 사전 설정을 적용할 수 있습니다.
예를 들어 아래 사전 설정은 local_medium
이라는 사전 설정을 사용합니다.
python generate_video.py stories/hello.txt hello.mp4 --preset local_medium
모든 사전 설정은 ./presets folder
에 저장됩니다. 새 사전 설정(예: custom_preset
)을 만들려면 `./presets' 폴더에 새 custom_preset.yaml
파일을 만들고 다음과 같이 사용하면 됩니다.
python generate_video.py stories/hello.txt hello.mp4 --preset custom_preset
characters
섹션에 사용되는 voice
은 선택한 text_to_speech
공급자에서 지원해야 합니다. 이미지는 정사각형 비율과 투명한 배경을 가진 PNG 파일이어야 합니다.
사전 설정 이름 | 설명 |
---|---|
openai_basic | 텍스트 음성 변환(표준) 및 이미지 생성(DALL-E 2 @ 512x512)에 OpenAI를 사용합니다. OPENAI_API_KEY 환경 변수를 채워야 합니다. |
openai_medium | openai_basic과 유사하지만 (DALL-E 3 @ 1024x1024)을 사용합니다. OPENAI_API_KEY 환경 변수를 채워야 합니다. |
local_basic | 텍스트를 이미지로 변환하기 위해 stabilityai/sd-turbo 모델이 포함된 Huggingface의 Stable Diffusion 파이프라인을 사용합니다. 텍스트를 음성으로 변환하는 데 espeak 사용하고 텍스트를 오디오로 변환하는 데 Huggingface의 AudioLDM 파이프라인을 사용합니다. |
local_basic_gpu | local_basic과 동일하지만 cuda 지원이 활성화됩니다. |
local_medium | local_basic과 비슷하지만 텍스트 음성 변환 엔진으로 brave 사용하고 텍스트 변환 엔진으로 stabilityai/sdxl-turbo 모델을 사용합니다. |
local_medium | local_medium과 동일하지만 cuda 지원이 활성화됩니다. |
11_중간 | local_medium과 동일하지만 ElevenLabs 텍스트 음성 변환 API 지원을 사용합니다. .env 파일에 정의하려면 인터넷과 ELEVEN_API_KEY 변수가 필요합니다. 인터넷과 ElevenLabs 계정이 필요합니다. |
parler_medium | local_medium과 동일하지만 parler 텍스트 음성 변환 API 지원을 사용합니다. |
때로는 이모티콘을 비디오의 캐릭터로 사용하고 싶지 않거나 각 캐릭터에 대해 다른 음성을 사용하고 싶지 않을 수도 있습니다. 이제 사전 설정된 yaml 파일의 characters
섹션을 사용하여 이 작업을 수행할 수 있습니다. 다음은 해당 섹션이 어떻게 보이는지에 대한 예입니다.
global :
width : 512
height : 512
use_cuda : " false "
characters :
- name : " ? "
voice : " fable "
- name : " ? "
image : " /workspace/emoji_vid_gen/cat.png "
voice : " alloy "
- name : " ? "
image : " /workspace/emoji_vid_gen/dog.png "
voice : " echo "
text_to_speech :
provider : openai
voice : Nova
WIP
EmojiVidGen은 캐시 메커니즘을 활용하여 비디오 제작 중에 생성된 자산을 유지하며 각각은 사용된 특정 '프롬프트'와 연결됩니다. 이 기능은 특히 비디오를 반복적으로 다듬을 때 자산을 반복적으로 재생성할 필요가 없어 매우 유용하다는 것이 입증되었습니다. 그러나 .cache
디렉터리는 자동으로 지워지지 않는다는 점에 유의하세요. 비디오 프로젝트를 완료하고 다른 프로젝트를 시작할 때 이를 지우는 것이 좋습니다.
팁: 캐시된 자산을 강제로 다시 생성하려면 공백이나 구두점을 추가하는 등 '프롬프트'를 약간만 변경하세요.
자산 파일이 .cache
폴더에 있는지 확인하세요. 이런 식으로 스크립트를 작성하십시오.
Image: .cache/existing_background_hd.png
Audio: Funny opening music jingle.
Title: EmojiVidGen
?: .cache/existing_speech.wav
적절한 사전 설정 파일을 복사하고 다음 줄을 수정합니다.
global :
width : 1152
height : 896
참고: 이 설정은 안정적인 확산의 출력에 영향을 미칩니다. 모든 해결 방법이 제대로 작동하는 것은 아닙니다. 자세한 내용은 https://replicate.com/guides/stable-diffusion/how-to-use/를 확인하세요. Stable Diffusion은 정사각형 종횡비에서 잘 작동하는 것 같습니다.
espeak
텍스트 음성 변환 공급자를 사용할 때 이 오류 메시지가 표시됩니다.
Traceback (most recent call last):
File " /usr/local/lib/python3.10/dist-packages/pyttsx3/drivers/espeak.py " , line 171, in _onSynth
self._proxy.notify( ' finished-utterance ' , completed=True)
ReferenceError: weakly-referenced object no longer exists
이 오류는 출력에 영향을 주지 않으므로 지금은 무시하십시오.
아래 오류가 발생하면 .cache
디렉터리를 삭제하세요.
File " plyvel/_plyvel.pyx " , line 247, in plyvel._plyvel.DB.__init__
File " plyvel/_plyvel.pyx " , line 88, in plyvel._plyvel.raise_for_status
plyvel._plyvel.IOError: b ' IO error: lock .cache/asset/LOCK: Resource temporarily unavailable '
@misc{lacombe-etal-2024-parler-tts,
author = {Yoach Lacombe and Vaibhav Srivastav and Sanchit Gandhi},
title = {Parler-TTS},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {url{https://github.com/huggingface/parler-tts}}
}
@misc{lyth2024natural,
title={Natural language guidance of high-fidelity text-to-speech with synthetic annotations},
author={Dan Lyth and Simon King},
year={2024},
eprint={2402.01912},
archivePrefix={arXiv},
primaryClass={cs.SD}
}