Video capture to AVI file
Products: Video Capture SDK .Net
To capture video in AVI format using Video Capture SDK, you need to configure video output format using AVIOutput 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 AVIOutput object
AVIOutput aviOutput = new AVIOutput();
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 combo boxes
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 = VideoCaptureMode.VideoCapture;
Set file name (be sure that you have to write access rights)
VideoCapture1.Output_Filename = "output.avi";
Start capture (sync or async)
await VideoCapture1.StartAsync();
Required redists
How to install the required redists or deploy them to the user's PC?
Visit our GitHub page to get more code samples.