Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Unity Recorder tanking performance with unusable output

Discussion in 'Audio & Video' started by PineTreeDev, Jun 1, 2021.

  1. PineTreeDev

    PineTreeDev

    Joined:
    Apr 22, 2019
    Posts:
    27
    Hello,

    I have to record some compute shader outputs (just a 2k texture) in game view, it runs smoothly at 150+ fps normally, but as soon as I start recording performance tanks completely. FPS goes down to 40-50 and the output recording seems to be running at 15fps or lower!! It's being really annoying and I can't find anywhere a fix for this.

    In the recorder settings I have tested with several combinations, right now I'm running without audio capture, 60fps constant with no fps cap. Output to MP4 with the game view as source in 2k output quality (tried with different resolutions here, nothing changes). I have also tested with and without vsync in game view, nothing changes as well.

    I don't think using something like OBS or other recorders isn't viable here as I want a high-quality output.

    Might I add, I've tried recorder in other projects lately, the same problem persists.

    My PC setup:
    Omen Laptop with a Nvidia 1070, core i7 intel 8th gen, connected to a second monitor via hdmi (tried it without the second monitor and does the same)

    Any other info please ask!

    edit: Using 2020.3.14f with the latest verified version of Unity Recorder
     
  2. unitybru

    unitybru

    Unity Technologies

    Joined:
    Jan 28, 2020
    Posts:
    225
    Hi,

    it is normal for recording and encoding to slow down your game: it takes CPU, GPU, and disk I/O resources to grab/encode/save the game render.

    How much that slows down the game depends on several things:
    1. your hardware (the 1070 GPU is 2+ years old BTW)
    2. the image size: encoding 8K images takes more time than 720p
    3. the output format: encoding video can be slower than an image for instance
    So the bottom line is that you should not expect the Recorder to run at the same speed at your game.
    Your output file will have the right frame rate despite taking a long time to be created.

    Cheers
     
  3. PineTreeDev

    PineTreeDev

    Joined:
    Apr 22, 2019
    Posts:
    27
    Hi, my problem is exactly that. The output is not the one selected in the recorder settings. Is this still normal? I can see that it would slow down the game easily but since you said the output should be the same as the selected one and not affected by the time it takes to record...
     
  4. unitybru

    unitybru

    Unity Technologies

    Joined:
    Jan 28, 2020
    Posts:
    225
    Please share a screenshot here of your Recorder Window and tell us which render pipeline you are using. HDRP? URP? LRP?
    Also make sure you do not also have Recorder Clips on Timelines running at the same time, which would imply you have multiple Recorders causing slowdowns. Finally, look at your console for warnings and errors.

    I can try to reproduce the issue here. FYI we have automated tests that check that frame rates are correct so I doubt this is a problem on our end.
     
  5. sudochop

    sudochop

    Joined:
    Sep 5, 2021
    Posts:
    1
    Sorry to revive an old thread. I'm having the same issue but what's odd about it is that once I start recording, my gpu falls to 50% utilization. I'm running some compute shader simulations which keep it capped at 100%.

    Why would recording do this? Is it creating some sort of wait/lock with my gpu?
     
  6. unitybru

    unitybru

    Unity Technologies

    Joined:
    Jan 28, 2020
    Posts:
    225
    When you record with the default settings, you get 30 FPS constant frame rate and most importantly, Cap FPS is enabled.
    This means that the Recorder will slow down your main thread so that it renders at the target FPS when your scene can run faster.

    Additionally, recording adds CPU & disk I/O time to perform the encoding. There is not a lot of extra GPU time added (sometimes we add a step to do color space conversion or vertical flipping), but maybe the slowdown on the CPU side lowers the load on the GPU by rendering frames slower. You can try to monitor your GameView stats to look at this.


    upload_2021-9-17_15-18-3.png

    upload_2021-9-17_15-22-1.png
     
    ss3yuvan likes this.
  7. bplc

    bplc

    Joined:
    Mar 10, 2022
    Posts:
    104
    I apologize in advance for bringing this topic up, but I have the same problem.

    However I have an :

    I9 13900k
    64 GB ram
    RTX 4060 TI 16GB
     
  8. smonbrogg

    smonbrogg

    Joined:
    Dec 11, 2012
    Posts:
    17
    It might be video encoding that is slowing down the CPU.
    Try changing the Media File Format. ProRes Quick Time seems to work for me.
    If you don't need audio, you can also record an image sequence and encode the video later.
     
  9. InnoBen

    InnoBen

    Joined:
    Friday
    Posts:
    1
    Hi everyone, I'm running sadly on the same issue.
    I want to record in 4k with the unity recorder

    upload_2023-10-6_15-35-5.png

    camera move is from Frame 1 to frame 900 in the animation timeline :

    upload_2023-10-6_15-36-22.png

    but at the end I get a Jpeg seq with only 360 frames and some drop / jump. it looks like Unity "skip" some frame instead of rendering them one after the other. I'm running out of solutions. It would be great if someone can help me on this topic.

    Config _ RTX 3000 6GB
    i7-11850H

    Thanks a lot in advance !
    Ben