private void StartRecording(string savePath) { if (isRecording || isPlaying) { return; } this.savePath = savePath; writer = new VideoWriter(); #if !UNITY_IOS writer.open(savePath, VideoWriter.fourcc('M', 'J', 'P', 'G'), 30, new Size(Screen.width, Screen.height)); #else writer.open(savePath, VideoWriter.fourcc('D', 'V', 'I', 'X'), 30, new Size(Screen.width, Screen.height)); #endif 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; }