Copy most frames, but re-encode only a few seconds?

Shotcut can not do what you are asking for automatically. Using @daniel47’s hints, you might be able to accomplish it manually. But the manual effort would probably take longer than just re-encoding the whole clip.