Agent skill

Video Compressor

by cat-xierluo in cat-xierluo/legal-skills

视频压缩与静默片段剪切工具。使用 FFmpeg CRF 模式压缩视频,适配屏幕录制/课件场景;支持检测并去除静默静止片段。自动检测硬件与源码率并选择最优编码方案(高码率源走 VideoToolbox 硬件加速,低码率录屏自动改用 x264 CRF 自适应编码)。本技能应在用户需要压缩视频、减小视频大小、去除视频空档时使用。不要用于:视频剪辑、音频提取、格式转换。

MITAuto-check passedMedia & Creative

Install Video Compressor

skills CLI
$ npx skills add cat-xierluo/legal-skills --skill video-compressor -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install cat-xierluo/legal-skills video-compressor --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/cat-xierluo/legal-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/video-compressor .claude/skills/video-compressor && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
video-compressor
GitHub stars
717
Token cost
~1.5k tokens
SKILL.md length
358 words
Files
7 (incl. scripts, references)
Skills in repo
62
Repo updated
First seen
Licence
MIT

At a glance

视频压缩与静默片段剪切工具。使用 FFmpeg CRF 模式压缩视频,适配屏幕录制/课件场景;支持检测并去除静默静止片段。自动检测硬件与源码率并选择最优编码方案(高码率源走 VideoToolbox 硬件加速,低码率录屏自动改用 x264 CRF 自适应编码)。本技能应在用户需要压缩视频、减小视频大小、去除视频空档时使用。不要用于:视频剪辑、音频提取、格式转换。

  • Works in 7 steps: 确认输入 → 确认参数 → 执行压缩 → …
  • Tasks that involve Video production
  • SKILL.md covers 适用场景, 功能模式, 默认工作流(压缩模式) and 静默/静止片段剪切工作流, plus 6 more sections
  • Runs Python scripts from its folder; calls python3, brew and ffmpeg

What it does

Video Compressor is an agent skill from cat-xierluo/legal-skills. 视频压缩与静默片段剪切工具。使用 FFmpeg CRF 模式压缩视频,适配屏幕录制/课件场景;支持检测并去除静默静止片段。自动检测硬件与源码率并选择最优编码方案(高码率源走 VideoToolbox 硬件加速,低码率录屏自动改用 x264 CRF 自适应编码)。本技能应在用户需要压缩视频、减小视频大小、去除视频空档时使用。不要用于:视频剪辑、音频提取、格式转换。

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files, including scripts and reference files (for example `CHANGELOG.md`, `references/config.md` and `scripts/compress.py`).

It sits in Media & Creative, covering Video production. It works with FFmpeg. The licence is MIT.

When your agent uses it

  • Tasks that involve Video production

Example prompts

  • “/video-compressor”

Requirements

  • Python 3

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. 确认输入
  2. 确认参数
  3. 执行压缩
  4. 输出报告
  5. 执行剪切
  6. 理解输出
  7. 参数说明

What it can do on your machine

Read from SKILL.md and the folder at commit c077fcc. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 3 files in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python3
    • brew
    • ffmpeg

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Video Compressor loads about 1.5k tokens when it runs, and up to ~3k if it reads all its reference files. Until then it costs about 50 tokens; SKILL.md has 358 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~50
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from cat-xierluo/legal-skills at commit c077fcc, republished under its MIT licence (© cat-xierluo). 358 words, ~1,503 tokens.

