private void StartRecording(string savePath) { if (isRecording || isPlaying) { return; } this.savePath = savePath; writer = new VideoWriter(); writer.open(savePath, VideoWriter.fourcc('M', 'J', 'P', 'G'), 30, new Size(Screen.width, Screen.height)); if (!writer.isOpened()) { Debug.LogError("writer.isOpened() false"); writer.release(); return; } screenCapture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); recordingFrameRgbMat = new Mat(Screen.height, Screen.width, CvType.CV_8UC3); frameCount = 0; isRecording = true; }