Communitygithub.com

moviepy (Python 비디오 합성)

moviepy 2.x를 사용해 순수 Python으로 비디오를 편집하고 합성합니다. 푸티지에 텍스트, 하단 자막, 캡션을 오버레이하고, 클립을 자르고 연결하며, 오디오를 추가하고, Node 없이 단일 build.py 비디오를 제작할 수 있습니다. 사용자가 Python 기반 비디오 편집이나 AI 생성 비디오 위에 결정적 텍스트를 원할 때 사용합니다.

moviepy (Python 비디오 합성)란 무엇인가요?

이 스킬은 moviepy 2.x 라이브러리를 사용하여 Python 환경에서 직접 비디오를 편집하고 합성할 수 있게 해줍니다. 주요 기능으로는 비디오 클립 자르기/연결, 텍스트 오버레이(자막, 하단 제목, 캡션), 오디오 추가/믹싱, Ken Burns 효과 등이 있습니다. 특히 Node.js 툴체인 없이도 단일 Python 스크립트로 완전한 비디오를 제작할 수 있어, AI 생성 푸티지 위에 정확한 텍스트를 입히거나 배치 편집이 필요한 작업에 최적화되어 있습니다. moviepy 2.x는 1.x와 API가 달라 `set_*` 대신 `with_*` 메서드를 사용하며, 성능 최적화를 위해 미리보기 시 낮은 fps와 `ultrafast` 프리셋을 권장합니다. 이 스킬은 Claude Code, Cursor, Codex 등 다양한 AI 에이전트 플랫폼에서 사용할 수 있습니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/iamaanahmad/agents-video-editing-skills/tree/HEAD/skills/moviepy-python-video

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

moviepy (Python 비디오 합성)은(는) 무엇을 하나요?

짧고 스크립트 기반 비디오, 푸티지 위에 정확한 텍스트를 입히는 작업에 최적입니다. 길고 디자인이 복잡하며 재사용 가능한 비디오는 Remotion을 사용하세요.

moviepy 사용 시Remotion 사용 시
프로젝트가 단일 Python 스크립트일 때React 컴포넌트와 디자인 시스템이 필요할 때
기존 또는 AI 생성 클립 위에 텍스트 오버레이복잡한 애니메이션 그래픽 및 차트
여러 파일에 대한 배치 편집핫 리로드 미리보기가 중요할 때
Node 도구 체인을 사용할 수 없을 때장기간 사용되는 템플릿 비디오

설정

pip install "moviepy>=2" pillow
# 또는: uv add moviepy pillow

이 스킬은 moviepy 2.x를 대상으로 합니다. 1.x와 API가 다릅니다: 임포트는 moviepy에서 직접 하고, 메서드는 set_*/subclip/resize 대신 with_*/subclipped/resized를 사용합니다.

기본

from moviepy import (VideoFileClip, AudioFileClip, ImageClip, TextClip,
                     CompositeVideoClip, CompositeAudioClip, concatenate_videoclips, vfx, afx)

clip = VideoFileClip("in.mp4").subclipped(5, 20)           # 15초 구간
clip = clip.resized(height=1080)                            # 비율 유지
clip = clip.with_effects([vfx.FadeIn(0.5), vfx.FadeOut(0.5)])

joined = concatenate_videoclips([clip, VideoFileClip("b.mp4")], method="compose")
joined.write_videofile("out/result.mp4", fps=30, codec="libx264", audio_codec="aac")

긴 스크립트에서는 항상 .close()를 호출하거나 with 블록을 사용하여 파일 핸들을 해제하세요.

텍스트 오버레이 (푸티지 위의 결정적 텍스트)

title = (TextClip(font="C:/Windows/Fonts/arial.ttf",     # 실제 폰트 파일 경로
                  text="닥터 제인 도우\n수석 과학자",
                  font_size=56, color="white",
                  stroke_color="black", stroke_width=2,
                  method="caption", size=(900, None))
         .with_start(1.0).with_duration(4.0)
         .with_position(("left", 860))
         .with_effects([vfx.CrossFadeIn(0.3), vfx.CrossFadeOut(0.3)]))

final = CompositeVideoClip([clip, title])

