Video capture to AVI file using Video Capture SDK .Net

Related products
Video Capture SDK .Net

To capture video in AVI format using Video Capture SDK, you need to configure video output format using VFAVIOutput class. You can set video and audio codecs and their various settings.

You can use dialog to set settings in UI or set settings in code.

Sample code

Create VFAVIOutput object

VFAVIOutput aviOutput = new VFAVIOutput();

Set AVI settings using the settings dialog

AVISettingsDialog aviSettingsDialog = new AVISettingsDialog(
  VideoCapture1.Video_Codecs.ToArray(),
  VideoCapture1.Audio_Codecs.ToArray());

aviSettingsDialog.ShowDialog(this);

aviSettingsDialog.SaveSettings(ref aviOutput);
Or

Set AVI settings without using the settings dialog

Get lists of audio and video codecs, fill comboboxes

We using two comboboxes in WinForms application – cbVideoCodecs and cbAudioCodecs.
foreach (string codec in VideoCapture1.Video_Codecs)
{
  cbVideoCodecs.Items.Add(codec);
}

foreach (string codec in VideoCapture1.Audio_Codecs)
{
  cbAudioCodecs.Items.Add(codec);
}

Set video settings

aviOutput.Video_Codec = cbVideoCodecs.Text;

Set audio settings

aviOutput.ACM.Name = cbAudioCodecs.Text;
aviOutput.ACM.Channels = 2;
aviOutput.ACM.BPS = 16;
aviOutput.ACM.SampleRate = 44100;
aviOutput.ACM.UseCompression = true;

Apply settings

Set AVI format settings for output

VideoCapture1.Output_Format = aviOutput;

Set video capture mode

VideoCapture1.Mode = VFVideoCaptureMode.VideoCapture;

Set file name (be sure that you have write access rights)

VideoCapture1.Output_Filename = "output.avi";

Start capture (sync or async)

await VideoCapture1.StartAsync();

Required redists

Please contact support to get help with this tutorial. Visit our GitHub page to get more code samples.
abstract 2abstract 1abstract 3
logo
VisioForge © 2006 - 2021