media-analysis
ASecurityMeasure deterministic facts about a media file (container, streams, video/audio format, silence, loudness, integrity, scene cuts, timing) with local ffprobe/ffmpeg and return a structured Observation. Use when a task needs to *know* something about a video or audio file before deciding anything: duration, resolution, fps, CFR/VFR, codecs, channel layout, where the silence is, how loud it is (LUFS / true peak), whether it decodes cleanly, where hard cuts are, where someone speaks (optional ext...
- 13 stars
- 0 votes
- 0 copies
- 2 views
- Added November 6, 2026
Works with
Security analysis
100/100Pro scans all 18 files and shows the line behind each finding
npx -y skills add kajisho5/media-analysis-skill --agent claude-codeAre you the author of media-analysis?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/kajisho5-media-analysis)---
name: media-analysis
description: Measure deterministic facts about a media file (container, streams, video/audio format, silence, loudness, integrity, scene cuts, timing) with local ffprobe/ffmpeg and return a structured Observation. Use when a task needs to *know* something about a video or audio file before deciding anything: duration, resolution, fps, CFR/VFR, codecs, channel layout, where the silence is, how loud it is (LUFS / true peak), whether it decodes cleanly, where hard cuts are, where someone speaks (optional extra `vad`), where the audience applauds or laughs (optional extra `events`), and highlight signals (speech-energy peaks, speaking-rate changes, bursts of cuts). Do not use it to edit, convert, normalise or export media (that is ffmpeg-skill) or to interpret the numbers (that is the agent). Python 3.9 standard library, no cloud, no API keys, no generative AI (speech_regions and audio_events run fixed-weight classifiers from the optional extras `vad` / `events`, shipped in the package).
---
# media-analysis (Skill)
`media-analysis-skill` is an observation Skill, not an agent. It measures; it never interprets, decides, plans or edits.
## Commands
```text
media-analysis probe <input> [--json]
media-analysis analyze <input> --kind <kind> [--kind <kind> ...] [--param key=value ...] [--json] [--dry-run]
[--asset-id ID] [--analysis-id ID] [--timeout S] [--max-analysis-calls N] [--max-total-seconds S]
[--cache-dir DIR] [--workspace DIR] [--allowed-input ROOT ...] [--round N]
media-analysis run <request.json | -> [--json] [--dry-run] [engine options] # canonical machine interface
media-analysis doctor [--json] [--cache-dir DIR] [--workspace DIR]
media-analysis contract [--json] [--check FILE|-]
media-analysis conformance [--json] # AI-video-production-OS SKILL_SPEC.md section 8 self-checks
```
Engine options: `--timeout S`, `--max-analysis-calls N`, `--max-total-seconds S`, `--cache-dir DIR`,
`--cache-policy use|bypass|only`, `--workspace DIR`, `--allowed-input ROOT`.
- With `--json`, stdout is exactly one response document (`media-analysis/response@1`) on success and on failure;
stderr is diagnostics only. Without `--json`, stdout is human-readable text and errors go to stderr.
- Exit code 0 = every result ok; otherwise the first error's exit code (2..13, table in `contract --json` → `errors`).
- `--dry-run` validates the request and input path and prints the analyzer, required capabilities and the
ffprobe / ffmpeg operations it would run; nothing is executed.
## Analysis kinds and parameters
| kind | parameters (defaults) |
|---|---|
| `media_probe` | – |
| `stream_layout` | – |
| `video_format` | `stream` (0) video stream ordinal |
| `audio_format` | `stream` (0) audio stream ordinal |
| `duration` | – |
| `silence` | `stream` (0), `threshold_db` (-40), `min_duration` (0.5 s), `edge_tolerance` (0.1 s) |
| `loudness` | `stream` (0) |
| `integrity` | `max_error_lines` (200) |
| `scene_detection` | `stream` (0), `threshold` (10, scdet score 0-100), `min_scene_duration` (0.5 s) |
| `timing` | `gap_factor` (2.5 × median interval), `av_mismatch_tolerance` (0.1 s), `av_start_offset_tolerance` (0.045 s) |
| `noise_floor` | `stream` (0), `channel` (-1 = all channels, else one channel), `window` (0.05 s), `noise_percentile` (10), `signal_percentile` (95) |
| `edit_style` | `video_stream` (0), `audio_stream` (0), `threshold` (10, scdet score), `min_shot_duration` (0.25 s), `silence_threshold_db` (-50), `silence_min_duration` (0.5 s), `burned_in_interval` (1.0 s between sampled frames; 0 = off) |
| `speech_regions` | `stream` (0), `channel` (-1 = all channels downmixed), `threshold` (0.5), `min_speech_duration` (0.25 s), `min_silence_duration` (0.1 s), `speech_pad` (0.03 s); needs the optional extra `vad`, else `status: UNKNOWN` (ADR-035) |
| `audio_events` | `stream` (0), `channel` (-1 = all channels downmixed), `hop` (0.1 s), `applause_threshold` (0.3), `laughter_threshold` (0.3), `min_duration` (0.5 s), `merge_gap` (1.0 s); applause and laughter spans with a score; needs the optional extra `events`, else `status: UNKNOWN` (ADR-036) |
| `picture_quality` | `stream` (0), `window` (1.0 s), `sample_rate` (5 fps), `width` (640 px), `motion_rate` (10 fps), `motion_width` (160 px), `smooth` (0.5 s); per window: blurdetect sharpness, luma mean / p10 / p90, camera jitter and speed in % of the width; no threshold (ADR-040) |
| `highlight_signals` | `audio_stream` (0), `video_stream` (0), `energy_window` (0.5 s), `peak_db` (6), `active_floor_db` (-60), `rate_window` (3 s), `rate_hop` (0.5 s), `rate_change` (0.25), `nucleus_db` (4), `scene_threshold` (10), `burst_gap` (1.5 s), `burst_min_cuts` (3); speech-energy peaks, speaking-rate changes, screen-change bursts as spans with a score (ADR-036) |
`media-analysis style profile <input> --out profile.json` saves an `edit_style` Observation; `media-analysis style diff
<reference.json> <candidate.json> --json` prints the metric-by-metric difference (candidate − reference, ADR-030).
`media-analysis library index <folder> --index library.json [--tags tags.json] --json` indexes a folder of clips
(re-scans measure only new or changed files); `media-analysis library search --index library.json --query beach
--orientation portrait --max-duration 10 --json` searches it. `--tags` takes `{"<relative path>": ["tag", ...]}` from
the caller (this Skill holds no model); ADR-031.
`media-analysis highlights talk.mp4 --transcript talk.transcript.json [--signals reactions.json] --keyword launch
--json` lists highlight candidates: spans of whole sentences (start / end on sentence boundaries), 15–60 s by default,
with a score and reasons (energy lift, applause / laughter spans the caller passes, keyword density, speaker changes).
It never cuts; ADR-032.
`media-analysis follow rec.mkv --kind silence --state rec.silence.json --json` measures a recording that is still
being written. Run it again as the file grows: each run measures only the new part and appends it to the state file,
with `growing: true` and `data.duration: null` until the file is complete. The file is complete with `--final`, when
`--complete-marker <file>` exists, or when its size has not changed for `--settle` seconds (default 30). The completing
run's `data` equals one `silence` / `scene_detection` run on the final file. Only `silence` and `scene_detection` can be
followed. A plain MP4 / MOV answers `readable: false` until it is closed (its index is written last). Matroska, MPEG-TS
and fragmented MP4 can be read while they grow (ADR-041).
Unknown kinds, unknown parameters, out-of-range values and any `command` / `argv` field are rejected with `INVALID_INPUT`.
## AnalysisRequest (structured input)
```json
{"analysis_id": "analysis-001", "asset_id": "asset-001", "input": "sample.mp4", "kind": "silence",
"parameters": {"threshold_db": -45, "min_duration": 1.0}, "timeout": 120, "output_policy": {"round": 3}}
```
`media-analysis run` accepts one request, a list of requests, or a batch `{"requests": [...], "budget": {"max_analysis_calls": 4}}`
(budget names other than `max_analysis_calls`, `timeout`, `max_total_seconds` are rejected). `analysis_id` is
optional: without it the id is derived from the analysis identity (`analysis-<16 hex>`), so the same file + kind +
parameters always yields the same id. `cache_policy`: `use` (read + write, default), `bypass` (never read or write),
`only` (read; `CACHE_MISS` when absent, no analyzer runs).
## Response (structured output)
```json
{"schema": "media-analysis/response@1", "skill": {"id": "media-analysis", "version": "<version>"}, "status": "ok", "dry_run": false,
"results": [{"analysis_id": "analysis-001", "asset_id": "asset-001", "kind": "silence", "status": "ok",
"observation": {"id": "obs_…", "asset_id": "asset-001", "kind": "silence",
"data": {"segments": [{"start": 0.0, "end": 2.0, "duration": 2.0, "type": "leading", "runs_to_end": false}], "...": "..."},
"source": "media-analysis/silence@<version>", "analysis_id": "analysis-001", "observed_at": "2026-09-04T10:00:00Z",
"analysis": {"identity": "…", "analyzer": "media-analysis/silence", "analyzer_version": "<version>", "algorithm_version": "1",
"parameters": {"stream": 0, "threshold_db": -45.0, "min_duration": 1.0, "edge_tolerance": 0.1}, "seconds": 0.3},
"asset": {"path": "/abs/sample.mp4", "fingerprint": "<sha256>", "size": 208685}},
"cache": {"status": "miss", "policy": "use", "key": "…"},
"usage": {"analyzer_calls": 1, "seconds": 0.3, "operations": [{"executable": "ffprobe", "purpose": "…"}, {"executable": "ffmpeg", "purpose": "…"}]}}],
"observations": ["…the ok observations in request order…"],
"usage": {"analyzer_calls": 1, "cache_hits": 0, "seconds": 0.3},
"budget": {"calls": 1, "seconds": 0.3, "budget": {"max_analysis_calls": null, "timeout": 600.0, "max_total_seconds": null}},
"warnings": []}
```
A failed result has `"status": "error"`, `"error": {"code", "message", "details"}` and `"error_kind"`; the response
`status` is `ok` / `partial` / `error`. Rules an agent can rely on: `source` is always `media-analysis/<tool>@<version>`
(provenance OBSERVED, never AI); `data` contains only measured values; anything not measurable is `null` or
`"not_performed"`; the parameters that produced the measurement are recorded; changing them changes the identity.
## Workflow hints for an agent
1. `doctor --json` once per environment; only use kinds whose analyzer is `available`.
2. `media_probe` first (cheap, ffprobe only), then targeted kinds. `integrity`, `loudness`, `silence` and
`scene_detection` decode the whole file.
3. Pass `--cache-dir` (inside your workspace) so repeated questions about the same file are free.
4. Set `--max-analysis-calls` / `--max-total-seconds` (or a batch `budget`) when you have a budget; `BUDGET_EXCEEDED`
means that analyzer did not run and no observation exists for it.
5. Treat `status: WARN` / `FAIL` (integrity), `frame_rate_mode: "variable"`, `entirely_silent: true`,
`integrated_below_absolute_gate: true` as facts to reason about, not as decisions made for you. The Skill never
emits a recommendation, a confidence-of-action or an inference; "silence 0–3 s exists" is its whole statement,
"trim it" is yours.
6. Budgets are analyzer wall-clock limits (`max_total_seconds` is seconds of analyzer execution, not media duration).
7. Save `contract --json` once and re-validate it with `contract --check` after upgrades; `status: drift` means
your cached tool table is stale.
8. `conformance --json` proves (by submitting real requests and scanning real source, not by asserting it) that
forbidden keys are rejected, no unsafe shell-out exists, writes stay confined to the workspace, and every
published Capability has a valid lifecycle and an AVAILABLE/MISSING doctor status.
## Boundaries
Not here: cutting, normalising, exporting, captions, transcription, thumbnails, speaker detection, semantic scene or
slide understanding, any AI provider. Not here either: job / resume state, approval, policy, production plans,
Project IR, tool selection. Never send this Skill a command, argv, shell string, executable path or credential:
the request schema rejects them and nothing in the package can execute them.
Files in this skill
- CHANGELOG.md
- CLAUDE.md
- ECOSYSTEM_ROADMAP.md
- SKILL.md
- STATE.md
- brand/app-icon-dark.png
- brand/app-icon.png
- docs/architecture.md
- docs/decisions.md
- docs/observation.md
- docs/security.md
- docs/testing.md
- docs/tools.md
- evals/contract_evals.py
- evals/run.py
- pyproject.toml
- tests/conftest.py
- tests/test_contract.py
Attribution
Related skills
View all in development →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.