video-editor

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.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "video-editor" with this command: npx skills add ckorhonen/claude-skills/ckorhonen-claude-skills-video-editor

Video Editor - FFmpeg & Encoding Expert

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.

When to Use This Skill

Use this skill when:

  • Encoding or transcoding video files
  • Converting between container formats (MKV, MP4, etc.)
  • Optimizing encoding settings for quality or file size
  • Troubleshooting video quality issues
  • Working with color spaces and color matrices
  • Hardsubbing or softsubbing videos
  • Preparing videos for specific platforms or devices
  • Understanding why a video looks wrong after processing

Core Concepts

Container vs. Codec

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.

ConceptWhat It IsExamples
ContainerWrapper that holds video/audio/subtitle streamsMKV, MP4, AVI, MOV, WebM
CodecAlgorithm that compresses/decompresses videoH.264, H.265/HEVC, VP9, AV1
EncoderSoftware that implements a codecx264, x265, libvpx, NVENC

Remuxing vs. Reencoding

OperationWhat It DoesQuality ImpactSpeed
RemuxingMoves streams between containers without re-compressionNone (lossless)Very fast
ReencodingDecodes and re-encodes video with new settingsAlways loses qualitySlow

Rule of thumb: If you only need to change the container format, remux. Only reencode when absolutely necessary.

Quality Principles

What "Quality" Actually Means

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.

Common Misconceptions

MythReality
Higher resolution = better qualityResolution is just dimensions; a 720p video can look better than a 4K one
Higher bitrate = better qualityEncoder efficiency matters more; same quality at different sizes is possible
H.265 is always 50% smallerDepends on encoder settings; poorly-configured H.265 can be worse than H.264
Hardware encoding is fine for qualityHardware encoders (NVENC, QuickSync) sacrifice quality for speed
AI upscaling improves qualityUpscaling adds artificial detail that wasn't in the source

The Encoding Quality Hierarchy

From most to least important:

  1. Encoder settings (CRF, preset, tuning)
  2. Encoder choice (x264/x265 vs. hardware encoders)
  3. Codec (H.265 vs. H.264 vs. VP9)

Quick Reference: FFmpeg Commands

Remux (Change Container, No Quality Loss)

# 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

Basic Encoding

# 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

Quality-Focused Encoding

# 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

Encoding Settings Deep Dive

CRF (Constant Rate Factor)

CRF controls quality vs. file size tradeoff. Lower = higher quality, larger file.

CRF RangeQuality LevelTypical Use
0LosslessArchival, intermediate
15-18Visually losslessHigh-quality archival
19-23High qualityGeneral use, streaming
24-28Medium qualityWeb, mobile
29+Low qualityPreviews, thumbnails

Note: CRF values aren't directly comparable between encoders. x265 CRF 22 ≈ x264 CRF 20.

Preset

Presets control encoding speed vs. compression efficiency.

PresetSpeedFile SizeUse When
ultrafastFastestLargestLive streaming
fastFastLargeQuick transcodes
mediumModerateModerateDefault
slowSlowSmallerQuality-focused
slowerVery slowEven smallerRecommended for quality
veryslowExtremely slowSmallestMaximum compression

Recommendation: Use slower for quality-focused encoding. The difference between slower and veryslow is minimal for significant time cost.

Tune Options

TuneBest For
filmLive-action with film grain
animationCartoons, anime, flat areas
grainPreserve film grain
stillimageSlideshow, static content
fastdecodePlayback on weak devices
# Animation tuning
ffmpeg -i input.mkv -c:v libx264 -preset slower -crf 20 -tune animation output.mkv

Container-Specific Considerations

MKV (Matroska)

Pros:

  • Supports virtually any codec
  • Multiple audio/subtitle tracks
  • Chapter markers
  • Variable frame rate support

Cons:

  • Less compatible with some devices/software
  • Some streaming services don't accept it

MP4

Pros:

  • Universal compatibility
  • Web-friendly
  • Hardware decoder support everywhere

