# trim
Keep a selected range of a Video or Audio timeline.
## Call shape
```text
This is call-shape notation for lookup, not ClipAsm declaration syntax.
## Graph inputs
| `value` | `T` | exactly one |
## Parameters and defaults
| `range` | `TimeRange` | required | — |
## Result and stack behavior
Outputs: `T`.
All `T` inputs and outputs use one homogeneous type: Video or Audio. Use an explicit `<Video>` or `<Audio>` argument when the accessible stack makes inference ambiguous.
Default stack access is **owned**. See [stack binding](../language/stack-binding.md) for ownership and visibility rules.
## Timeline and markers
Keeps the selected range from `value` and preserves only markers fully inside it.
## Example
```clipasm
clipasm 1
config {
video {
fps = 30
}
}
video("assets/scene.mp4")
trim(1s..3s)
```
Expected validation result: `Video` with exactly 60 project frames at the example's explicit `fps = 30`.
This exact example is parsed and compiled by the reference checks; compilation does not inspect the named media files.
## Behavior
- Absolute ranges and rooted timeline-marker ranges are accepted for both Video and Audio.
- Complete child placements inside the selected range are preserved and rebased; partial or uncertain placements are omitted.
- Media-dependent marker boundaries remain deferred until preflight resolves the source domain.
## Requirements
- The range must be nonempty, native-grid aligned, within the bound timeline, and owned by that timeline.
## Common diagnostics
These are the diagnostics most specific to this program.
- [`E_INVALID_TIME_RANGE`](https://nikitamgrimm.github.io/clipasm/diagnostics/#e_invalid_time_range) — Invalid time range
## See also
- [`during`](during.md)
- [Statements and calls](../language/statements-and-calls.md)
- [Stack binding](../language/stack-binding.md)