3
$\begingroup$

I made an audio visualizer using Unity3D (you can see it here) but I am not satisfied on the video quality, as the compression destroys the graphics. I recorded the screen during a real-time rendering. I tried many screen recorders, but always the same disappointment.

I want to try another approach, using non real-time rendering. I know Unity is made for real time rendering, but do you know if such a thing is possible ?

$\endgroup$
  • 1
    $\begingroup$ Could you add more detail on what you're aiming to achieve? Do you want a completely new approach that is not real-time, or are you looking to redirect the real-time output so it gets recorded directly rather than going to the screen? Or something else? $\endgroup$ – trichoplax Sep 6 '18 at 20:21
  • 1
    $\begingroup$ Are you asking "Is there a non-realtime" or "slower" rendering mode in Unity that will render in higher quality OR are you wanting a lossless video recording approach? I don't know unity, but can you save each frame at the end of each render to create a sequence of images (e.g PNGs) and put them through a lossless or near-lossless video encoder? $\endgroup$ – Simon F Sep 7 '18 at 8:10
  • $\begingroup$ It looks pretty good. You understand that if you view it immediately after uploading that you'll probably be viewing it at 360P and it will be a bit fuzzy, after an hour or so a (in the case of that video) 1080P version becomes available. $\endgroup$ – Rob Sep 11 '18 at 8:32
4
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ This is probably the best option. Thanks also for the Time.captureFramerate hack, I did not know that possibility. $\endgroup$ – L. Chaumartin Sep 8 '18 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.