In FFmpeg, does the placement of the `-to` option (before/after `-i`) in stream copy mode affect which keyframes are included in the output file?

I’m trying to understand how FFmpeg handles the -to option when used as an input option vs an output option in stream copy mode.

From the FFmpeg documentation
my interpretation is that the position of -to affects what is included in the output file. Specifically:

  • When -to is used as an input option, FFmpeg stops reading input at the end_timestamp and this can happen before or after the next keyframe. In this case, the output will only include complete GOP that are within the provided interval, but some frames might be lost if they are beyond end_timestamp.

|—-K1——[K2–start_timestamp——K3——K4]—-end_timestamp—K5—|

  • When -to is used as an output option, FFmpeg stops writing output once the output duration reaches the end_timestamp. In stream copy mode, FFmpeg only writes complete GOPs, so it will include the keyframe immediately after end_timestamp.

|—-K1——[K2–start_timestamp——K3——K4—-end_timestamp—K5]—|

My question:
Is this understanding correct? Specifically, does using -to as an input option vs. an output option change which keyframes are included in the output file? And what’s the correct way to cut a segment so that no frames before the specified end_timestamp are missing?

Command examples:

# Using -to as input option
ffmpeg -ss start_timestamp -to end_timestamp -i input.mp4 -c copy cut_input.mp4

# Using -to as output option
ffmpeg -ss start_timestamp -i input.mp4 -to end_timestamp -c copy cut_output.mp4