Frame-interval handoff
An editor might approve source frames 30 through 179 rather than an approximate five-second interval. That half-open range is [30,180), containing 150 decoded frames. Frame positions here are zero-based positions in the chosen decoded sequence, not packet indices or timeline timecode labels. A variable-frame-rate source may give those 150 frames a duration that is not exactly five seconds. The recipe deliberately extracts picture only so audio boundary choices remain explicit rather than being silently mismatched.
Build the evidence
- 01
Agree on the coordinate system
Record the file hash, moving video stream and zero-based frame convention. Mark the desired first and last actual pictures in an external editor. The end value means the first discarded frame, so one must be added when an editor supplies an inclusive last frame. Write that translation in the handoff instead of asking another operator to infer whether the last number is included.
- 02
Trim and reset the local presentation origin
The trim filter selects the frame interval and setpts rebases the first retained presentation time to zero. Re-encoding is necessary because selecting arbitrary decoded frames is not a pure stream-copy operation. The example's H.264 settings create a compatible test copy but do not prescribe the only valid delivery encoder. Do not add a new frame rate unless there is an explicit cadence requirement; that could duplicate or drop frames. Explicit passthrough output prevents the default synchronization policy from duplicating or dropping selected frames. The encoder uses the filter time base in this recipe. Container time-scale quantization or unsupported timestamp behavior still needs verification; frame membership and exact display-duration preservation are separate acceptance claims.
- 03
Verify count, boundaries and actual duration
The ffprobe query requests a decoded frame count on the exported moving stream. Compare that count with end minus start, then inspect the first and last saved pictures against the source approval. Measure actual output duration as a separate field. Before AISwapLab upload, confirm this particular copy meets the existing-video route's supported duration and size, and add an intentionally synchronized soundtrack only when required.
A bounded example
Local executed example: the test source had 180 frames at 30 fps. Applying start_frame=30 and end_frame=180 produced a 150-frame, five-second picture-only output under FFmpeg 7.1. The execution log reports the resulting frame count. That validates this constant-rate synthetic fixture; it does not establish the duration of an arbitrary variable-rate excerpt. The independent ffprobe count command was not run locally because ffprobe was unavailable. A reproducible excerpt also records whether source rotation or another interpretation transform was applied before the frame selection. Additional local VFR evidence used a synthetic irregularly sampled sequence and selected frames [30,90). With passthrough and the filter time base, a lossless H.264 verification variant produced 60 pictures whose decoded payload hashes matched the selected input pictures in order. That test does not promise identical samples from the ordinary lossy recipe or arbitrary muxer/time-base support.
Local diagnostic commands
Local FFmpeg 7.1 synthetic tests covered the original constant-rate interval and a VFR interval [30,90). The VFR verification used a lossless H.264 variant: 60 selected picture hashes matched in order. The published ordinary encode remains lossy; ffprobe was unavailable. No paid generation was performed.
ffmpeg -n -i source.mp4 -map 0:V:0 -vf "trim=start_frame=30:end_frame=180,setpts=PTS-STARTPTS" -fps_mode passthrough -enc_time_base filter -an -c:v libx264 -pix_fmt yuv420p excerpt.mp4
ffprobe -v error -select_streams V:0 -count_frames -show_entries stream=nb_read_frames,duration -of json excerpt.mp4Frame-interval handoff
| Field | Example | Verification |
|---|---|---|
| Source interval | [30,180) | Zero-based and end-exclusive |
| Expected frame count | 150 | Decoded output count |
| Boundary pictures | Source 30 and 179 | Side-by-side first/last pictures |
| Audio policy | Excluded in this recipe | Add only with deliberate alignment |
Acceptance evidence
- The interval states zero-based indexing and exclusive end explicitly.
- The exported frame count equals the approved interval length before any rate conversion.
- Boundary pictures, not just duration, match the approved excerpt.
- Audio and upload eligibility remain independent acceptance decisions.
Stop condition
Stop if the approving editor and the extraction tool cannot identify the same frame sequence. Do not keep adjusting endpoint numbers until a visually convenient result appears. Resolve source version, stream selection and indexing first. If exact decoded-frame membership is unnecessary, a simpler timed excerpt may be the more appropriate workflow.
