public void StartRecording() { Debug.Log("StartRecording------"); // Start recording recordingClock = new RealtimeClock(); videoRecorder = new MP4Recorder( videoWidth, videoHeight, 30, recordMicrophone ? AudioSettings.outputSampleRate : 0, recordMicrophone ? (int)AudioSettings.speakerMode : 0, OnReplay ); // Create recording inputs cameraInput = new CameraInput(videoRecorder, recordingClock, _camere); if (recordMicrophone) { StartMicrophone(); audioInput = new AudioInput(videoRecorder, recordingClock, microphoneSource, true); } isRecording = true; //Mvc.MvcTool.sendNotice(MessageKeys.ChangeRecState,isRecording); }
public void StartRecording() { // Start recording clock = new RealtimeClock(); videoRecorder = new MP4Recorder(webcamTexture.width, webcamTexture.height, 30, 0, 0, OnRecording); pixelBuffer = webcamTexture.GetPixels32(); }
public void StopRecording() { // Stop recording videoRecorder.Dispose(); videoRecorder = null; pixelBuffer = null; }
public void StartRecording() { // Start recording clock = new RealtimeClock(); recorder = new MP4Recorder(webCamTexture.width, webCamTexture.height, 30); pixelBuffer = webCamTexture.GetPixels32(); recording = true; }
public void StartRecording() { // Become grey greyness = 1f; // Start recording clock = new RealtimeClock(); videoRecorder = new MP4Recorder(cameraPreview.width, cameraPreview.height, 30, 0, 0, OnRecording); }
public void StopRecording() { // Revert to normal color greyness = 0f; // Stop recording videoRecorder.Dispose(); videoRecorder = null; }
public void StartRecording() { // Start recording var clock = new RealtimeClock(); recorder = new MP4Recorder(webCamTexture.width, webCamTexture.height, 30); webCamTextureInput = new WebCamTextureInput(recorder, clock, webCamTexture); }
public void StopRecording() { // Stop the microphone audioDevice.StopRecording(); // Stop recording cameraInput.Dispose(); videoRecorder.Dispose(); cameraInput = null; videoRecorder = null; }
public void StopRecording() { MP4Recorder recorder = Camera.GetComponent<MP4Recorder>(); if (Recorder != null && Recorder.recording) { Recorder.Flush(); Recorder.EndRecording(); Debug.Log("stopped recording"); } }
/* * private void Awake() * { * cameraImage = findCamera.background; * * } * * private void Update() * { * if (cameraImage != null) * { * cameraImage = findCamera.background; * } * //findCamera.background.texture; * * * }*/ /* * public void StartRecording () { * // Start recording * recorder = new GIFRecorder(cameraImage.texture.width, cameraImage.texture.height, frameDuration); * cameraInput = new CameraInput(recorder, Camera.main); * // Get a real GIF look by skipping frames * //cameraInput.frameSkip = 4; * } */ //-- /* * public async void StopRecording () { * // Stop the recording * cameraInput.Dispose(); * var path = await recorder.FinishWriting(); * // Log path * Debug.Log($"Saved animated GIF image to: {path}"); * Application.OpenURL($"file://{path}"); * } */ //-mp4 public void StartRecording() { //recorderTexture = findCamera.GetCurrentCam(); // Start recording clock = new RealtimeClock(); mp4Recorder = new MP4Recorder(recorderTexture.width, recorderTexture.height, 30); pixelBuffer = recorderTexture.GetPixels32(); recording = true; }
public void StartRecording() { var sampleRate = 44100; var channelCount = 1; // Start recording from the main camera recordingClock = new RealtimeClock(); videoRecorder = new MP4Recorder(videoWidth, videoHeight, 30, sampleRate, channelCount, OnRecording); cameraInput = new CameraInput(videoRecorder, recordingClock, Camera.main); // Start the microphone audioDevice = AudioDevice.GetDevices()[0]; audioDevice.StartRecording(sampleRate, channelCount, this); }
private void InitRecorder(int width, int height, int fps, int bitrate, int keyframeInterval) { var br = bitrate * 1000000; //recorder settings recorder = new MP4Recorder(width: width, height: height, frameRate: fps, sampleRate: 0, channelCount: 0, bitrate: br, keyframeInterval: keyframeInterval); clock = new FixedIntervalClock(fps, true); //recorder camera input Camera cam = GameObject.FindGameObjectWithTag("recorder").GetComponent <Camera>(); cameraInput = new CameraInput(recorder, clock, cam); }
public void StartRecording() { // Start recording var frameRate = 30; var sampleRate = recordMicrophone ? AudioSettings.outputSampleRate : 0; var channelCount = recordMicrophone ? (int)AudioSettings.speakerMode : 0; var clock = new RealtimeClock(); recorder = new MP4Recorder(videoWidth, videoHeight, frameRate, sampleRate, channelCount, audioBitRate: 96_000); // Create recording inputs cameraInput = new CameraInput(recorder, clock, Camera.main); audioInput = recordMicrophone ? new AudioInput(recorder, clock, microphoneSource, true) : null; // Unmute microphone microphoneSource.mute = audioInput == null; }
public void StartRecording() { // Start recording recordingClock = new RealtimeClock(); videoRecorder = new MP4Recorder( videoWidth, videoHeight, 30, recordMicrophone ? AudioSettings.outputSampleRate : 0, recordMicrophone ? (int)AudioSettings.speakerMode : 0, OnReplay ); // Create recording inputs cameraInput = new CameraInput(videoRecorder, recordingClock, Camera.main); if (recordMicrophone) { StartMicrophone(); audioInput = new AudioInput(videoRecorder, recordingClock, microphoneSource, true); } }
public void Start() { m_IsReady = false; // Start recording recordingClock = new RealtimeClock(); videoRecorder = new MP4Recorder( videoWidth, videoHeight, 15, 0, 0, FileLocationCB, "facecam.mp4", (int)(480 * 540 * 11.4f) ); deviceCamera.Framerate = 15; deviceCamera.StartPreview(OnStart, OnFrame); }
public void Start() { m_IsReady = false; // no recordMicrophone = false; // Start recording recordingClock = new RealtimeClock(); videoRecorder = new MP4Recorder( videoWidth, videoHeight, 15, recordMicrophone ? AudioSettings.outputSampleRate : 0, recordMicrophone ? (int)AudioSettings.speakerMode : 0, FileLocationCB, "gamevideo.mp4", (int)(480 * 540 * 11.4f) ); // Create recording inputs cameraInput = new CameraInput(videoRecorder, recordingClock, Camera.main); }
public void StartRecording() { // Compute the video width dynamically to match the screen's aspect ratio var videoHeight = (int)(videoWidth / videoCamera.aspect); videoHeight = videoHeight >> 1 << 1; // Ensure divisible by 2 // Create recorder and camera input var clock = new RealtimeClock(); recorder = new MP4Recorder(videoWidth, videoHeight, 30); cameraInput = new CameraInput(recorder, clock, videoCamera); // Attach an optimized frame input to the camera input for better performance if (Application.platform == RuntimePlatform.Android) { cameraInput.frameInput = new GLESRenderTextureInput(recorder, multithreading: true); } else if (Application.platform == RuntimePlatform.IPhonePlayer) { cameraInput.frameInput = new MTLRenderTextureInput(recorder, multithreading: true); } }
private IEnumerator RenderRoutine(float length) { // Calculate audioData int audioSamples = clip.frequency; int channels = clip.channels; float[] samples = new float[clip.samples * channels]; clip.GetData(samples, 0); int samplesPerFrame = audioSamples / fps; // Create output rendering camera Camera renderCam = CreateRenderingCamera(); RenderTexture tex = renderCam.targetTexture; // Create native recorder MP4Recorder recorder = new MP4Recorder(tex.width, tex.height, fps, audioSamples, channels, s => { Debug.Log(s); }); FixedIntervalClock clock = new FixedIntervalClock(fps); // Loop each rendering frame to grab and commit frame and samples for (int frame = 0; frame < length * fps; frame++) { yield return(new WaitForEndOfFrame()); long timestamp = clock.Timestamp; Texture2D fTex = RenderTextureToTexture2D(tex); float[] commitSamples = GetPartialSampleArray(samples, samplesPerFrame * frame, samplesPerFrame); recorder.CommitFrame(fTex.GetPixels32(), timestamp); recorder.CommitSamples(commitSamples, timestamp); DestroyImmediate(fTex); Debug.Log($"Generated Frame {frame}/{(int) (length * fps) - 1}"); } // Complete render and dispose the native recorder // Disposing also finishes the file encoding recorder.Dispose(); }
public void StartRecording() { clock = new RealtimeClock(); videoRecorder = new MP4Recorder(Screen.width, Screen.height, 30, 0, 0, OnRecording); }