The first timestamp is still 0.5 seconds.
Add or restore only setpts=PTS-STARTPTS after trim and reread the output showinfo timestamps.
Hands-on recipe
Create a one-second reference excerpt using explicit start-inclusive/end-exclusive boundaries. This recipe trims a continuous video segment; it does not choose a still frame by time base.
Includes executed local fixtures, scripts and receipts. These checks do not represent a video-generation service run.
node run-recipe.mjs --out ./my-run
Fully decode the original fixture and confirm thirty frames at ten FPS, establishing its three-second controlled interval. The raw construction buffer is temporary and removed in finally. Do not use this controlled CFR duration rule as an unqualified VFR duration estimator.
The local window validator requires finite numbers, start ≥ 0, end > start and end ≤ measured source duration. It executes separate negative cases for a negative start, equal boundaries, reversed boundaries, a past-end request and NaN.
Apply trim=start=0.5:end=1.5,setpts=PTS-STARTPTS and re-encode the video. The trim filter keeps the continuous source interval, while setpts makes the excerpt start at zero. The end boundary excludes the source frame beginning at 1.5 seconds.
Decode the result to ten frames and compare its first/last RGB frames against source indices 5 and 14. Parse actual showinfo output to verify PTS 0.0 through 0.9 in 0.1-second steps. The executed fixture measured zero endpoint channel difference.
Add or restore only setpts=PTS-STARTPTS after trim and reread the output showinfo timestamps.
Use the documented exclusive end boundary and check source index 14 as the final fixture frame; avoid increasing the requested end to compensate.
Reduce only endSeconds to an established source boundary, or obtain the intended longer reference. Do not silently clamp an invalid request.
Keep the requested window, measured source interval and decoded endpoint checks together. The small CFR fixture proves this trim operation and does not establish every real reference clip’s timestamp behaviour.