Concatenating pre-encoded .h264 during encoding session


I was wondering if it’s possible to concatenate pre-encoded h264 during an encoding session.

The use case - my application renders videos based on source data. If I know that from video to video the source data for specific sequences of frames will be the same, I could theoretically cache the output h264 for these frame sequences and simply concatenate them into the output stream (i.e., avoiding re-encoding them).

Is this possible? Is there another solution that achieves the desired result?