Code sample - Audio capture with or without compression

Delphi and C# (ActiveX) sample code.

Get list of available audio codecs 

for I := 0 to VideoCapture1.Audio_Codecs_GetCount - 1 do
  cbAudioCodec2.Items.Add(VideoCapture1.Audio_Codecs_GetItem(i));
for (int i = 0; i < VideoCapture1.Audio_Codecs_GetCount(); i++)
  cbAudioCodecs2.Items.Add(VideoCapture1.Audio_Codecs_GetItem(i));

Select audio codec 

VideoCapture1.Audio_Codec := cbAudioCodec2.Items[cbAudioCodec2.ItemIndex];
VideoCapture1.Audio_Codec = cbAudioCodecs2.Text;

Set audio settings 

VideoCapture1.Audio_Channels := strtoint(cbChannels2.Items[cbChannels2.ItemIndex]);
VideoCapture1.Audio_BPS := strtoint(cbBPS2.Items[cbBPS2.ItemIndex]);
VideoCapture1.Audio_SampleRate := strtoint(cbSamplerate2.Items[cbSamplerate2.ItemIndex]);
VideoCapture1.Audio_Channels = Convert.ToInt32(cbChannels2.Text);
VideoCapture1.Audio_BPS = Convert.ToInt32(cbBPS2.Text);
VideoCapture1.Audio_SampleRate = Convert.ToInt32(cbSampleRate2.Text);

Use PCM/ACM format for output 

VideoCapture1.OutputFormat := Format_PCM_ACM;
VideoCapture1.OutputFormat = VisioForge_Video_Capture_5.TxVFOutputFormat.Format_PCM_ACM;

Set audio capture mode 

VideoCapture1.Mode := Mode_Audio_Capture;
VideoCapture1.Mode = VisioForge_Video_Capture_3.TxVFMode.Mode_Audio_Capture;

Start capture 

VideoCapture1.Start;
VideoCapture1.Start();

VisioForge © 2006-2019

  • GitHub-Mark-64px
  • Twitter Социальные Иконка
  • VisioForge Facebook page
  • YouTube channel