description: Lossless-first audio and video processing for trimming, splitting, merging, remuxing, stream extraction, inspection, thumbnails, captions, GIFs, normalization, and analysis. Use when the user provides or references media files and asks to cut, join, convert, inspect, caption, extract audio or frames, or otherwise process them. For trim, split, merge, remux, or extraction, always attempt FFmpeg stream copy first and never silently re-encode.
---
# Media Toolkit
Use this for deterministic audio and video file work.
For these operations, begin with `scripts/lossless_media.py`:
- trim or clip,
- fixed-duration split,
- merge/concatenate,
- container change/remux,
- audio, video, or subtitle stream extraction.
Those commands use FFmpeg `-c copy`. They either complete without changing the encoded streams or fail. **Never add an automatic transcoding fallback.**
A lossless video cut is packet/keyframe accurate. It may begin on the nearest usable keyframe. If the user requires a frame-exact boundary, explain that it requires re-encoding and obtain explicit acceptance before using a transcoding workflow.
## Routing
| Request | Primary tool | Encoding policy |
|---|---|---|
| Trim audio/video | `lossless_media.py trim` | stream copy only |
| Split by duration | `lossless_media.py split` | stream copy only |