skills/video-editor/SKILL.md
Expert guidance for video editing with ffmpeg, encoding best practices, and quality optimization. Use when working with video files, transcoding, remuxing, encoding settings, color spaces, or troubleshooting video quality issues.
npx skillsauth add ckorhonen/claude-skills video-editorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Expert guidance for video editing, encoding, and processing with ffmpeg. This skill covers container formats, codecs, encoding best practices, and quality optimization for video production workflows.
Use this skill when:
This distinction is critical. File extensions like .mkv or .mp4 are container formats that package already-compressed streams. The actual compression happens through codecs like H.264, H.265, VP9, or AV1.
| Concept | What It Is | Examples | |---------|------------|----------| | Container | Wrapper that holds video/audio/subtitle streams | MKV, MP4, AVI, MOV, WebM | | Codec | Algorithm that compresses/decompresses video | H.264, H.265/HEVC, VP9, AV1 | | Encoder | Software that implements a codec | x264, x265, libvpx, NVENC |
| Operation | What It Does | Quality Impact | Speed | |-----------|--------------|----------------|-------| | Remuxing | Moves streams between containers without re-compression | None (lossless) | Very fast | | Reencoding | Decodes and re-encodes video with new settings | Always loses quality | Slow |
Rule of thumb: If you only need to change the container format, remux. Only reencode when absolutely necessary.
Video quality measures how closely the output resembles the source. Every processing step moves the video further from the original. There is no way to add quality - only preserve or lose it.
| Myth | Reality | |------|---------| | Higher resolution = better quality | Resolution is just dimensions; a 720p video can look better than a 4K one | | Higher bitrate = better quality | Encoder efficiency matters more; same quality at different sizes is possible | | H.265 is always 50% smaller | Depends on encoder settings; poorly-configured H.265 can be worse than H.264 | | Hardware encoding is fine for quality | Hardware encoders (NVENC, QuickSync) sacrifice quality for speed | | AI upscaling improves quality | Upscaling adds artificial detail that wasn't in the source |
From most to least important:
# MKV to MP4 (preserves all streams)
ffmpeg -i input.mkv -c copy output.mp4
# MP4 to MKV
ffmpeg -i input.mp4 -c copy output.mkv
# Encode with x264, copy audio
ffmpeg -i input.mkv -c:a copy -c:v libx264 -preset slower -crf 20 output.mkv
# Encode with x265
ffmpeg -i input.mkv -c:a copy -c:v libx265 -preset slower -crf 22 output.mkv
# High-quality x264 for animation
ffmpeg -i input.mkv -c:a copy -c:v libx264 -preset slower -crf 18 \
-x264-params bframes=8 output.mkv
# High-quality x265
ffmpeg -i input.mkv -c:a copy -c:v libx265 -preset slower -crf 20 \
-x265-params bframes=8 output.mkv
CRF controls quality vs. file size tradeoff. Lower = higher quality, larger file.
| CRF Range | Quality Level | Typical Use | |-----------|---------------|-------------| | 0 | Lossless | Archival, intermediate | | 15-18 | Visually lossless | High-quality archival | | 19-23 | High quality | General use, streaming | | 24-28 | Medium quality | Web, mobile | | 29+ | Low quality | Previews, thumbnails |
Note: CRF values aren't directly comparable between encoders. x265 CRF 22 ≈ x264 CRF 20.
Presets control encoding speed vs. compression efficiency.
| Preset | Speed | File Size | Use When | |--------|-------|-----------|----------| | ultrafast | Fastest | Largest | Live streaming | | fast | Fast | Large | Quick transcodes | | medium | Moderate | Moderate | Default | | slow | Slow | Smaller | Quality-focused | | slower | Very slow | Even smaller | Recommended for quality | | veryslow | Extremely slow | Smallest | Maximum compression |
Recommendation: Use slower for quality-focused encoding. The difference between slower and veryslow is minimal for significant time cost.
| Tune | Best For | |------|----------| | film | Live-action with film grain | | animation | Cartoons, anime, flat areas | | grain | Preserve film grain | | stillimage | Slideshow, static content | | fastdecode | Playback on weak devices |
# Animation tuning
ffmpeg -i input.mkv -c:v libx264 -preset slower -crf 20 -tune animation output.mkv
Pros:
Cons:
Pros:
Cons:
Some editing software requires constant frame rate MP4. Use this two-pass approach:
# Step 1: Initial remux with timescale adjustment
ffmpeg -i input.mkv -c copy -video_track_timescale 24000 intermediate.mp4
# Step 2: Fix timestamps
ffmpeg -i intermediate.mp4 -c copy \
-bsf:v "setts=dts=1001*round(DTS/1001):pts=1001*round(PTS/1001)" output.mp4
Videos store colors in YCbCr format with metadata specifying:
| Symptom | Likely Cause | |---------|--------------| | Washed out colors | Wrong color range (Limited treated as Full) | | Crushed blacks/blown whites | Wrong color range (Full treated as Limited) | | Greenish/pinkish tint | Wrong color matrix | | Colors look "off" after encode | Mismatched color metadata |
# Explicitly preserve color metadata
ffmpeg -i input.mkv -c:v libx264 -preset slower -crf 20 \
-colorspace bt709 -color_primaries bt709 -color_trc bt709 output.mkv
# Hardsub from external subtitle file
ffmpeg -i input.mkv -vf "subtitles=subs.ass" -c:v libx264 -preset slower -crf 20 output.mkv
# Hardsub from embedded subtitle track
ffmpeg -i input.mkv -vf "subtitles=input.mkv:si=0" -c:v libx264 -preset slower -crf 20 output.mkv
mpv handles complex ASS subtitles (styling, positioning) more accurately:
mpv --no-config input.mkv -o output.mkv \
--audio=no \
--ovc=libx264 \
--ovcopts=preset=slower,crf=20,bframes=8
| Tool | Problem | |------|---------| | Handbrake | Unpredictable settings, hides important options | | Online converters | Quality loss, privacy concerns | | "AI upscalers" | Add fake detail, move further from source | | Windows built-in tools | Poor quality, limited options |
| Practice | Why It's Bad | |----------|--------------| | Unnecessary sharpening | Adds artifacts, moves from source | | Upscaling to higher resolution | Doesn't add real detail | | Multiple reencodes | Quality loss compounds | | Using NVENC for quality | Hardware encoders prioritize speed over quality | | Frame rate interpolation | Adds fake frames with artifacts |
| Tool | Purpose | |------|---------| | ffmpeg | Swiss army knife for video processing | | MediaInfo | Inspect video properties and metadata | | mpv | Superior media player, encoding support | | MKVToolNix | GUI for MKV muxing operations |
| Tool | Purpose | |------|---------| | Aegisub | Subtitle editing | | HandBrake | Simple transcoding (use with caution) | | yt-dlp | Download online videos |
ffmpeg -v error -i file.mkv -f null -mediainfo input.mkv vs. mediainfo output.mkv-async 1 for audio sync correctionffmpeg -i input.mkv -c:a copy -c:v libx265 -preset slower -crf 18 \
-x265-params bframes=8 output.mkv
ffmpeg -i input.mkv -c:a aac -b:a 384k -c:v libx264 -preset slower -crf 18 \
-profile:v high -level 4.2 -pix_fmt yuv420p output.mp4
ffmpeg -i input.mkv -c:a aac -b:a 128k -c:v libx264 -preset fast -crf 28 \
-vf scale=640:-2 output.mp4
# Copy audio stream (no re-encoding)
ffmpeg -i input.mkv -vn -c:a copy output.mka
# Convert to MP3
ffmpeg -i input.mkv -vn -c:a libmp3lame -b:a 320k output.mp3
# Trim from 1:00 to 2:30
ffmpeg -i input.mkv -ss 00:01:00 -to 00:02:30 -c copy output.mkv
documentation
Create or expand an Idea.md / IDEA.md file from a rough description, existing repo, conversation history, notes, or other early-stage product inputs. Use when the user asks to "write an Idea.md", "turn this into an idea file", "capture this product idea", "expand this concept", or wants a repo-grounded concept brief before validation, PRD, or implementation work.
development
Write structured implementation plans from specs or requirements before touching code. Use when given a spec, requirements doc, or feature description, when user says "plan this out", "write a plan for", "how should we implement", or before starting any multi-step coding task.
development
Opinionated constraints for building better interfaces with agents. Use when building UI components, implementing animations, designing layouts, reviewing frontend accessibility, or working with Tailwind CSS, motion/react, or accessible primitives like Radix/Base UI.
development
Design and implement retro/cyberpunk/hacker-style terminal UIs. Covers React (Tuimorphic), SwiftUI (Metal shaders), and CSS approaches. Use when creating terminal aesthetics, CRT effects, neon glow, scanlines, phosphor green displays, or retro-futuristic interfaces.