/media-os:media-moviepy [script.py]from media-os
Programmatic video editing in Python with MoviePy: build videos from clips, text overlays, transitions, compositing, audio manipulation, and frame-by-frame effects via numpy.
Ships in media-os. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Programmatic, Python-first non-linear video editing. MoviePy wraps ffmpeg for I/O but operates on frames in numpy, so it wins on readability and data-driven pipelines — not on throughput. Reach for it when you need logic, not a faster transcode.
VideoFileClip → concatenate_videoclips → write_videofile (Step 2, 3).TextClip on top of video via CompositeVideoClip (Step 3, needs ImageMagick).clip.image_transform(lambda img: ...) (Step 3).clip.subclipped(10, 20) (Step 2).clip.resized(width=1280), clip.cropped(...), clip.with_speed_scaled(2.0).geq would be painful).ffmpeg direct is 10–50× faster.pip install moviepy # MoviePy 2.x (2024+); this is the current API
# pip install moviepy==1.0.3 # pin to 1.x ONLY if you have legacy code using set_*/subclip/resize
python -c "import moviepy; print(moviepy.__version__)"
Dependencies pulled in: numpy, decorator, proglog, Pillow, imageio, imageio-ffmpeg (ships an ffmpeg binary). Not pulled in: ImageMagick — you must install it yourself if you want TextClip.
# macOS
brew install imagemagick
# Debian/Ubuntu
sudo apt-get install imagemagick
# Then UNBLOCK pango/text reads in the ImageMagick policy:
# sudo sed -i 's/<policy domain="path" rights="none" pattern="@\*"/<!--&-->/' /etc/ImageMagick-6/policy.xml
# (or /etc/ImageMagick-7/policy.xml — remove the PATTERN / TEXT deny rules)
Quick sanity check — use the bundled script:
python ${CLAUDE_SKILL_DIR}/scripts/moviepy_cli.py check
Load, trim, and combine source clips. MoviePy 2.x uses with_* setters (functional, return a new clip) and past-tense transforms (resized, cropped, subclipped, rotated).
from moviepy import VideoFileClip, AudioFileClip, ImageClip, ColorClip, concatenate_videoclips
a = VideoFileClip("intro.mp4")
b = VideoFileClip("body.mp4").subclipped(0, 30) # first 30 s
c = VideoFileClip("outro.mp4").resized(width=1280) # keep aspect ratio
bg = ColorClip(size=(1920, 1080), color=(0, 0, 0), duration=3)
logo = ImageClip("logo.png", duration=5).with_position(("right", "top"))
timeline = concatenate_videoclips([a, b, c], method="compose") # "compose" allows different sizes
timeline = timeline.with_audio(AudioFileClip("music.mp3")
.with_audio_fadein(2)
.with_audio_fadeout(2))
Core per-clip operations:
| Op | MoviePy 2.x |
|---|---|
| Trim | clip.subclipped(start, end) |
| Resize | clip.resized(width=1280) / clip.resized(0.5) |
| Crop | clip.cropped(x1=100, y1=100, x2=1820, y2=980) |
| Rotate | clip.rotated(90) |
| Speed | clip.with_speed_scaled(factor=2.0) |
| Reverse | clip.reversed() |
| Video fade | clip.with_fadein(1).with_fadeout(1) |
| Set audio | clip.with_audio(audio_clip) |
| Position (for compositing) | clip.with_position("center") / ("right", 50) |
| Start/end on timeline | clip.with_start(4).with_end(9) |
| Duration | clip.with_duration(5) |
Text overlays — requires ImageMagick (see Step 1):
from moviepy import TextClip, CompositeVideoClip
caption = (TextClip(text="Breaking News", font_size=70, color="white",
font="Arial", stroke_color="black", stroke_width=2,
duration=5)
.with_position(("center", "bottom"))
.with_start(2))
final = CompositeVideoClip([timeline, caption])
Per-frame numpy filter — raw image math, RGB uint8 (H, W, 3):
import numpy as np
mirrored = clip.image_transform(lambda img: img[:, ::-1])
brighter = clip.image_transform(lambda img: np.clip(img * 1.2, 0, 255).astype("uint8"))
Crossfade transition (A ends at 5s, B starts at 4s, 1s overlap):
a_fade = a.with_end(5).with_audio_fadeout(1)
b_fade = b.with_start(4).with_audio_fadein(1).crossfadein(1)
final = CompositeVideoClip([a_fade, b_fade])
Render:
final.write_videofile(
"out.mp4",
codec="libx264", audio_codec="aac",
fps=30, bitrate="5000k",
preset="medium", # ultrafast|fast|medium|slow
threads=4,
ffmpeg_params=["-crf", "18"], # precision knob; overrides bitrate
audio_fps=48000,
remove_temp=True,
)
# audio-only
AudioFileClip("music.mp3").write_audiofile("out.mp3")
# image sequence
final.write_images_sequence("frames/frame_%04d.png", fps=30)
ffprobe -v error -show_streams -of json out.mp4 | head
ffplay out.mp4 # if available
python ${CLAUDE_SKILL_DIR}/scripts/moviepy_cli.py check # sanity check install
Confirm duration, resolution, and presence of audio. If write_videofile finished but the file is 0 bytes or lacks audio, check the temp_audiofile cleanup and the audio_codec argument.
subclip() → subclipped(), set_position → with_position, set_duration → with_duration, set_start → with_start, resize → resized, crop → cropped, rotate → rotated, fx(vfx.speedx, 2) → with_speed_scaled(2). If code uses the old names, either upgrade the code or pip install moviepy==1.0.3. Always: python -c "import moviepy; print(moviepy.__version__)".moviepy package now: from moviepy import VideoFileClip, TextClip, CompositeVideoClip. In 1.x it was from moviepy.editor import ....OSError: MoviePy Error: creation of None failed. Install it, and on Debian/Ubuntu/Docker you must edit /etc/ImageMagick-6/policy.xml (or -7/) to remove or comment out the domain="path" rights="none" pattern="@*" and the TEXT/PATTERN deny rules, or rendering from strings will fail.ImageClip, composite. Slower to code but zero system-dependency headache.write_videofile writes a temp WAV in $TEMP. Pass remove_temp=True (default True in 2.x) and a specific temp_audiofile="/tmp/foo.m4a" if you hit disk-space issues.write_videofile(threads=4). Doesn't parallelize frame math, only x264.write_videofile(audio_fps=48000).image_transform gets BGR — convert or expect wrong colors.clip.mask is slow. Avoid using mask clips unless you actually need transparency; prefer compositing opaque layers.concatenate_videoclips(method="chain") only works when all clips share size / fps / audio layout. Use method="compose" to be safe (pads to largest size).from moviepy import VideoFileClip, AudioFileClip, concatenate_videoclips
clips = [VideoFileClip(p).with_fadein(0.5).with_fadeout(0.5) for p in ["a.mp4", "b.mp4", "c.mp4"]]
final = concatenate_videoclips(clips, method="compose")
final = final.with_audio(AudioFileClip("bg.mp3").with_audio_fadein(1).with_audio_fadeout(2))
final.write_videofile("story.mp4", codec="libx264", fps=30, threads=4)
from moviepy import VideoFileClip, TextClip, ImageClip, CompositeVideoClip, concatenate_videoclips
intro, outro = VideoFileClip("intro.mp4"), VideoFileClip("outro.mp4")
body = VideoFileClip("footage.mp4").subclipped(0, 20).resized(width=1920)
lt = (TextClip(text="DATELINE — APRIL 17", font_size=48, color="white",
font="Arial", bg_color="red", duration=body.duration)
.with_position(("left", 950)))
composited = CompositeVideoClip([body, lt])
concatenate_videoclips([intro, composited, outro], method="compose") \
.write_videofile("news.mp4", codec="libx264", fps=30, bitrate="8000k")
from moviepy import ImageClip, concatenate_videoclips
from pathlib import Path
clips = [ImageClip(str(p), duration=3).resized(height=1080).with_fadein(0.5).with_fadeout(0.5)
for p in sorted(Path("photos").glob("*.jpg"))]
concatenate_videoclips(clips, method="compose").write_videofile(
"slideshow.mp4", codec="libx264", fps=30)
import numpy as np
from moviepy import VideoFileClip
def sepia(img):
m = np.array([[0.393,0.769,0.189],[0.349,0.686,0.168],[0.272,0.534,0.131]])
return np.clip(img @ m.T, 0, 255).astype("uint8")
VideoFileClip("in.mp4").image_transform(sepia).write_videofile("sepia.mp4", codec="libx264")
python ${CLAUDE_SKILL_DIR}/scripts/moviepy_cli.py concat --inputs a.mp4 b.mp4 c.mp4 --output out.mp4
python ${CLAUDE_SKILL_DIR}/scripts/moviepy_cli.py subclip --input in.mp4 --start 10 --end 20 --output cut.mp4
python ${CLAUDE_SKILL_DIR}/scripts/moviepy_cli.py text-overlay --input in.mp4 --output captioned.mp4 --text "Hello" --position bottom
python ${CLAUDE_SKILL_DIR}/scripts/moviepy_cli.py template --config news.json
AttributeError: 'VideoFileClip' object has no attribute 'subclip' (or set_position, resize, ...)Cause: MoviePy 2.x renamed methods. You are on 2.x but the code uses 1.x names.
Solution: Rename (subclip → subclipped, set_position → with_position, resize → resized, etc.) or pip install moviepy==1.0.3.
ModuleNotFoundError: No module named 'moviepy.editor'Cause: 2.x dropped moviepy.editor.
Solution: from moviepy import VideoFileClip, TextClip, CompositeVideoClip, concatenate_videoclips — import from top-level.
OSError: MoviePy Error: creation of None failed when using TextClipCause: ImageMagick missing, or its policy.xml disallows reading from strings.
Solution: Install ImageMagick; edit /etc/ImageMagick-{6,7}/policy.xml to comment out the rights="none" pattern="@*" and TEXT/PATTERN deny rules. On macOS brew install imagemagick generally works out of the box.
Cause: Single-threaded x264, heavy per-frame Python.
Solution: Bump threads=4, use preset="fast" or "ultrafast" for drafts, move heavy logic to numpy (vectorize out of Python loops), or render → re-encode with pure ffmpeg. If you are doing plain concat/trim, switch to ffmpeg -c copy.
Cause: Missing audio_codec, sample-rate mismatch, or muted source.
Solution: write_videofile("out.mp4", codec="libx264", audio_codec="aac", audio_fps=48000). Verify the source clip actually has audio: VideoFileClip("in.mp4").audio is None.
MemoryError on a long renderCause: Whole pipeline held in RAM. Solution: Split the timeline into segments, render each to disk, ffmpeg-concat the results.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
moviepy, video-editing, python-video, numpy, ffmpeg, compositing
110 skills in this plugin
/audio-coreaudioManipulate macOS audio at the Core Audio HAL layer: afinfo (audio file metadata), afplay (play), afconvert (convert format/rate/bit-depth/channel layout), say (TTS), SwitchAudioSource (change default input/output/system device — brew install switchaudio-osx), audiodevice CLIs (npm/Go variants), AppleScript via osascript to drive System Preferences Sound. HAL plugins at /Library/Audio/Plug-Ins/HAL/ load virtual drivers (BlackHole 2ch/16ch/64ch, Loopback, Background Music). Aggregate Device (drift-corrected multi-in) and Multi-Output Device via Audio MIDI Setup.app or AudioHardwareCreateAggregateDevice. Use when the user asks to change default macOS audio device, route audio between apps on Mac, install BlackHole, build an Aggregate Device, convert audio files with afconvert, or script Mac audio from the terminal.
/audio-jackRoute professional low-latency audio with JACK Audio Connection Kit (jackaudio.org): jackd server (ALSA/CoreAudio/PortAudio/ASIO backends), jack_control (D-Bus JACK2 config), jack_lsp (list ports/connections), jack_connect/jack_disconnect (manage links), jack_cpu_load, jack_samplerate, jack_bufsize (runtime period size), jack_transport, jack_rec (multi-channel WAV recording), jack_iodelay (round-trip latency), jack_wait, jack_midi_dump. JACK1 C maintenance vs JACK2 C++ multicore. Modern Linux swaps jackd for PipeWire's libjack shim — same client API. JackTrip for uncompressed multichannel UDP over the Internet. Use when the user asks to run a JACK server, connect audio clients, measure roundtrip latency, record from JACK ports, set JACK period size, or bridge JACK over the network with JackTrip.
/audio-pipewireRoute and introspect Linux audio/video/MIDI graphs with PipeWire: pw-cli (interactive object/module control), pw-dump (full graph JSON with --monitor), pw-link (list/create/destroy port links), pw-cat / pw-play / pw-record (playback+record), pw-top (real-time DSP load + xrun viewer), pw-metadata (shared metadata store), pw-loopback (source/sink bridges), pw-midiplay/pw-midirecord, pw-jack (JACK client compat shim), pw-mon, pw-profiler. WirePlumber session manager handles routing/defaults/profiles. Replaces PulseAudio (via pipewire-pulse) and JACK (via libjack.so shim) simultaneously. Use when the user asks to route Linux audio, link two apps, list audio devices on Linux, create a loopback, record system audio, monitor the audio graph, or set up a virtual audio device on modern Linux.
/audio-wasapiManipulate Windows audio via WASAPI (learn.microsoft.com/coreaudio): SoundVolumeView + svcl.exe (NirSoft — set default device, per-app volumes, save/load profiles), AudioDeviceCmdlets PowerShell module (Get-AudioDevice, Set-AudioDevice, Get-AudioDevicePlaybackMute), nircmd setdefaultsounddevice. Shared mode (Windows engine resamples all streams to endpoint fixed format) vs Exclusive mode (bit-perfect, audiophile, ~sub-3ms latency with IAudioClient3 + event-driven callbacks). WASAPI then MMDevice then Audio Engine (audiodg.exe) then WDM/KS. ASIO is Steinberg's parallel stack bypassing Windows audio. Virtual audio devices: VB-Audio Virtual Cable, VoiceMeeter/Banana/Potato. Use when the user asks to change Windows default audio device, route app audio, use VoiceMeeter, install VB-Cable, set a specific device from PowerShell, or enable exclusive-mode low-latency output.
/cv-mediapipeGoogle MediaPipe Tasks API (current supported, NOT legacy mediapipe.solutions): Vision Tasks (Face Detector, Face Landmarker, Face Stylizer, Hand Landmarker, Gesture Recognizer, Pose Landmarker, Holistic Landmarker, Object Detector, Image Classifier, Image Segmenter, Interactive Segmenter, Image Embedder, Image Generator), Audio Tasks (Audio Classifier), Text Tasks (Text Classifier, Text Embedder, Language Detector), GenAI Tasks (LLM Inference — on-device Gemma/Phi-2/Falcon/StableLM). Three run modes: IMAGE, VIDEO, LIVE_STREAM (async). Python: mediapipe.tasks.python.vision/audio/text/genai. Docs at ai.google.dev/edge/mediapipe/solutions. Model Maker for transfer learning. Use when the user asks to detect pose/face/hand landmarks, classify an image, run a body-pose model, segment people, recognize gestures, do on-device LLM inference via MediaPipe, or build a mobile/embedded CV pipeline.
/cv-opencvComputer vision on images + video with OpenCV (docs.opencv.org/4.x/): core (Mat / ndarray, linalg), imgproc (filtering, morphology, geometric transforms, color conv, histograms, contours), imgcodecs (imread/imwrite — PNG, JPEG, TIFF, WebP, EXR), videoio (VideoCapture / VideoWriter — FFMPEG, GStreamer, V4L2, AVFoundation, MSMF backends), calib3d (camera calibration, stereo, solvePnP, homography), features2d (ORB, AKAZE, BRISK, KAZE, SIFT), objdetect (FaceDetectorYN, FaceRecognizerSF, HOG, ArUco, QRCode), dnn (ONNX/TF/Caffe/Darknet, CUDA + OpenVINO + Vulkan backends, model zoo at github.com/opencv/opencv_zoo), photo (inpainting, denoising, HDR Debevec/Robertson), stitching (panorama), video (optical flow Farneback/LK/DIS, BackgroundSubtractorMOG2/KNN, tracking KCF/CSRT/MIL/Nano/Vit/DaSiamRPN). Python-first via cv2. Use when the user asks to detect faces, track objects, run YOLO inference, capture + process webcam frames, calibrate a camera, stitch a panorama, or use OpenCV from Python/C++.
npx claudepluginhub damionrashford/media-os --plugin media-osOther plugins' skills for the same job