Instead of rolling your own, maybe use the official Unity Recorder package (available as a preview package in the package manager) to record the animation clips.

Click to expand...