AgentSkillsCN

Compress Video

使用 FFmpeg 对视频进行压缩,同时在保留画质的前提下,支持多种编解码器选项与预设配置。

SKILL.md
--- frontmatter
name: Compress Video
version: 0.1.0
description: Compress videos while preserving quality using FFmpeg with multiple codec options and preset configurations
author: skills.md
category: Design & Creative
tags:
  - video
  - ffmpeg
  - compression
  - media
  - batch
  - optimization

Compress Video

Shrink video files without sacrificing quality. This skill uses FFmpeg to intelligently compress videos for Web, Mobile, or Archive storage. It includes smart presets (1080p, 720p), batch processing for folders, and target file size calculations.

Features

  • Smart Presets: "Web" (Balanced), "Mobile" (Small), "Archive" (High Compression), "High Quality" (Near Lossless).
  • Target Size: Automatically calculates the bitrate needed to hit a specific file size (e.g., "50MB").
  • Batch Processing: Compresses entire folders of videos in one go.
  • Codec Choice: Supports H.264 (Compatibility), H.265/HEVC (Efficiency), and VP9 (Web).
  • Resolution Scaling: Easily downscale 4K to 1080p or 720p.

This is a CLI skill. It requires the skills CLI to execute. Install it with npm install -g @hasna/skills, then run the commands below.

Usage

bash
# Compress for web sharing
skills run compress-video -- input.mp4 --preset web

# Compress to a specific size
skills run compress-video -- large_file.mov --target-size 50

# Batch compress a folder
skills run compress-video -- ./raw_footage/*.mp4 --preset mobile --output ./proxies/

Options

OptionDescriptionDefault
<files...>Input video files (positional args)-
--presetCompression profile (web, mobile, archive)web
--target-sizeDesired file size in MB-
--resolutionOutput resolution (1080p, 720p, original)original
--codecVideo codec (h264, hevc, vp9)h264
--crfCustom quality factor (0-51)(varies)
--outputOutput directory(same as input)

Output

  • Compressed Files: Saved to the output directory with a suffix (e.g., _compressed.mp4).
  • Stats: A summary of space saved and compression ratio.

Examples

Archive Footage

bash
skills run compress-video -- project_archive/*.mov \
  --preset archive \
  --codec hevc

Social Media Prep

bash
skills run compress-video -- vlog.mp4 \
  --resolution 1080p \
  --target-size 100

Requirements

  • FFmpeg installed and in PATH.
  • Bun runtime.