CommunityCoding & Developmentgithub.com

luk036/compress-video

Compress MP4 files to smaller sizes while preserving visually lossless quality by intelligently reducing framerate and re-encoding with optimal codec/CRF settings

What is compress-video?

compress-video is a OpenCode agent skill that compress MP4 files to smaller sizes while preserving visually lossless quality by intelligently reducing framerate and re-encoding with optimal codec/CRF settings.

Works with~Claude Code~Codex CLI~Cursor✓OpenCode
npx skills add https://github.com/luk036/agent-skills/tree/HEAD/skills/compress-video

Installed? Explore more Coding & Development skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

What I do

I reduce MP4 file sizes by re-encoding with smart defaults. The key insight: most screencasts and talking-head videos are over-encoded at 60fps. Dropping to 30fps and tuning the encoder gives 20-50% file size reduction with no perceptible quality difference.

Bundled scripts: @compress_video.py

When to use me

  • You have an MP4 that's too large for sharing/uploading
  • You recorded a screencast at 60fps and want to cut it in half
  • You need "good enough" quality at a fraction of the size
  • You want to batch-compress training videos, demos, or recordings

How to use

CLI (quick)

# Analyze only
python compress_video.py input.mp4 --probe-only

# Default compression (high quality)
python compress_video.py input.mp4 output.mp4

# Aggressive compression for small files
python compress_video.py input.mp4 -p aggressive

# Screencast (code/EDA tools): drop 60→30fps, stillimage tune
python compress_video.py input.mp4 -p balanced --tune stillimage --fps 30

# Downscale to 1080p
python compress_video.py input.mp4 -p balanced --resolution 1920x1080

Python API

from compress_video import compress, probe

# Probe first
info = probe("input.mp4")
print(f"{info['width']}x{info['height']} @ {info['fps']:.0f}fps")

# Compress with defaults
compress("input.mp4", "output.mp4")

# Compress with aggressive settings
compress("input.mp4", "output.mp4", profile="aggressive",
         fps=24, tune="stillimage")

Requirements

  • Python 3.8+
  • ffmpeg installed and on PATH (with ffprobe)

Compression profiles

Profilex264 CRFx265 CRFUse case
lossless1820Archival, maximum quality
high (default)2325Visually lossless, safe default
balanced2628Good quality, smaller files
aggressive2830Small files, minor gradient loss

Key strategies

TechniqueTypical savingQuality impact
60fps → 30fps~25%Imperceptible for screencasts
H.264 CRF 23 (from CRF 18)~20%None to most viewers
H.264 → H.265 (libx265)~30-40%None (same CRF)
--tune stillimage~5-10%Better for code/slides
Downscale 3200→1920~50%Sharpness loss on zoom

Examples

Reduce a 125 MB screencast by 30-50%

# Quick default run (uses libx264, drops 60→30fps)
python compress_video.py recording.mp4 recording_compressed.mp4
# 125 MB → 97 MB (-22%)

# With stillimage tune (better for code/screencasts)
python compress_video.py recording.mp4 -p balanced --tune stillimage --fps 30
# 125 MB → ~80 MB (-35%)

# Full HEVC with slower preset
python compress_video.py recording.mp4 --codec h265 --preset slow --fps 30
# 125 MB → ~60 MB (-50%, but encodes ~slower)

Batch process a folder

Get-ChildItem *.mp4 | ForEach-Object {
    python compress_video.py $_.Name "$($_.BaseName)_compressed.mp4"
}

Individual skills in this repo

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

Related Skills