Cons:

  • Limited subtitle format support
  • Stricter codec requirements
  • Constant frame rate expected

Converting MKV to MP4 for Editing Software

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

Color Space & Color Management

Understanding Color Metadata

Videos store colors in YCbCr format with metadata specifying:

  • Color matrix: How to convert YCbCr to RGB (BT.709, BT.601)
  • Color range: Limited (16-235) vs. Full (0-255)
  • Chroma location: Where color samples are positioned

Common Issues

SymptomLikely Cause
Washed out colorsWrong color range (Limited treated as Full)
Crushed blacks/blown whitesWrong color range (Full treated as Limited)
Greenish/pinkish tintWrong color matrix
Colors look "off" after encodeMismatched color metadata

Preserving Color Information

# 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

Hardsubbing (Burning In Subtitles)

Using FFmpeg

# 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

Using mpv (Better for Complex Subtitles)

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

What to Avoid

Tools

ToolProblem
HandbrakeUnpredictable settings, hides important options
Online convertersQuality loss, privacy concerns
"AI upscalers"Add fake detail, move further from source
Windows built-in toolsPoor quality, limited options

Practices

PracticeWhy It's Bad
Unnecessary sharpeningAdds artifacts, moves from source
Upscaling to higher resolutionDoesn't add real detail
Multiple reencodesQuality loss compounds
Using NVENC for qualityHardware encoders prioritize speed over quality
Frame rate interpolationAdds fake frames with artifacts

Recommended Tools

Essential

ToolPurpose
ffmpegSwiss army knife for video processing
MediaInfoInspect video properties and metadata
mpvSuperior media player, encoding support
MKVToolNixGUI for MKV muxing operations

Specialized

ToolPurpose
AegisubSubtitle editing
HandBrakeSimple transcoding (use with caution)
yt-dlpDownload online videos

Troubleshooting

Video Won't Play

  1. Check codec support on target device
  2. Try remuxing to different container
  3. Verify file isn't corrupted: ffmpeg -v error -i file.mkv -f null -

Colors Look Wrong After Encoding

  1. Compare color metadata: mediainfo input.mkv vs. mediainfo output.mkv
  2. Check color range (Limited vs. Full)
  3. Check color matrix (BT.709 vs. BT.601)
  4. Explicitly set color parameters in ffmpeg command

File Size Too Large

  1. Increase CRF (e.g., 20 → 23)
  2. Use slower preset for better compression
  3. Consider x265 for better efficiency
  4. Check if you're unnecessarily encoding (remux instead)

Encoding Takes Forever

  1. Use faster preset (but accept larger file)
  2. Check if hardware encoding is acceptable for your use case
  3. Ensure source isn't being decoded unnecessarily

Audio/Video Out of Sync

  1. Check source file for sync issues first
  2. Use -async 1 for audio sync correction
  3. Try remuxing instead of reencoding

Examples

Archive a Blu-ray Rip

ffmpeg -i input.mkv -c:a copy -c:v libx265 -preset slower -crf 18 \
  -x265-params bframes=8 output.mkv

Prepare for YouTube Upload

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

Quick Preview/Proxy

ffmpeg -i input.mkv -c:a aac -b:a 128k -c:v libx264 -preset fast -crf 28 \
  -vf scale=640:-2 output.mp4

Extract Audio Only

# 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 Without Re-encoding

# Trim from 1:00 to 2:30
ffmpeg -i input.mkv -ss 00:01:00 -to 00:02:30 -c copy output.mkv

Resources

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

markdown-fetch

No summary provided by upstream source.

Repository SourceNeeds Review
General

ios-app-tester

No summary provided by upstream source.

Repository SourceNeeds Review
General

freshdesk-api

No summary provided by upstream source.

Repository SourceNeeds Review
General

direct-mail-strategist

No summary provided by upstream source.

Repository SourceNeeds Review
video-editor | V50.AI