In 2022 Recorder slows down to 1 fps

I upgraded my project from 2021 to 2022 and now the recorder slows down horribly. From the profile I see this:

Does anyone know what the issue might be. I realize that that operation can be slow, but I think something else is going on.

Which recorder is this?
Is deep profiling disabled?
Is this runtime or in editor?

  1. This is the Unity recorder of course.
    2 No deep profiler was not on. I was not aware of the setting.
    3 This is on the editor (Recorder only works on editor anyways no?).

I mixed up some features. Which version of the recorder are you using?

I am using 4.0.1 · May 17, 2023 (Which I totally thought it was the latest). But I just realized there is a new one. I will report back on this.

1 Like

Ok I uploaded latest: 4.0.2 · November 09, 2023 Same issue.
I also notice that the problem is only happening with the movie recorder when running from script. It works fine from the Recorder Window. So the problem must be with a setting. Here is what my code looks like:

    public class GameScreenRecorder : ScreenRecorder
    {
        [SerializeField] private int _outputWidth = 256;
        [SerializeField] private int _outputHeight = 256;

        private RecorderController _recorderController = null;
        private MovieRecorderSettings _videoRecorder;
        private RecorderControllerSettings _controllerSettings;
        public int OnRecordingComplete { get; private set; }

        public void Awake()
        {
            _controllerSettings = ScriptableObject.CreateInstance<RecorderControllerSettings>();
            _recorderController = new RecorderController(_controllerSettings);

            _videoRecorder = ScriptableObject.CreateInstance<MovieRecorderSettings>();
            _videoRecorder.name = "MovieRecorder";
            _videoRecorder.Enabled = true;
            _videoRecorder.VideoBitRateMode = VideoBitrateMode.High;

            _videoRecorder.ImageInputSettings = new GameViewInputSettings
            {
                OutputWidth = _outputWidth,
                OutputHeight = _outputHeight
            };

            _videoRecorder.AudioInputSettings.PreserveAudio = false;

            _controllerSettings.AddRecorderSettings(_videoRecorder);
            _controllerSettings.FrameRate = FramesPerSecond;

            RecorderOptions.VerboseMode = false;

        }

        public override void StartRecording(String path, String movieFileName)
        {
            _videoRecorder.OutputFile = Path.Combine(path, movieFileName);

            _controllerSettings.AddRecorderSettings(_videoRecorder);
            _recorderController.PrepareRecording();
            _recorderController.StartRecording();
        }

        public override void StopRecording()
        {
            _recorderController.StopRecording();
        }

        public override bool IsRecording()
        {
            return _recorderController.IsRecording();
        }

        public void OnApplicationQuit()
        {
            _recorderController.StopRecording();
        }

Am I missing some setting? Documentation is not very clear so this is hard to work with. If anyone has any input I would appreciate the feedback.

I also did a profile with deepProfiling and I seem to get similar information:
That writeSamples seems to be the issue.

Ok answering my own question here. And good thing I do not need audio. Because
_videoRecorder.CaptureAudio = false;
Fixes the problem ! Don’t ask me I have no idea why.

Maybe file a bug report for that?