Code sample - Video capture to AVI

Delphi and C# (ActiveX) sample code.

Get lists of audio and video codecs 

for I := 0 to VideoCapture1.Video_Codecs_GetCount - 1 do
  cbVideoCodecs.Items.Add(VideoCapture1.Video_Codecs_GetItem(i));
for I := 0 to VideoCapture1.Audio_Codecs_GetCount - 1 do
  cbAudioCodecs.Items.Add(VideoCapture1.Audio_Codecs_GetItem(i));
for (int i = 0; i < VideoCapture1.Video_Codecs_GetCount(); i++)
  cbVideoCodecs.Items.Add(VideoCapture1.Video_Codecs_GetItem(i));
for (int i = 0; i < VideoCapture1.Audio_Codecs_GetCount(); i++)
  cbAudioCodecs.Items.Add(VideoCapture1.Audio_Codecs_GetItem(i));

Select audio and video codec 

VideoCapture1.Video_Codec := cbVideoCodecs.Items[cbVideoCodecs.ItemIndex];
VideoCapture1.Audio_Codec := cbAudioCodecs.Items[cbAudioCodecs.ItemIndex];
VideoCapture1.Audio_Codec = cbAudioCodecs.Text;
VideoCapture1.Video_Codec = cbVideoCodecs.Text;

Set audio settings 

VideoCapture1.Audio_Channels := strtoint(cbChannels.Items[cbChannels.ItemIndex]);
VideoCapture1.Audio_BPS := strtoint(cbBPS.Items[cbBPS.ItemIndex]);
VideoCapture1.Audio_SampleRate := strtoint(cbSampleRate.Items[cbSampleRate.ItemIndex]);
VideoCapture1.Audio_Channels = Convert.ToInt32(cbChannels.Text);
VideoCapture1.Audio_BPS = Convert.ToInt32(cbBPS.Text);
VideoCapture1.Audio_SampleRate = Convert.ToInt32(cbSampleRate.Text);

Use AVI format for output 

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

Set video capture mode

VideoCapture1.Mode := Mode_Video_Capture;
VideoCapture1.Mode = VisioForge_Video_Capture_5.TxVFMode.Mode_Video_Capture;

Start capture 

VideoCapture1.Start;
VideoCapture1.Start(); 

VisioForge © 2006-2019

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