AVI file output
Products: Video Capture SDK .Net, Video Edit SDK .Net
AVI (Audio Video Interleave) was developed by Microsoft in 1992. AVI is a multimedia container format that stores both audio and video data in a single file. It supports synchronous audio-with-video playback. AVI files can contain both compressed and uncompressed data, offering flexibility but often resulting in large file sizes.
To capture video in AVI format using Video Capture SDK, you need to configure video output format using the AVIOutput
class. You can set video and audio codecs and their various settings.
The same sample code can be used for Video Edit SDK .Net. Use the VideoEditCore class instead of VideoCaptureCore.
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
Visit our GitHub page to get more code samples.