AI 활용 / / 2025. 10. 3. 00:06

AI로 에니메이션 만들기(1차 반자동화 시도)

반응형

AI를 사용해서 자동으로 동영상을 만들 수 있는 방법은 있습니다. API 사용 비용을 어느 정도 지불하면 가능합니다. 그전에 우선 일부는 AI를 사용하고 일부분은 열심히 손을 움직여서 동영상을 만들어 보고 싶었습니다. 가능성을 먼저 보고 싶었거든요. AI를 사용해서 스크립트, 이미지, 음성을 만듭니다. 그리고 만들어진 재료를 조합해서 애플 iMovie를 사용해서 동영상으로 만들었습니다. 

사용한 AI 도구는 구글의 제미나이, 에이아이 스튜디오입니다. 한번 만들어 보겠습니다.

(만들어가는 프로세스는 구글 제미나이 쿡북의 내용을 참고했습니다.)

1. 스크립트 만들기 - 제미나이

스크립트는 구글 제미나이를 사용하겠습니다. 에니메이션을 만들 거라서 10장짜리 장면을 만들고 각 장면에 들어갈 대사(음성)를 같이 만들어 달라고 할 겁니다. 이 장면에 들어갈 이야기(스토리)도 제미나이가 만들어 줄 겁니다. 구글 프롬프트에 아래 내용을 입력합니다.

You are an animation video producer. Generate a story sequence about "a cat and a dog playing" in 10 scenes (with interactions and characters), 1 sec each scene.

# Write for each scene
## image_prompt
- (define art style for kids animation(consistent for all the characters), no violence)
- a full description of the scene, the characters in it, and the background in 20 words or less.
- Progressively shift the scene as the story advances.
## audio_text:
- a one-sentence dialogue/narration for the scene with character name.
- it can be a narration
## character_description
- no people ever, only animals and objects.
- Describe all characters (consistent names, features, clothing, etc.) with an art style reference (e.g., "Pixar style," "photorealistic," "Ghibli") in 30 words or less.

이렇게 하면 제미나이가 10의 장면을 image_prompt, audio_text, character_description 으로 구분해서 결과를 줍니다.

Here is the 10-scene animation sequence about a cat and a dog playing.

### **Scene 1**

**image_prompt:** (Pixar-style 3D kids animation) Pip the cat bats a red ball of yarn in a sunlit, cozy living room.
**audio_text:** Narrator: In a cozy little house, Pip the cat found something fun to do.
**character_description:** Pip: A sleek ginger tabby cat with big green eyes. Barnaby: A fluffy, friendly golden retriever with a goofy smile. (Pixar-style 3D animation)

### **Scene 2**

**image_prompt:** (Pixar-style 3D kids animation) Barnaby the dog peeks from behind a sofa, tail wagging, watching Pip play.
**audio_text:** Barnaby: "Ooh, what's that, Pip?"
**character_description:** Pip: A sleek ginger tabby cat with big green eyes. Barnaby: A fluffy, friendly golden retriever with a goofy smile. (Pixar-style 3D animation)

### **Scene 3**

**image_prompt:** (Pixar-style 3D kids animation) Pip playfully pushes the red yarn ball, sending it rolling across the polished wooden floor.
**audio_text:** Pip: "You can't catch it, Barnaby!"
**character_description:** Pip: A sleek ginger tabby cat with big green eyes. Barnaby: A fluffy, friendly golden retriever with a goofy smile. (Pixar-style 3D animation)

### **Scene 4**

**image_prompt:** (Pixar-style 3D kids animation) Barnaby happily pounces after the rolling red yarn, sliding slightly on the smooth floor.
**audio_text:** Narrator: And so the great chase began!
**character_description:** Pip: A sleek ginger tabby cat with big green eyes. Barnaby: A fluffy, friendly golden retriever with a goofy smile. (Pixar-style 3D animation)

### **Scene 5**

**image_prompt:** (Pixar-style 3D kids animation) The yarn ball rolls under a kitchen table, with Pip and Barnaby chasing it.
**audio_text:** Barnaby: "I'm gonna get it!"
**character_description:** Pip: A sleek ginger tabby cat with big green eyes. Barnaby: A fluffy, friendly golden retriever with a goofy smile. (Pixar-style 3D animation)

### **Scene 6**

**image_prompt:** (Pixar-style 3D kids animation) Pip leaps gracefully onto a kitchen chair, looking down as Barnaby sniffs for the ball.
**audio_text:** Pip: "You're looking in the wrong spot, silly puppy!"
**character_description:** Pip: A sleek ginger tabby cat with big green eyes. Barnaby: A fluffy, friendly golden retriever with a goofy smile. (Pixar-style 3D animation)

### **Scene 7**

**image_prompt:** (Pixar-style 3D kids animation) Barnaby looks up at Pip, wagging his tail with a soft toy mouse in his mouth.
**audio_text:** Barnaby: "Look what I found instead!"
**character_description:** Pip: A sleek ginger tabby cat with big green eyes. Barnaby: A fluffy, friendly golden retriever with a goofy smile. (Pixar-style 3D animation)

### **Scene 8**

