[Feature] Non-destructive in-app video trim #31121
Closed
hitzhangjie
started this conversation in
Feature Request
Replies: 1 comment
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I have searched the existing feature requests, both open and closed, to make sure this is not a duplicate request.
Related but different:
This is a single, narrower feature: non-destructive trim for videos already in the library, in the same spirit as the existing photo editor.
The feature
Problem
A lot of uploaded videos have a few seconds of intro or outro that make playback awkward, and the auto-generated cover often lands on a black or otherwise useless frame. Today the realistic options are:
Apple Photos solves this with a soft trim: playback and the cover use the kept range, the original file stays on disk, and restore is one tap. Optionally you can “save as a new video” if you really want a real file.
Immich already has this model for photos (
asset_editfor crop / rotate / mirror,isEdited, restore by deleting edit rows, download original). Videos do not.Ask
Add a Trim action on video assets:
Save (default, non-destructive)
Persist
{ startTime, endTime }as atrimedit. Do not rewriteoriginalPath. Playback starts atstartTimeand stops atendTime. After save, the viewer progress bar is the clipped duration (0 → end − start), like Apple Photos. The trim editor still shows the original duration and handles. Generate the edited thumbnail/preview fromstartTime. Restore = delete the trim edit.Save as new video (optional)
An ffmpeg job writes a new asset; the original is unchanged. Default to stream copy (fast; may snap to keyframes). Optional frame-accurate re-encode.
Out of scope: a general video editor, an ffmpeg settings GUI, sharing a fragment via a special shared-link type, or destroying the original file.
UX sketch
Implementation sketch (fits the current photo-edit pipeline; no new table)
asset_edit:action: 'trim',parameters: { startTime, endTime }(jsonb). Existing insert/delete triggers already maintainasset.isEdited.POST /assets/:id/trimwithsaveAsNewandaccurate.seek = startTime.displayTime = currentTime - startTime,seek = startTime + displayTime, duration =end − start. HLS/startLoad still use file time. Trim modal stays on file time.Happy to follow up with a PR if this direction is acceptable. I have a working prototype of this approach here for reference: https://github.com/hitzhangjie-forks/immich/tree/feat/cut_video
Platform
All reactions