Audio rendering
Enabling the audio rendering
The audio is rendered when AudioDeviceRendering = true, except for the player, for which the audio is rendered when PlayerAudioRendering = true.
This applies to every source started by StartPreview or StartRecording: video capture device, IP camera, video file or URL. When AudioDeviceRendering = false (default value), no audio is rendered. AudioDeviceRendering is applied when the preview or the recording starts.
Switching the audio on and off while running
To switch the audio on and off while the preview, recording or playback is running, without restarting, use MuteAudioRendering:
- start with AudioDeviceRendering = true (PlayerAudioRendering = true for the player),
- then set MuteAudioRendering = true to mute the audio, and MuteAudioRendering = false to unmute it.
To start without audio and switch it on later, start with AudioDeviceRendering = true and MuteAudioRendering = true, then set MuteAudioRendering = false:
VideoGrabber.AudioDeviceRendering = true
VideoGrabber.MuteAudioRendering = true // starts without audio
VideoGrabber.StartPreview()
...
VideoGrabber.MuteAudioRendering = false // audio on, without restarting
MuteAudioRendering affects the audio rendering only, not the audio recording. With an IP camera, do not use the RTSP_AudioStream_Enabled_bool setting of the RTSP filter for this: it is read only when the URL is opened.
Volume and balance
The volume is usually adjusted with AudioVolume, and the balance with AudioBalance.
These settings, and MuteAudioRendering, are applied while AudioVolumeEnabled = true (default value). With AudioVolumeEnabled = false, the audio is rendered at the volume of the audio renderer.
These settings do not interact with the default sound card, unless the default sound card has been selected as AudioDevice in the AudioDevices list.
The global audio volume and balance of the default sound card can be modified with SpeakerVolume and SpeakerBalance.
Choosing the audio renderer
By default, the default DirectSound Audio Renderer is used (AudioRenderer = -1).
To select a different audio renderer, assign to AudioRenderer the index of the audio renderer to use, chosen in the AudioRenderers list.
When a Blackmagic Decklink external renderer is used (VideoRendererExternal), AudioRenderer = -1 sends the audio to the Decklink output, see Blackmagic Decklink cards.
Selecting the right or left channel
AudioChannelRenderMode can convert the right channel or the left channel to "mono", mute either the left, right or both channels, or convert a mono channel to stereo.
Selecting the audio stream
When the clip has multiple audio streams, one audio stream can be selected, see AudioStreamNumber.