**image_prompt:** (Pixar-style 3D kids animation) Pip jumps down from the chair and gently boops Barnaby’s nose with his paw.
**audio_text:** Narrator: Pip decided the mouse was a much better toy.
**character_description:** Pip: A sleek ginger tabby cat with big green eyes. Barnaby: A fluffy, friendly golden retriever with a goofy smile. (Pixar-style 3D animation)

### **Scene 9**

**image_prompt:** (Pixar-style 3D kids animation) Barnaby drops the toy mouse, and they both look at it on the floor between them.
**audio_text:** Pip: "Okay, that's a good one, let's play with that!"
**character_description:** Pip: A sleek ginger tabby cat with big green eyes. Barnaby: A fluffy, friendly golden retriever with a goofy smile. (Pixar-style 3D animation)

### **Scene 10**

**image_prompt:** (Pixar-style 3D kids animation) Pip and Barnaby are curled up together on a soft rug, sleeping beside the toy mouse.
**audio_text:** Narrator: After a long day of playing, the best friends were ready for a nap.
**character_description:** Pip: A sleek ginger tabby cat with big green eyes. Barnaby: A fluffy, friendly golden retriever with a goofy smile. (Pixar-style 3D animation)

결과 내용을 보시면 등장하는 동물은 고양이 Pip과 강아지 Barnaby이고요. 나레이터가 있습니다.

2. 이미지 만들기 - AI Studio: Imagen

10개의 장면을 제미나이가 준 스크립트를 사용해서 이미지로 만들겁니다. 저는 Imagen 4를 사용할 건데요. 구글 AI Studio에서 무료로 사용할 수 있습니다. 이미지에 사용할 스크립트는 아래와 같은 형식입니다. 

detailed children book animation style {image_prompt} {character_description}

{image_prompt}과 {character_description}에 각각 제미나이가 준 내용을 그대로 넣으면 됩니다. 예를 들어 첫 번째 장면은 아래와 같이 넣으면 됩니다.

detailed children book animation style (Pixar-style 3D kids animation) Pip the cat bats a red ball of yarn in a sunlit, cozy living room.
Pip: A sleek ginger tabby cat with big green eyes. Barnaby: A fluffy, friendly golden retriever with a goofy smile. (Pixar-style 3D animation)

결과물로 나온 이미지는 실행할 때마다 달라집니다. 제가 받은 이미지는 아래와 같습니다.

이 이미지를 다운로드해 두고 계속해서 10장 이미지를 차례대로 만들어 둡니다. 흥미로운 점은 이미지를 만들 때 오른쪽 위에 있는 버튼을 누르면 제미나이 API로 Imagen을 사용할 수 있는 코드를 받을 수 있습니다. 이 코드를 사용하면 자동으로 이미지를 만들 수도 있습니다.

# To run this code you need to install the following dependencies:
# pip install google-genai

from google import genai
import os

def generate():
    client = genai.Client(api_key=os.environ.get("GEMINI_API_KEY"))

    result = client.models.generate_images(
        model="models/imagen-4.0-generate-001",
        prompt="""detailed children book animation style (Pixar-style 3D kids animation) Pip the cat bats a red ball of yarn in a sunlit, cozy living room.
Pip: A sleek ginger tabby cat with big green eyes. Barnaby: A fluffy, friendly golden retriever with a goofy smile. (Pixar-style 3D animation)""",
        config=dict(
            number_of_images=1,
            output_mime_type="image/jpeg",
            person_generation="ALLOW_ALL",
            aspect_ratio="1:1",
            image_size="1K",
        ),
    )

    if not result.generated_images:
        print("No images generated.")
        return

    if len(result.generated_images) != 1:
        print("Number of images generated does not match the requested number.")

    for n, generated_image in enumerate(result.generated_images):
        generated_image.image.save(f"generated_image_{n}.jpg")


if __name__ == "__main__":
    generate()

3. 음성 만들기 - AI Studio: 음성

이번에는 음성을 만들 차례입니다. AI Studio에서는 무료로 TTS 모델을 사용할 수 있습니다. 제미나이에서 만들어준 장면별 audio_text를 사용해서 음성을 만듭니다. Pip, Barnaby, 나레이터 각각 다른 음성을 골라서 만들고 파일로 다운로드합니다.

4. 동영상 만들기

저는 동영상을 만드는 툴로 맥에서 사용할 수 있는 iMovie를 사용했습니다. 아마 유료로 사용할 수 있는 좀 더 좋은 툴이 있다면 그걸 사용하면 더 좋은 영상을 만들 수도 있을 겁니다.

 

5. 유튜브에 올리기

이 동영상을 유튜브에 올려보기로 했습니다. 이미지를 만들 때 비율을 1:1로 했더니 딱히 보기가 좋지는 않네요. 유튜브에 등록할 때 동영상의 설명을 넣어야 하는데요. 그것도 제미나이를 사용해서 만들면 됩니다.

Give a short description about the script above in Korean. I will use it for youtube video uploading.

유튜브에 영상이 잘 올라갔습니다. https://youtu.be/nASwYgyazcM

 

반응형
  • 네이버 블로그 공유
  • 네이버 밴드 공유
  • 페이스북 공유
  • 카카오스토리 공유