참고:

  • TextClip은 폰트 파일 경로(TTF/OTF)가 필요합니다. 프로젝트에 브랜드 폰트를 포함시키세요.
  • 클립 시간은 초 단위이며, 합성 클립의 시작을 기준으로 합니다.
  • 스타일이 많이 들어간 텍스트(둥근 버튼, 그라데이션)는 Pillow로 PNG를 렌더링한 후 ImageClip을 사용하세요.
  • 텍스트는 안전 영역(각 가장자리에서 최소 5%) 안에 유지하세요.

오디오

voice = AudioFileClip("voiceover.mp3")
music = AudioFileClip("music.mp3").with_effects([afx.MultiplyVolume(0.12), afx.AudioFadeOut(2)])
music = music.with_duration(voice.duration + 1)
final = clip.with_audio(CompositeAudioClip([music, voice.with_start(0.5)]))

내레이션이 타임라인을 결정하도록 하세요: 클립 길이를 voice.duration + 패딩으로 설정하고, 반대 방향은 피하세요.

오디오 기반 패턴

scenes = [("scene1.mp3", "intro.png"), ("scene2.mp3", "chart.png")]
parts = []
for audio_path, image_path in scenes:
    a = AudioFileClip(audio_path)
    v = ImageClip(image_path).with_duration(a.duration + 0.6).with_audio(a)
    parts.append(v)
concatenate_videoclips(parts).write_videofile("out/explainer.mp4", fps=30)

정지 이미지에 Ken Burns 효과

img = ImageClip("photo.jpg").with_duration(6)
img = img.resized(lambda t: 1.0 + 0.04 * t).with_position("center")
CompositeVideoClip([img], size=(1920, 1080)).write_videofile("out/kb.mp4", fps=30)

성능

  • 미리보기는 fps=12와 preset="ultrafast"로 작업하고, 최종 렌더링은 30fps로 하세요.
  • write_videofile(..., threads=4)를 사용하세요.
  • 긴 클립에 대해 프레임당 Python 람다(lambda) 사용을 피하세요. 가능하면 FFmpeg로 전처리하세요.

주의 사항

문제원인 및 해결 방법
ImportError: cannot import name 'editor'moviepy 2에서 moviepy.editor가 제거됨; moviepy에서 직접 임포트
AttributeError: set_durationwith_duration 사용; with_start, with_position도 동일
텍스트 클립 충돌실제 폰트 파일 경로를 전달하세요
연결 후 오디오 싱크 불일치모든 클립의 fps가 동일한지 확인하고, 연결 후 오디오를 적용하세요
느린 렌더링초안은 해상도를 낮추고, 큰 resized 람다를 피하세요

Individual skills in this repo

This repo contains 6 individual skills — each has its own dedicated page.

iamaanahmad/captions-subtitles

Create, edit, translate and burn in captions and subtitles - transcribe speech with Whisper, write SRT/VTT/ASS files, style them, and hard-burn word-highlight captions for Shorts, Reels and TikTok. Use for any captioning, subtitle, transcript or accessibility request.

iamaanahmad/ffmpeg-essentials

Core FFmpeg and ffprobe recipes for trimming, joining, converting, resizing, compressing, speed changes, fades, audio extraction and GIF conversion. Use for any direct media transformation task, or when a video will not play, has odd dimensions, or is out of sync.

iamaanahmad/motion-design-craft

Motion design rules for programmatic and edited video - durations, easing, springs, staggering, read time for on-screen text, beat grids, transitions and visual hierarchy, plus the defaults that make a video look AI-generated. Use when animating scenes, choosing timings, or reviewing a video that feels off.

iamaanahmad/remotion-programmatic-video

Build videos as React code with Remotion - compositions, sequences, springs, interpolation, audio sync, data-driven props, studio preview and rendering to MP4. Use for explainers, product demos, release notes, data charts, branded templates, or any video that should be reproducible from code.

iamaanahmad/screen-recording-demos

Record clean product and web app demos - scripted browser recording with Playwright, cursor and zoom polish, speed ramps, trimming dead time and syncing to narration. Use when the user wants a walkthrough, tutorial, UI demo or release video of a web app, or a repeatable recording.

iamaanahmad/voiceover-tts

Generate and time narration with text-to-speech (ElevenLabs, OpenAI TTS, Kokoro, Piper) or prepare a recorded voice - script prep, per-scene audio files, pacing, pronunciation, cleanup and loudness. Use when the user needs a voiceover, narration, dubbing, or voice cloning guidance.

관련 스킬