RenderHeads / UnityPlugin-AVProMovieCapture

AVPro Movie Capture is a Unity Plugin for advanced video capture to AVI/MP4/MOV files
https://renderheads.com/products/avpro-movie-capture/
43 stars 8 forks source link

Movie Capture with microphone sound only #383

Closed helferapp closed 2 months ago

helferapp commented 2 months ago

AVPro Movie Capture Version

5.1.4 Ultra

Which platform is your question for?

iOS

Your question

I'm writing a medical app which plays an instruction video. At the same time AVPro Movie Capture records the behaviour of the user with iPhones camera. The captured video should record the iPhones microphone sound only. But at the recorded video we can hear then microphone sound and then sound of the instruction video (not wanted).

Code to setup CaptureFromWebCamTexture instance: capture.NativeForceVideoCodecIndex = h264Codec.Index; capture.NativeForceAudioCodecIndex = aacCodec.Index; capture.IsRealTime = true; ... capture.AudioCaptureSource = AudioCaptureSource.Microphone; capture.ForceAudioInputDeviceIndex = MicId;//NativePlugin.GetAudioInputDeviceName(i) returns only one device with index 0 ...

I'm using AudioCaptureSource.Microphone, why it captures the other sound source too?

Additional explanation: I'm using headphones with microphone far from speakers, so the recorded sound doesn't come from speakers (no backcoupling). When I compile the same app for Android, I don't have this issue. On Android the microphone sound is captured only.

What can I do?

Greetings Frank

Chris-RH commented 2 months ago

Hi Frank,

It might be the headphones that are confusing it :) Try this solution: https://github.com/RenderHeads/UnityPlugin-AVProMovieCapture/issues/314#issuecomment-1776996607

helferapp commented 2 months ago

NativePlugin.MicrophoneRecordingOptions options = NativePlugin.MicrophoneRecordingOptions.DefaultToSpeaker | NativePlugin.MicrophoneRecordingOptions.AllowBluetooth; NativePlugin.SetMicrophoneRecordingHint(true, options);

did help. Now

NativePlugin.GetAudioInputDeviceCount(); ... NativePlugin.GetAudioInputDeviceName(i);

lists the microphone of headphones too.

When I use

capture.ForceAudioInputDeviceIndex = 1;//Headphone mic

the microphone sound is recorded only.

Thank you for quick and useful response.

Frank