Repository navigation
Description
Search existing issues
- I have searched the existing issues
Is your feature request related to a problem?
A clip can only be inserted at a boundary. insertAssetClip takes a list index, and the MCP insertClip tool takes a beforeClipId, so a second source cannot go into the middle of a long take.
Steps to reproduce, with a 32 minute screen recording:
- The recording opens as one clip, 0 to 1924.096 s.
- Import a second recording into Media.
- Trim a section out of the middle of the take.
- Try to put the second recording where that section was.
Step 4 has nowhere to land. The docs say to drop the source "onto the clip row to add it at the end of the timeline, then drag it where it belongs", but the only positions a clip can take are between two existing clips.
The workaround is to add the same source a second time and set in and out points on both clips in Edit clip. That works, but trims, zooms, annotations and audio are anchored to a clip by id, so the second half starts empty and its regions have to be rebuilt by hand. On a long take that is most of the edit.
Describe the solution you'd like
Add splitAndInsert { clipId, atSourceSec, assetId, sourceStartSec?, sourceEndSec? } to document/operations.ts and to the operation union in schema/index.ts, next to duplicate_clip and insert_asset_clip.
Splitting and inserting need to happen in one transform. withClipsChanged calls joinContiguous, which joins neighbouring clips of the same asset when their source ranges meet and their crop and rotation match (joinable in timeline.ts). A separate split leaves the two halves in exactly that state, so the next edit joins them back together. Doing both in one transform means joinContiguous never sees the halves side by side. When the split also removes a span, the ranges do not meet, and no marker is needed at all.
A split on its own, with nothing to insert, does need a marker that joinable respects. That is a decision rather than a detail: the comment above withClipsChanged argues against a marker on every cut, and that is right for joins the user made by hand, but a split the user asked for is not an accident to be undone by the next trim.
In the editor, dropping a media card on the clip strip at the playhead should split the clip and insert there instead of only appending at the end. A Split item in the Edit clip dialog, and a rebindable shortcut next to T, Z, S, A and C, would cover a split with nothing to insert.
For MCP and the agent, splitClip, or an atSourceSec parameter on insertClip, in electron/mcp/project-tools.ts, read back through getCurrentDocument.
The timeline stays contiguous. A split adds a boundary inside the ruler, it does not leave a gap. Regions should follow what the user expects: one that sits entirely on one side moves with that side, and one that crosses the split is clamped into both halves, the way rederiveRegionMs already handles a pill when a clip is shortened.
Describe alternatives you've considered
- Add the source twice and set the in and out points by hand. Works today, but loses the second half's regions.
replaceTimeline. Sorts its intervals and cannot insert or reorder, and its documentation points toinsertClipfor other footage.- An overlay region, as in [Feature]: Multi-video overlay and split-screen layout regions on the timeline #1316. The inserted footage replaces the take on the primary track, it does not composite over it.
- Cutting the two halves apart outside OpenScreen. Loses the project file and every region in it.
Additional context
- OpenScreen 2.4.0 on Windows.
- The app has no split action: the string does not appear in the English editor locale.
- Docs to update:
website/docs/media-library.mdandwebsite/docs/editing-timeline.md. - The pieces already exist.
setClipSourceRange,duplicateClipandinsertAssetClipare pure document transforms intimeline.ts, andreanchorRowsalready moves trims, zooms, annotations and audio from one clip to another, which is what a split needs to hand regions to the right half.
Activity