Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
gupsammy avatar

Compress Video

  • 34 installs
  • 269 repo stars
  • Updated June 11, 2026
  • gupsammy/claudest

Compress-video is an agent skill that calculates FFmpeg 2-pass video bitrates from a target file size in MB using ffprobe and a Python CLI.

About

Compress-video packages a small Python utility for solo builders who ship screen recordings, trailers, or tutorial footage and need predictable file sizes. Given an input path and `--target-mb`, it probes duration via ffprobe, subtracts the audio bitrate budget (default 128 kbps), and prints the recommended video bitrate in kilobits per second for two-pass FFmpeg `-b:v`. Diagnostics on stderr help verify duration and budget math when encodes overshoot or undershoot targets. The skill assumes FFmpeg/ffprobe are installed locally and fits terminal-driven agent sessions where the coder shells out to encoding pipelines. It is not a full GUI compressor or cloud transcoder—it is a precise bitrate calculator glue step before you run ffmpeg commands.

  • Python helper calc_bitrate.py outputs integer -b:v kbps on stdout for FFmpeg
  • Uses ffprobe JSON for duration and stream/format introspection
  • --target-mb required budget with optional --audio-kbps (default 128)
  • stderr carries source info and budget breakdown for debugging passes
  • Designed for 2-pass FFmpeg encoding workflows

Compress Video by the numbers

  • 34 all-time installs (skills.sh)
  • Ranked #949 of 1,335 Generative Media skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/gupsammy/claudest --skill compress-video

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs34
repo stars269
Security audit3 / 3 scanners passed
Last updatedJune 11, 2026
Repositorygupsammy/claudest

What it does

Compute FFmpeg 2-pass video bitrates from a target output size in MB using ffprobe duration and configurable audio kbps.

Who is it for?

Best when you're automating trailer or demo exports with FFmpeg and target exact upload limits.

Skip if: Users without ffprobe/ffmpeg installed or anyone needing one-click cloud transcoding without shell tools.

When should I use this skill?

User needs video bitrate for 2-pass FFmpeg encoding given input file and --target-mb (optional --audio-kbps).

What you get

You get an integer kbps video bitrate on stdout ready to plug into FFmpeg while stderr explains the size budget split.

  • Integer kbps value for FFmpeg -b:v
  • stderr diagnostic budget breakdown

By the numbers

  • Default audio budget: 128 kbps

Files

SKILL.mdMarkdownGitHub ↗

Video Compress

Compress a video using quality-based (CRF) or size-based (2-pass) encoding.

Process

1. Obtain input file

If the user did not provide a file path, ask for it with AskUserQuestion before proceeding.

2. Probe the source

ffprobe -v quiet -print_format json -show_streams -show_format "$INPUT"

Extract: duration (seconds), file size (bytes), existing video codec, audio bitrate. If ffprobe fails (file not found, not a valid video), report the error and stop — do not attempt encoding.

3. Determine mode from user intent

  • CRF mode (quality-based): user says "without losing quality", "good quality", "make it smaller", or gives no size target
  • 2-pass mode (size-based): user specifies a target ("under 50MB", "around 20MB", "fit on X")

4. Choose codec

H.264 is the safe default: universally device-compatible and fast to encode. Use H.265 only when the size reduction justifies the slower encode time and narrower device support.

  • H.265 / libx265: target is ≤50% of original size, or user asks for "maximum compression" / "HEVC"
  • H.264 / libx264: otherwise — faster encode, wider device compatibility, safe default

5. Construct command

CRF mode:

ffmpeg -i "$INPUT" -c:v libx264 -crf 23 -c:a copy -movflags +faststart "$OUTPUT"
# CRF scale: 18=near-lossless, 23=default quality, 28=aggressive (visible loss)
# -movflags +faststart moves moov atom to front — enables progressive web playback

2-pass mode — calculate video bitrate first:

python3 ${CLAUDE_PLUGIN_ROOT}/skills/compress-video/scripts/calc_bitrate.py "$INPUT" --target-mb "$TARGET_MB"
# Outputs: VIDEO_BITRATE_KBPS (integer)
# Formula: (target_mb * 8192 / duration_s) - audio_bitrate_kbps
# Typical audio budget: 128 kbps
# Exit 1 = target too small (bitrate would go negative); report the error and ask for a larger target before retrying.

# Pass 1 — video analysis only, no output file:
ffmpeg -y -i "$INPUT" -c:v libx264 -b:v ${VIDEO_BITRATE_KBPS}k -pass 1 -an -f null /dev/null

# Pass 2 — final encode with audio:
ffmpeg -i "$INPUT" -c:v libx264 -b:v ${VIDEO_BITRATE_KBPS}k -pass 2 \
  -c:a aac -b:a 128k -movflags +faststart "$OUTPUT"

6. Confirm with user

Show: input file size, chosen codec, mode (CRF value or calculated bitrate), output path. Wait for approval before running.

7. Run and report

After completion: input size → output size, compression ratio (e.g., "73.2 MB → 18.4 MB, 75% reduction").

Key Decisions

  • In CRF mode, use -c:a copy to preserve audio losslessly. In 2-pass mode, audio must be re-encoded (AAC 128k) because pass 1 is video-only — no audio stream is processed.
  • If input is already H.264 and the user only wants to trim or remux, recommend convert-video with -c copy instead — instant and lossless.
  • For H.265 output, substitute libx265 and add -tag:v hvc1 for Apple device compatibility.
  • Clean up ffmpeg2pass-0.log and ffmpeg2pass-0.log.mbtree after 2-pass encoding completes.

Related skills

How it compares

Use as a bitrate math helper ahead of raw FFmpeg CLI—not a replacement for HandBrake presets or hosted media APIs.

FAQ

Who is compress-video for?

Developers and content-focused developers who encode video locally with FFmpeg and want agent-assisted size targeting.

When should I use compress-video?

During Ship when tuning perf before release assets go live, and during Grow when recompressing course or marketing clips to platform size limits.

Is compress-video safe to install?

It runs ffprobe via subprocess on paths you provide; review the Security Audits panel on this page and avoid pointing it at untrusted files on shared machines.

Generative Mediaintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.