Yes, there's a better approach than using a screen recorder. You can capture frames directly inside Unity, using ScreenCapture.CaptureScreenshot
. There's a choice of formats to save as, and you can use PNG so that, when you later assemble the frames into a video (using ffmpeg or another tool), you have full control over how much compression to use.
This function is very slow, because it reads back the framebuffer, encodes the image, and writes it to disk, all in the main thread. You may want to use it in combination with setting the Time.captureFramerate
value. This setting lets you slow down Unity by completely disconnecting the in-game frame rate from real time. That is, if you set it to 30, the game will run at 30 fps as measured by Time.deltaTime
and the calls to Update
on your components, regardless of whether a frame takes a millisecond or a minute as measured by wall-clock time.