解决unity中NatSuite Recorders 录制视频存在的声音问题

NatSuite.Recorders 本身不支持录制声音。这完全是因为 Unity 的麦克风 API(这就是我们一开始引入 NatMic 的原因)。NatCorder 没有任何特殊的麦克风支持;它只是记录您提供给它的音频数据。

配合NatDevice - Media 可用,见作者博客https://blog.natml.ai/natcorder-and-natmic-a-crash-course-221e58bc3525

void StartRecording()

        {

            // Get a microphone

            var query = new MediaDeviceQuery(MediaDeviceCriteria.AudioDevice);

            audioDevice = query.current as AudioDevice;

            // Create recorder

            var clock = new RealtimeClock();

            recorder = new MP4Recorder(1280, 720, 30, audioDevice.sampleRate, audioDevice.channelCount);

            // Stream media samples

            cameraInput = new CameraInput(recorder, clock, Camera.main);

            audioDevice.StartRunning(audioBuffer => recorder.CommitSamples(audioBuffer.sampleBuffer.ToArray(), clock.timestamp));

        }

        async void StopRecording()

        {

            // Stop streaming media to the recorder

            cameraInput.Dispose();

            audioDevice.StopRunning();

            // Finish writing video

            var recordingPath = await recorder.FinishWriting();

            Debug.Log($"Saved recording to: {recordingPath}");

        }

以下是插件下载地址

链接:https://pan.baidu.com/s/1GoFwfqRNQ9tYOrEoh5hP0w 
提取码:pskd

你可能感兴趣的:(音视频,unity,natsuite,VR,AR)