Download SKILL.mdSave it as .claude/skills/video-compressor/SKILL.md (or your agent's skills folder). This skill also uses 6 other files; get the full folder from GitHub.
name
video-compressor
description
视频压缩与静默片段剪切工具。使用 FFmpeg CRF 模式压缩视频,适配屏幕录制/课件场景;支持检测并去除静默静止片段。自动检测硬件与源码率并选择最优编码方案(高码率源走 VideoToolbox 硬件加速,低码率录屏自动改用 x264 CRF 自适应编码)。本技能应在用户需要压缩视频、减小视频大小、去除视频空档时使用。不要用于:视频剪辑、音频提取、格式转换。
author
杨卫薪律师(微信ywxlaw)
homepage
https://github.com/cat-xierluo/legal-skills
version
1.5.2
license
MIT

video-compressor — 视频压缩工具

使用 FFmpeg 将视频文件压缩为低比特率 MP4,减小文件体积的同时保留清晰的音频。自动检测硬件并选择最优编码方案(Apple Silicon 默认使用 VideoToolbox 硬件加速)。

适用场景

  • 视频文件过大,只需保留音频信息,视频画面作为辅助参考
  • 批量压缩目录下多个视频文件
  • 降低视频比特率以节省存储空间
  • 去除视频中间的静默静止片段(如休息时间、黑屏、无声空档),同时保留被剪片段供复查

功能模式

本技能支持两种工作模式:

模式一:压缩(默认)

将视频压缩为低比特率 MP4,减小文件体积。

模式二:静默/静止片段剪切

检测并去除视频中同时满足以下条件的片段:

  1. 音频静默(无声)
  2. 画面静止(连续帧几乎无变化,如休息时无操作、黑屏)

适用于:课程录制中途休息、会议室无人时的静默等待等无效内容。

默认工作流(压缩模式)

1. 确认输入

确认用户提供的文件路径或目录路径。支持以下视频格式:

.mp4 .mov .avi .mkv .webm .flv .wmv .ts

2. 确认参数

默认配置(大多数场景无需调整):

参数默认值说明
CRF 质量值23自适应质量,越小质量越高(仅软件编码)
最大码率2500kVBV 码率上限
音频比特率96kAAC 语音音质
编码预设veryfast速度与压缩比平衡(仅软件编码)
编码器自动检测Apple Silicon 默认 HEVC VT,其他 x264
并发线程自动VideoToolbox 默认 1(共享硬件编码器,多并发反而慢),软件编码默认 ≤8
输出后缀_compressed输出文件名后缀

详细配置说明见 references/config.md。

3. 执行压缩
bash
# 单个文件
python3 scripts/compress.py -i <文件路径>

# 多个文件(并发压缩)
python3 scripts/compress.py -i <文件1> <文件2> <文件3>

# 整个目录
python3 scripts/compress.py -i <目录路径>

# 混合:文件 + 目录
python3 scripts/compress.py -i <文件1> <目录路径> <文件2>

指定自定义参数:

bash
python3 scripts/compress.py -i <文件1> <文件2> --crf 28 -a 64k --preset medium -j 2
4. 输出报告

压缩完成后输出每个文件的结果:

text
文件名                    原始大小    压缩后大小   压缩比
video1.mp4                120.5 MB    28.3 MB     76.5%
─────────────────────────────────────────────────
合计                       205.7 MB    47.4 MB     77.0%

静默/静止片段剪切工作流

何时使用

当用户提到以下场景时使用此模式:

  • 视频中间有休息时间,需要剪掉
  • 视频有长时间静止/无声的片段
  • 去除录制中的空档、静默、黑屏
1. 执行剪切
bash
python3 scripts/trim_silences.py -i <视频文件路径>

使用默认参数(同时检测静音+静止,最短3秒才计入)。

指定自定义参数:

bash
# 仅检测静音片段(不考虑画面是否静止)
python3 scripts/trim_silences.py -i <路径> --mode silence

# 仅检测画面静止片段(不考虑是否有声音)
python3 scripts/trim_silences.py -i <路径> --mode static

# 自定义阈值:更严格的静默检测
python3 scripts/trim_silences.py -i <路径> --noise-db -40 --min-duration 5
模式选择建议
视频类型推荐模式说明
课程录制休息时both同时满足静音+静止,不误剪
会议无人时段both 或 static若全程有空调白噪声用 both
比赛/电影解说(全程有声音)static仅剪画面静止部分
监控录像(画面固定)static几乎不需要音频
2. 理解输出

剪切完成后,输出:

文件说明
原文件名_trimmed.mp4精剪版(去除了目标片段)
原文件名_cuts/存放被剪片段的目录
原文件名_cuts/_report.json被剪片段的时间戳报告

被剪片段目录中,每个片段保存为一个独立的 MP4 文件,文件名包含起止时间,方便复查。

3. 参数说明
参数默认值说明
--noise-db-30静默检测分贝阈值,越小越严格
--scene-threshold0.05画面静止阈值 0~1,越小越严格(轻微页面变化可接受)
--min-duration120最短片段时长(秒),默认2分钟,仅剪掉长片段
--modeboth检测模式:both=同时静音+静止,silence=仅静音,static=仅画面静止
--crf23CRF 质量值
--maxrate2500k最大码率限制
--bufsize2500kVBV 缓冲区大小
--audio-bitrate96k输出音频比特率
--presetveryfast编码预设
--codec自动检测编码器选择(hevc_vt / h264_vt / x264 / x265 / x264_fast)

硬件加速

本工具自动检测系统硬件并选择最优编码方案:

平台编码器速度提升(实测)输出格式说明
Apple Silicon (M1/M2/M3/M4)hevc_videotoolbox2-5x(1080p60) / 5-15x(720p30)HEVC/H.265自动使用硬件编码
Apple Silicon (备用)h264_videotoolbox2-4x(1080p60) / 4-10x(720p30)H.264HEVC 不可用时的回退
其他平台libx2641x 实时H.264标准软件编码

速度提示:上述数值为实际测试参考范围,实际速度受分辨率、帧率、画质参数、系统负载影响。1080p60 高帧率场景下 VideoToolbox 实际约 2-5x 实时(而非 5-15x),3 小时视频约需 50 分钟。

录屏/课件源码率陷阱(v1.5.0 已自动化):压缩前先 ffprobe 查源文件 bit_rate。硬件路径(hevc_vt/h264_vt)在 hw_detect.py 中写死目标码率 2000k 且忽略 --crf/--maxrate 参数;源总码率 ≤3 Mbps(录屏/课件特征)时脚本自动选用 x264 CRF 自适应编码并打印提示,高码率源仍走硬件路径,--codec 显式指定可覆盖自动选择。CRF 自适应对静止画面几乎不耗码率,实测录屏压缩比 80-88%、速度 12-20x 实时。手动估算可用 60 秒采样:ffmpeg -ss <中段> -t 60 -i 输入 -c:v libx264 -crf 23 ... 看采样大小推算全片。

启动时自动打印检测结果,如:

硬件检测: Apple Silicon (10 核 / 64 GB)
编码器: HEVC VideoToolbox (硬件加速) — 实际 1080p60 约 2-5x 实时
FFmpeg: 9.0 (VideoToolbox 支持: H.264 + HEVC)

手动指定编码器:

bash
python3 scripts/compress.py -i <路径> --codec hevc_vt   # 强制 HEVC 硬件编码
python3 scripts/compress.py -i <路径> --codec h264_vt   # 强制 H.264 硬件编码
python3 scripts/compress.py -i <路径> --codec x264      # 强制软件编码
python3 scripts/compress.py -i <路径> --codec x265      # 软件 HEVC 编码(高压缩)

可选编码器:hevc_vt h264_vt x264 x265 x264_fast

Show full SKILL.md (107 more words)Show less

长视频与 detach 模式

对超过 30 分钟的视频,建议加 --detach 启动:

bash
python3 scripts/compress.py -i <长视频.mp4> --codec hevc_vt --detach

--detach 行为:

  • 脚本启动 ffmpeg 后立即返回 PID,不等待完成
  • ffmpeg 进程脱离脚本会话组(start_new_session),脚本被杀不影响编码
  • 日志写入 /tmp/ffmpeg_<视频名>_<时间戳>.log,可用 tail -f 跟踪

故障排查

ffmpeg 二进制启动崩溃(dyld Library not loaded)

症状:脚本启动后立即报"dyld Symbol not found"或"Library not loaded"。

原因:典型场景是 brew upgrade 升级某个依赖库(如 x265)后,ffmpeg 未重新链接;ffmpeg 二进制仍在引用旧版本符号。

修复:

bash
brew upgrade ffmpeg        # 让 ffmpeg 重新链接到新依赖
# 或
brew reinstall ffmpeg      # 完全重装

新版脚本会在启动时主动检测 ffmpeg 健全性,崩溃时立即输出诊断和修复命令,不再静默 fallback。

完整 stderr 日志

失败时完整 ffmpeg 日志保存在 /tmp/ffmpeg_<视频名>_<时间戳>.log,不再被截断丢失关键诊断信息。

硬约束

  • 不覆盖原文件:输出文件始终添加后缀
  • 不静默覆盖旧输出:输出文件已存在时自动改用 _compressed_2 等序号递增,--overwrite 才允许覆盖
  • 输出到同目录:精剪版和被剪片段目录都与原文件在同一目录
  • 保留音频质量:音频使用 AAC 编码,默认 96k
  • 固定 MP4 输出:所有输出文件均为 MP4 格式(硬件编码 HEVC/H.264 + AAC,软件编码 x264 + AAC)
  • 长视频一律 --detach:预期超过几分钟的编码必须加 --detach(ffmpeg 脱离进程组,会话超时/终止不影响编码);同步模式或终端托管后台都实测被杀过,残缺输出无 moov atom 不可播放

依赖

依赖版本要求安装方式
ffmpeg≥ 5.0(推荐 ≥ 7.0 for VideoToolbox -q:v)brew install ffmpeg
Python≥ 3.9(脚本已兼容系统自带 python3)系统自带或 brew install python

与其他技能配合

  • 可与 universal-media-downloader 配合:下载视频后压缩节省空间
  • 可与 local-asr / tingwu-asr 配合:压缩后再转录,减少文件传输时间

© cat-xierluo, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 6 other files (scripts, references) in skills/video-compressor of cat-xierluo/legal-skills.

  • SKILL.md
  • CHANGELOG.md
  • LICENSE.txt
  • references/config.md
  • scripts/compress.py
  • scripts/hw_detect.py
  • scripts/trim_silences.py

Open the folder on GitHubat commit c077fcc

Compare with similar skills

Video Compressor next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Video Compressor compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Video Compressor this skillcat-xierluo/legal-skills717—~1.5kAutomated safety check: PassMIT
Video Understandcalesthio/OpenMontage66k—~841Automated safety check: PassAGPL-3.0
HyperFrames Video Entry Pointheygen-com/hyperframes59k3 repos~5.2kAutomated safety check: PassApache-2.0
Video Shotseternityspring/reelbench-skills8721 repos~1.8kAutomated safety check: NotesApache-2.0
Mobile Demo Film Editorsuperset-sh/superset15k—~1.8kAutomated safety check: PassCustom licence
Video Editcalesthio/OpenMontage66k—~855Automated safety check: NotesAGPL-3.0

Similar skills

  • Video Understand

    calesthio/OpenMontage

    Understand video content locally using ffmpeg frame extraction and Whisper transcription.

    66k GitHub stars~841 tokensUpdated 6 days ago
    Media & CreativeAuto-check passed
  • HyperFrames Video Entry Point

    heygen-com/hyperframes

    Entry point for making, editing and rendering videos from HTML compositions with HyperFrames, routing each request to the right workflow.

    59k GitHub starsUsed in 3 repos~5.2k tokens
    Media & CreativeAuto-check passed
  • Video Shots

    eternityspring/reelbench-skills

    拉片:把一条成片拆成逐镜头的分析表——每个镜头的时长、景别、类别、运镜、画面. An agent skill from eternityspring/reelbench-skills.

    872 GitHub starsUsed in 1 repo~1.8k tokens
    Media & CreativeAuto-check: notes
  • Mobile Demo Film Editor

    superset-sh/superset

    Edits real mobile screen recordings into a configurable demo video with phone framing, title cards, cutaways and an end card, using a bundled renderer.

    15k GitHub stars~1.8k tokensUpdated today
    Media & CreativeAuto-check passed
  • Video Edit

    calesthio/OpenMontage

    Edit videos locally using ffmpeg. An agent skill from calesthio/OpenMontage.

    66k GitHub stars~855 tokensUpdated 6 days ago
    Media & CreativeAuto-check: notes
  • Lemo-Opuscar Short Film Director

    lemomo-ai/lemo-opuscar

    Directs a short film made entirely in code in one of the Lemo-Opuscar library's named visual styles, from fetching the library through production and delivery.

    1.4k GitHub stars~596 tokensUpdated yesterday
    Media & CreativeAuto-check passed

More from cat-xierluo/legal-skills

All 62 skills in this repo
  • Elements-Style Complaint Generator

    cat-xierluo/legal-skills

    Converts a lawyer's ordinary complaint or a described case into the Supreme People's Court's elements-style Word template, with layout checks on the result.

    717 GitHub stars~2.5k tokensUpdated yesterday
    Auto-check: notes
  • Lecture Performance Review

    cat-xierluo/legal-skills

    Analyzes raw lecture transcripts for verbal tics, pacing, time use and promise follow-through, with optional slide-by-slide comparison and cross-session tracking.

    717 GitHub stars~2.2k tokensUpdated yesterday
    Auto-check passed
  • De-AI Polish for Chinese Articles

    cat-xierluo/legal-skills

    Detects and rewrites machine-sounding patterns in the body text of Chinese articles while keeping the author's facts, headings and legal terms intact.

    717 GitHub stars~2.9k tokensUpdated yesterday
    Auto-check passed
  • GitHub Star Manager

    cat-xierluo/legal-skills

    Finds GitHub projects mentioned in articles or screenshots and stars them, tracks updates to your starred repos, and builds an HTML dashboard to browse them.

    717 GitHub stars~2k tokensUpdated yesterday
    Auto-check: notes
  • Legal Harness Initializer

    cat-xierluo/legal-skills

    Sets up or incrementally updates AGENTS.md and CLAUDE.md for legal professionals, with a minimal safety baseline and a check that a new session loads and follows the rules.

    717 GitHub stars~2.3k tokensUpdated yesterday
    Auto-check passed
  • Moot Court Simulation Builder

    cat-xierluo/legal-skills

    Chinese-language skill that organizes a case file into a multi-role mock trial with judge, parties and clerk, producing a transcript, issue review and a to-strengthen list.

    717 GitHub stars~1.4k tokensUpdated yesterday
    Auto-check passed

Works with

Questions about Video Compressor

What does Video Compressor do?

视频压缩与静默片段剪切工具。使用 FFmpeg CRF 模式压缩视频,适配屏幕录制/课件场景;支持检测并去除静默静止片段。自动检测硬件与源码率并选择最优编码方案(高码率源走 VideoToolbox 硬件加速,低码率录屏自动改用 x264 CRF 自适应编码)。本技能应在用户需要压缩视频、减小视频大小、去除视频空档时使用。不要用于:视频剪辑、音频提取、格式转换。. Video Compressor is an agent skill from cat-xierluo/legal-skills.

When should I use Video Compressor?

Video Compressor fits situations like: tasks that involve Video production.

How do I install Video Compressor in Claude Code?

Run `npx skills add cat-xierluo/legal-skills --skill video-compressor -a claude-code`. Or copy the skill folder (skills/video-compressor in cat-xierluo/legal-skills) into .claude/skills/video-compressor in your project. Claude Code loads it when a task matches its description.

How do I install Video Compressor in Codex?

Run `npx skills add cat-xierluo/legal-skills --skill video-compressor -a codex`. Or copy the skill folder (skills/video-compressor in cat-xierluo/legal-skills) into .agents/skills/video-compressor in your project. Codex loads it when a task matches its description.

Can I use Video Compressor in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add cat-xierluo/legal-skills --skill video-compressor -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/video-compressor, .gemini/skills/video-compressor, .github/skills/video-compressor and .opencode/skills/video-compressor in your project.

What does Video Compressor need to run?

Going by SKILL.md and its folder, Video Compressor needs Python for the scripts in its folder and the command-line tools its instructions call (python3, brew and ffmpeg). Our summary lists: Python 3.

Does Video Compressor access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Video Compressor safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Video Compressor use?

Video Compressor is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Video Compressor use?

About 1.5k tokens (SKILL.md is roughly 6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.5k tokens, read only when the agent opens those files.

What are the alternatives to Video Compressor?

Skills that share tags, products or a category with Video Compressor: Video Understand (calesthio/OpenMontage, 66k stars), HyperFrames Video Entry Point (heygen-com/hyperframes, 59k stars), Video Shots (eternityspring/reelbench-skills, 872 stars) and Mobile Demo Film Editor (superset-sh/superset, 15k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Video Compressor?

cat-xierluo (a GitHub user) maintains it in cat-xierluo/legal-skills, which has 717 GitHub stars. The repository holds 62 skills in this directory. The repository was last updated on October 8, 2026.

Source: cat-xierluo/legal-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.