When it comes to recording movements, you may want to record inputs, rather than transforms.
This allows you to only contain data on key-presses and releases (if using keyboard and/or mouse) with associated timings.
The data might look something like
(Key) - (Action) - (Timestamp)
- X - Press - 13:03:04321
- Y - Press - 13:03:05345
- X - Release - 13:03:07332
- Y - Release - 13:03:08934
Potentially covering 4 seconds worth of movement in only 4 lines of data, compared to maybe 60 (Target FPS) * seconds. The data set can also be considerably less than the data for a transform.
This relies on the game being very deterministic. If there are random positions of obstacles, physics objects, procedural generation etc - you would need to be able to store that data and rebuild the scene exactly.
Performance of the game during input capture and playback is important here too - a slight variation can have a significant effect.
To avoid losing accuracy entirely due to performance- you could pair the input saving method with an occasional update for the player transform, saving perhaps every second, used to move the character to the intended location at the intended time. If the character is at this location already you shouldn’t notice this update, but if the character has gone off track it will teleport to this position and attempt to continue following the input data provided.