public void StartRecord() { controllerSettings = ScriptableObject.CreateInstance <RecorderControllerSettings>(); TestRecorderController = new RecorderController(controllerSettings); videoRecorder = ScriptableObject.CreateInstance <MovieRecorderSettings>(); videoRecorder.name = "My Video Recorder"; videoRecorder.Enabled = true; videoRecorder.VideoBitRateMode = VideoBitrateMode.High; videoRecorder.ImageInputSettings = new GameViewInputSettings { OutputWidth = 1920, OutputHeight = 1080 }; videoRecorder.AudioInputSettings.PreserveAudio = false; string str = DateTime.Now.Day + "_" + DateTime.Now.Month + "_" + DateTime.Now.Year.ToString() + "_" + DateTime.Now.Hour + "_" + DateTime.Now.Minute + "_" + DateTime.Now.Second; videoRecorder.OutputFile = "Registrazione_" + str; controllerSettings.AddRecorderSettings(videoRecorder); controllerSettings.SetRecordModeToManual(); controllerSettings.FrameRate = 30; RecorderOptions.VerboseMode = false; TestRecorderController.PrepareRecording(); TestRecorderController.StartRecording(); }
void OnGUI() { if (GUI.Button(new Rect(10, 10, 150, 50), "Capture ScreenShot")) { m_RecorderController.StartRecording(); } }
public IEnumerator StartAndStopRecordingGif_When_Pause_DoesNotCrash() { yield return(new EnterPlayMode()); EditorApplication.isPaused = true; yield return(null); Assert.AreEqual(EditorApplication.isPaused, true); var settings = ScriptableObject.CreateInstance <RecorderControllerSettings>(); settings.SetRecordModeToTimeInterval(0, 20); var gifSettings = ScriptableObject.CreateInstance <GIFRecorderSettings>(); settings.AddRecorderSettings(gifSettings); var recorderController = new RecorderController(settings); recorderController.PrepareRecording(); recorderController.StartRecording(); yield return(null); recorderController.StopRecording(); yield return(new ExitPlayMode()); UnityObject.DestroyImmediate(settings); UnityObject.DestroyImmediate(gifSettings); }
public void StartRecording(GameObject target) { if (target == null) { return; } if (!(recordTransform || recordBlendShapeProxy)) { Debug.LogWarning("It can not be recorded because there are no valid elements."); return; } // 未使用のアセットを開放する Resources.UnloadUnusedAssets(); // Animation var animationRecorder = ScriptableObject.CreateInstance <AnimationRecorderSettings> (); animationRecorder.name = "My Animation Recorder"; animationRecorder.enabled = true; animationRecorder.animationInputSettings = new AnimationInputSettings { gameObject = target, recursive = true, }; if (recordTransform) { animationRecorder.animationInputSettings.AddComponentToRecord(typeof(Transform)); } if (recordBlendShapeProxy) { animationRecorder.animationInputSettings.AddComponentToRecord(typeof(VMCBlendShapeProxy)); } SafeCreateDirectory("Assets/Recordings"); var recordingAnimationClipPath = $"Assets/Recordings/{target.name}_{_startTime:yyMMddHHmmss}_{RecordedObjectEntity.take}"; recordingAnimationClipPath = AssetDatabase.GenerateUniqueAssetPath(recordingAnimationClipPath); animationRecorder.outputFile = System.IO.Path.GetFullPath(recordingAnimationClipPath); // Setup Recording controllerSettings.AddRecorderSettings(animationRecorder); controllerSettings.SetRecordModeToManual(); controllerSettings.frameRate = frameRate; controllerSettings.capFrameRate = capFrameRate; controllerSettings.frameRatePlayback = frameRatePlayback; Options.verboseMode = false; m_RecorderController.StartRecording(); _onEndRecorded = () => { var latestRecordedClip = AssetDatabase.LoadAssetAtPath <AnimationClip> (recordingAnimationClipPath + ".anim"); //RecordedObjectEntity.latestEntities = new RecordedObjectEntity[0]; RecordedObjectEntity.latestEntities.Add(new RecordedObjectEntity(target.GetComponent <Animator> (), latestRecordedClip)); }; }
public static async UniTask CaptureFrame() { image.FileNameGenerator.FileName = $"image_{captureId:0000000}"; ++captureId; controller.PrepareRecording(); controller.StartRecording(); await UniTask.WaitWhile(() => controller.IsRecording()); }
public void StartRecording_WithNullSettings_ThrowsException() { var recorderController = new RecorderController(null); var ex = Assert.Throws <NullReferenceException>(() => recorderController.StartRecording()); Assert.IsTrue(ex.Message.Contains("Can start recording without prefs")); Assert.IsFalse(recorderController.IsRecording()); }
void startRecording() { SetupNewRecorder(); if (actorRecorder.IsRecording() == false) { actorRecorder.StartRecording(); } }
public void StartRecording_WithEmptySettings_ShouldNotStartRecording() { var settings = ScriptableObject.CreateInstance <RecorderControllerSettings>(); var recorderController = new RecorderController(settings); Assert.IsFalse(recorderController.StartRecording()); Assert.IsFalse(recorderController.IsRecording()); Object.DestroyImmediate(settings); }
void startRecording() { SetupNewRecorder(); if (filmbackRecorder.IsRecording() == false) { recordingBulb.SetColor("_EmissionColor", Color.red); filmbackRecorder.StartRecording(); } }
public void StartRecording_InNonPlayMode_ShouldThrowsException() { var settings = ScriptableObject.CreateInstance <RecorderControllerSettings>(); var recorderController = new RecorderController(settings); var ex = Assert.Throws <Exception>(() => recorderController.StartRecording()); Assert.IsTrue(ex.Message.Contains("Start Recording can only be called in Playmode")); Assert.IsFalse(recorderController.IsRecording()); UnityObject.DestroyImmediate(settings); }
/// <summary> /// Record a Timeline Recorder Clip and a Recorder Controller. /// </summary> /// <returns></returns> private void Record() { RecorderOptions.VerboseMode = false; // 1) Start recording the Recorder Controller var testRecorderController = new RecorderController(controllerSettings); testRecorderController.PrepareRecording(); testRecorderController.StartRecording(); // 2) Play the Timeline director.Play(); }
void StartVideoRecording() { #if UNITY_EDITOR && AT_VIDEO_INIT RecorderOptions.VerboseMode = false; var controllerSettings = ScriptableObject.CreateInstance <RecorderControllerSettings>(); this.mRecorderController = new RecorderController(controllerSettings); var videoRecorder = ScriptableObject.CreateInstance <MovieRecorderSettings>(); videoRecorder.name = this.mProject.ProjectName; videoRecorder.Enabled = true; videoRecorder.OutputFile = "Recordings/" + GetVideoName(); videoRecorder.OutputFormat = MovieRecorderSettings.VideoRecorderOutputFormat.MP4; videoRecorder.VideoBitRateMode = UnityEditor.VideoBitrateMode.High; if (this.mProject.is360) { videoRecorder.ImageInputSettings = new Camera360InputSettings() { OutputWidth = this.mProject.OutputWidth, OutputHeight = this.mProject.OutputHeight, RenderStereo = this.mProject.is360Stereo }; } else { videoRecorder.ImageInputSettings = new GameViewInputSettings() { OutputWidth = this.mProject.OutputWidth, OutputHeight = this.mProject.OutputHeight, }; } videoRecorder.AudioInputSettings.PreserveAudio = true; controllerSettings.AddRecorderSettings(videoRecorder); controllerSettings.SetRecordModeToManual(); //controllerSettings.SetRecordModeToFrameInterval(0, this.mProject.GetDuration() * this.FrameRate); // 2s @ 30 FPS controllerSettings.FrameRate = this.mProject.FrameRate; controllerSettings.FrameRatePlayback = FrameRatePlayback.Constant; controllerSettings.CapFrameRate = false; mRecorderController.PrepareRecording(); mRecorderController.StartRecording(); #endif }
public void StartAndStopRecording_WithValidSettings_ShouldStartThenStopRecording() { var settings = ScriptableObject.CreateInstance <RecorderControllerSettings>(); var imageRecorder = ScriptableObject.CreateInstance <AOVRecorderSettings>(); settings.AddRecorderSettings(imageRecorder); var recorderController = new RecorderController(settings); Assert.IsTrue(recorderController.StartRecording()); Assert.IsTrue(recorderController.IsRecording()); recorderController.StopRecording(); Assert.IsFalse(recorderController.IsRecording()); Object.DestroyImmediate(imageRecorder); Object.DestroyImmediate(settings); }
// Update is called once per frame private void Update() { if (configOn) { StartAfterConfig(); } KinectDevice.turnOnOffSkeletons(DrawSkeleton); if (!configured || !isRealTime || !animationOn) { return; } if (resizeAvatar) //resize avatar { resizeAvatar = false; ResizeAvatar(); } if (startRecording) { createAnimationRecorder(); recorder.PrepareRecording(); recorder.StartRecording(); startRecording = false; isrecording = true; } if (stopRecording) { recorder.StopRecording(); stopRecording = false; isrecording = false; } }
internal void Initialize() { var controllerSettings = ScriptableObject.CreateInstance <RecorderControllerSettings>(); m_RecorderController = new RecorderController(controllerSettings); var mediaOutputFolder = new DirectoryInfo(Path.Combine(Application.dataPath, "..", "SampleRecordings")); // Video m_Settings = ScriptableObject.CreateInstance <MovieRecorderSettings>(); m_Settings.name = "My Video Recorder"; m_Settings.Enabled = true; // This example performs an MP4 recording m_Settings.OutputFormat = MovieRecorderSettings.VideoRecorderOutputFormat.MP4; m_Settings.VideoBitRateMode = VideoBitrateMode.High; m_Settings.ImageInputSettings = new GameViewInputSettings { OutputWidth = 1920, OutputHeight = 1080 }; m_Settings.AudioInputSettings.PreserveAudio = m_RecordAudio; // Simple file name (no wildcards) so that FileInfo constructor works in OutputFile getter. m_Settings.OutputFile = mediaOutputFolder.FullName + "/" + "video"; // Setup Recording controllerSettings.AddRecorderSettings(m_Settings); controllerSettings.SetRecordModeToManual(); controllerSettings.FrameRate = 60.0f; RecorderOptions.VerboseMode = false; m_RecorderController.PrepareRecording(); m_RecorderController.StartRecording(); Debug.Log($"Started recording for file {OutputFile.FullName}"); }
// This function gets called when entering Play Mode. We configure the Recorder and start it. private void OnEnable() { if (renderTexture == null) { //Debug.LogError($"You must assign a valid renderTexture before entering Play Mode"); renderTexture = new RenderTexture(512, 512, 32); } RecorderOptions.VerboseMode = true; var controllerSettings = ScriptableObject.CreateInstance <RecorderControllerSettings>(); recorderController = new RecorderController(controllerSettings); var videoRecorder = ScriptableObject.CreateInstance <MovieRecorderSettings>(); videoRecorder.name = "My Video Recorder"; videoRecorder.Enabled = true; videoRecorder.OutputFile = "recording"; videoRecorder.OutputFormat = MovieRecorderSettings.VideoRecorderOutputFormat.MP4; videoRecorder.ImageInputSettings = new RenderTextureInputSettings() { OutputWidth = renderTexture.width, OutputHeight = renderTexture.height, FlipFinalOutput = false, RenderTexture = renderTexture }; RecorderOptions.VerboseMode = false; videoRecorder.AudioInputSettings.PreserveAudio = true; controllerSettings.AddRecorderSettings(videoRecorder); //controllerSettings.SetRecordModeToFrameInterval(0, 59); // 2s @ 30 FPS controllerSettings.SetRecordModeToManual(); controllerSettings.FrameRate = 60; recorderController.PrepareRecording(); recorderController.StartRecording(); }
public void SceneHookGameObject_AfterStartRecording_ShouldBeVisible() { var settings = ScriptableObject.CreateInstance <RecorderControllerSettings>(); var recorder = ScriptableObject.CreateInstance <ImageRecorderSettings>(); settings.AddRecorderSettings(recorder); var recorderController = new RecorderController(settings); Options.verboseMode = false; // Make sure visibility is not toggled on because of debugMode. Assert.IsTrue(recorderController.StartRecording()); Assert.IsTrue(recorderController.IsRecording()); var gameObject = GameObject.Find("Unity-RecorderSessions"); Assert.IsNotNull(gameObject); Assert.IsTrue(gameObject.hideFlags == HideFlags.None); recorderController.StopRecording(); Object.DestroyImmediate(recorder); Object.DestroyImmediate(settings); }
private static IEnumerator RecordOneLevel(LevelData level, RecorderLevelEntryPoint entry) { // Enable the starting UI entry.StartingUI.SetActive(true); entry.LevelTitle.text = $"Next Level: '{level.Name}'"; for (int i = entry.CountdownTime; i >= 1; i--) { entry.CountdownText.text = i.ToString(); // Set time of current count and create a function to detect when one second has passed yield return(new WaitForSeconds(1f)); } // Setup the matrix entry.StartingUI.SetActive(false); entry.MatrixUI.Setup(level); // Start the recording RecorderController recorder = GetRecorder(level.Name); recorder.PrepareRecording(); if (!recorder.StartRecording()) { Debug.Log("Failed to start the recording!"); } // Wait until the current matrix is identity yield return(new WaitUntil(() => entry.MatrixUI.CurrentMatrix.isIdentity)); yield return(new WaitForSeconds(entry.EndingTime)); // Stop the recording recorder.StopRecording(); }
public IEnumerator StartingAndEndingRecording_IncreasesTakeByOne() { yield return(new EnterPlayMode()); var settings = ScriptableObject.CreateInstance <RecorderControllerSettings>(); settings.SetRecordModeToTimeInterval(0, 20); var movSettings = ScriptableObject.CreateInstance <ImageRecorderSettings>(); settings.AddRecorderSettings(movSettings); var recorderController = new RecorderController(settings); recorderController.PrepareRecording(); Assert.AreEqual(1, movSettings.Take); recorderController.StartRecording(); yield return(null); recorderController.StopRecording(); yield return(new ExitPlayMode()); Assert.AreEqual(2, movSettings.Take); UnityObject.DestroyImmediate(settings); UnityObject.DestroyImmediate(movSettings); }
void OnEnable() { var controllerSettings = ScriptableObject.CreateInstance <RecorderControllerSettings>(); m_RecorderController = new RecorderController(controllerSettings); var outputFolder = Application.dataPath + "/SampleRecordings"; // Video var videoRecorder = ScriptableObject.CreateInstance <MovieRecorderSettings>(); videoRecorder.name = "My Video Recorder"; videoRecorder.enabled = true; videoRecorder.outputFormat = VideoRecorderOutputFormat.MP4; videoRecorder.videoBitRateMode = VideoBitrateMode.Low; videoRecorder.imageInputSettings = new GameViewInputSettings { outputAspect = ImageAspect.x16_9, outputHeight = ImageHeight.x720p_HD }; videoRecorder.audioInputSettings.preserveAudio = true; videoRecorder.outputFile = outputFolder + "/video"; // Animation var animationRecorder = ScriptableObject.CreateInstance <AnimationRecorderSettings>(); animationRecorder.name = "My Animation Recorder"; animationRecorder.enabled = true; var sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere); animationRecorder.animationInputSettings = new AnimationInputSettings { gameObject = sphere, recursive = true, }; animationRecorder.animationInputSettings.AddComponentToRecord(typeof(Transform)); animationRecorder.outputFile = outputFolder + "/animation_" + DefaultWildcard.GeneratePattern("GameObject"); // Image Sequence var imageRecorder = ScriptableObject.CreateInstance <ImageRecorderSettings>(); imageRecorder.name = "My Image Recorder"; imageRecorder.enabled = true; imageRecorder.outputFormat = ImageRecorderOutputFormat.PNG; imageRecorder.captureAlpha = true; imageRecorder.outputFile = outputFolder + "/image_" + DefaultWildcard.Frame; imageRecorder.imageInputSettings = new CameraInputSettings { source = ImageSource.MainCamera, outputAspect = ImageAspect.x16_9, outputHeight = ImageHeight.x720p_HD, captureUI = true }; // Setup Recording controllerSettings.AddRecorderSettings(videoRecorder); controllerSettings.AddRecorderSettings(animationRecorder); controllerSettings.AddRecorderSettings(imageRecorder); controllerSettings.SetRecordModeToManual(); controllerSettings.frameRate = 60.0f; m_RecorderController.verbose = true; m_RecorderController.StartRecording(); }
void OnEnable() { var controllerSettings = ScriptableObject.CreateInstance <RecorderControllerSettings>(); m_RecorderController = new RecorderController(controllerSettings); var mediaOutputFolder = Path.Combine(Application.dataPath, "..", "SampleRecordings"); // animation output is an asset that must be created in Assets folder var animationOutputFolder = Path.Combine(Application.dataPath, "SampleRecordings"); // Video var videoRecorder = ScriptableObject.CreateInstance <MovieRecorderSettings>(); videoRecorder.name = "My Video Recorder"; videoRecorder.enabled = true; videoRecorder.outputFormat = VideoRecorderOutputFormat.MP4; videoRecorder.videoBitRateMode = VideoBitrateMode.Low; videoRecorder.imageInputSettings = new GameViewInputSettings { outputWidth = 1920, outputHeight = 1080 }; videoRecorder.audioInputSettings.preserveAudio = true; videoRecorder.outputFile = Path.Combine(mediaOutputFolder, "video_v" + DefaultWildcard.Take); // Animation var animationRecorder = ScriptableObject.CreateInstance <AnimationRecorderSettings>(); animationRecorder.name = "My Animation Recorder"; animationRecorder.enabled = true; var sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere); animationRecorder.animationInputSettings = new AnimationInputSettings { gameObject = sphere, recursive = true, }; animationRecorder.animationInputSettings.AddComponentToRecord(typeof(Transform)); animationRecorder.outputFile = Path.Combine(animationOutputFolder, "anim_" + DefaultWildcard.GeneratePattern("GameObject") + "_v" + DefaultWildcard.Take); // Image Sequence var imageRecorder = ScriptableObject.CreateInstance <ImageRecorderSettings>(); imageRecorder.name = "My Image Recorder"; imageRecorder.enabled = true; imageRecorder.outputFormat = ImageRecorderOutputFormat.PNG; imageRecorder.captureAlpha = true; imageRecorder.outputFile = Path.Combine(mediaOutputFolder, "_png", "image_v" + DefaultWildcard.Take + "." + DefaultWildcard.Frame); imageRecorder.imageInputSettings = new CameraInputSettings { source = ImageSource.MainCamera, outputWidth = 1920, outputHeight = 1080, captureUI = true }; // Setup Recording controllerSettings.AddRecorderSettings(videoRecorder); controllerSettings.AddRecorderSettings(animationRecorder); controllerSettings.AddRecorderSettings(imageRecorder); controllerSettings.SetRecordModeToManual(); controllerSettings.frameRate = 60.0f; Options.verboseMode = false; m_RecorderController.StartRecording(); }
public void PleaseRecord() { m_RecorderController.StartRecording(); }