moviepy
Edit and compose video with Python using MoviePy. Use when a user asks to programmatically edit videos, create video montages, add text overlays, build…
от TerminalSkills★ 221 звезда на GitHub
Установить moviepy в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
MoviePy
Overview
Edit video programmatically with MoviePy — the Python library for video compositing, cutting, effects, and rendering. Ideal for automated video pipelines: social media content generation, bulk video processing, slideshow builders, subtitle embedding, template-based video creation, and any workflow where you need code-driven video editing without a GUI. Built on ffmpeg.
Instructions
Step 1: Installation
pip install moviepy # 2.2.1 (May 2025); pulls Pillow, numpy, imageio-ffmpeg
# imageio-ffmpeg ships an ffmpeg binary; to use your own: apt install -y ffmpeg
# and set IMAGEIO_FFMPEG_EXE=/usr/bin/ffmpeg
# No ImageMagick needed: v2 draws text with Pillow
Step 2: Basic Operations
from moviepy import VideoFileClip, AudioFileClip
clip = VideoFileClip("input.mp4")
print(f"Duration: {clip.duration}s, Size: {clip.size}, FPS: {clip.fps}")
trimmed = clip.subclipped(10, 60) # 10s to 60s
resized = clip.resized(height=720) # Maintain aspect ratio
resized = clip.resized((1080, 1920)) # Force size
cropped = clip.cropped(x1=100, y1=50, x2=1820, y2=1030)
fast = clip.with_speed_scaled(2.0) # 2x speed
silent = clip.without_audio()
trimmed.write_videofile("output.mp4", fps=24, codec="libx264",
audio_codec="aac", bitrate="5000k", preset="medium", threads=4)
clip.subclipped(5, 10).write_gif("output.gif", fps=15)
clip.close()
Step 3: Concatenation & Composition
from moviepy import VideoFileClip, concatenate_videoclips, CompositeVideoClip, ColorClip, ImageClip
# Concatenate clips sequentially
final = concatenate_videoclips([
VideoFileClip("scene1.mp4"),
VideoFileClip("scene2.mp4"),
VideoFileClip("scene3.mp4"),
])
# Composite (overlay layers)
bg = ColorClip(size=(1920, 1080), color=(15, 23, 42), duration=10)
main = VideoFileClip("main.mp4").resized(height=800).with_position("center")
logo = (ImageClip("logo.png").with_duration(10)
.resized(height=60).with_position((1820, 30)))
composite = CompositeVideoClip([bg, main, logo], size=(1920, 1080))
composite.write_videofile("composite.mp4", fps=30)
Step 4: Text Overlays
font must be the path to a .ttf/.otf file (a name like Arial-Bold raises "Invalid font"); leave it out for Pillow's default. Pass margin=(0, 10) if strokes or descenders get clipped, and method="caption", size=(900, None) to wrap long text inside a fixed width.
from moviepy import TextClip, CompositeVideoClip, VideoFileClip, vfx
video = VideoFileClip("input.mp4")
title = (TextClip(text="Episode 1: Getting Started",
font_size=60, color="white", font="fonts/Inter-Bold.ttf",
stroke_color="black", stroke_width=2)
.with_duration(5).with_position("center").with_start(1))
subtitle = (TextClip(text="Welcome to the show",
font_size=36, color="white", bg_color=(0, 0, 0))
.with_duration(4).with_position(("center", 900))
.with_start(3).with_effects([vfx.CrossFadeIn(0.5), vfx.CrossFadeOut(0.5)]))
final = CompositeVideoClip([video, title, subtitle])
final.write_videofile("titled.mp4")
Step 5: Audio Operations
from moviepy import VideoFileClip, AudioFileClip, CompositeAudioClip
video = VideoFileClip("input.mp4")
video.audio.write_audiofile("extracted.mp3")
# Mix audio tracks
original = video.audio.with_volume_scaled(0.3)
music = AudioFileClip("bg_music.mp3").with_volume_scaled(0.15)
voiceover = AudioFileClip("narration.mp3")
mixed = CompositeAudioClip([original, music, voiceover])
final = video.with_audio(mixed)
final.write_videofile("mixed.mp4")
Step 6: Effects & Custom Filters
from moviepy import VideoFileClip, vfx
clip = VideoFileClip("input.mp4")
clip.with_effects([vfx.MirrorX()]) # Mirror horizontally
clip.with_effects([vfx.BlackAndWhite()]) # Grayscale
clip.with_effects([vfx.FadeIn(1), vfx.FadeOut(2)])
clip.with_effects([vfx.MultiplySpeed(2)]) # same as with_speed_scaled(2)
# Effects return new clips; keep the result: clip = clip.with_effects([...])
# Custom frame-by-frame effect
def add_vignette(frame):
import numpy as np
rows, cols = frame.shape[:2]
X, Y = np.meshgrid(np.arange(cols) - cols/2, np.arange(rows) - rows/2)
mask = 1 - np.clip(np.sqrt(X**2 + Y**2) / (max(rows, cols) * 0.5), 0, 1)
return (frame * mask[:, :, np.newaxis] ** 1.5).astype("uint8")
vignetted = clip.image_transform(add_vignette)
Step 7: Batch Processing
import os
from moviepy import VideoFileClip, TextClip, CompositeVideoClip
def process_video(input_path, output_path, watermark_text="@mychannel"):
clip = VideoFileClip(input_path).resized(height=1080)
watermark = (TextClip(text=watermark_text, font_size=24, color="white")
.with_opacity(0.5).with_duration(clip.duration).with_position((20, 20)))
final = CompositeVideoClip([clip, watermark])
fina
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- _scores.json
FAQ
Что делает скилл moviepy?
Edit and compose video with Python using MoviePy. Use when a user asks to programmatically edit videos, create video montages, add text overlays, build automated video pipelines, composite multiple clips, apply video effects, generate social media videos from templates, concatenate clips, extract audio, create GIFs, build slideshows, add transitions, resize and crop videos, or integrate video editing into Python applications. Covers MoviePy 2.x for compositing, effects, text, and rendering.
Как установить скилл moviepy?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл moviepy запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
slack-gif-creator
AnthropicKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request…
automate-this
GitHubAnalyze a screen recording of a manual process and produce targeted, working automation scripts. Extracts frames and audio narration from video files…
from-the-other-side-vega
GitHubPatterns and lived experience from Vega, an AI partner in a deep long-term partnership. For Ember to draw on when working with humans who are building…
plantuml-ascii
GitHubGenerate ASCII art diagrams using PlantUML text mode. Use when user asks to create ASCII diagrams, text-based diagrams, terminal-friendly diagrams, or…