Skip to content

Instantly share code, notes, and snippets.

@visioforge
Last active July 22, 2021 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save visioforge/2787a6fdd2a6ba107fad467d3f7d32a2 to your computer and use it in GitHub Desktop.
Save visioforge/2787a6fdd2a6ba107fad467d3f7d32a2 to your computer and use it in GitHub Desktop.
5 lines of code sample - Video capture to AVI - VisioForge Video Capture SDK .Net - https://www.visioforge.com/video-capture-sdk-net
// Required NuGet packages:
// https://www.nuget.org/packages/VisioForge.DotNet.VideoCapture/
// https://www.nuget.org/packages/VisioForge.DotNet.Core.Redist.VideoCapture.x64/
// https://www.nuget.org/packages/VisioForge.DotNet.Core.Redist.VideoCapture.x86/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using VisioForge.Types.OutputFormat;
namespace SampleCapture
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
videoCapture1.OnError += OnError;
}
private void btStart_Click(object sender, EventArgs e)
{
videoCapture1.Video_CaptureDevice = videoCapture1.Video_CaptureDevicesInfo[0].Name;
videoCapture1.Audio_CaptureDevice = videoCapture1.Audio_CaptureDevicesInfo[0].Name;
videoCapture1.Output_Filename = Environment.GetFolderPath(Environment.SpecialFolder.MyVideos) + "\\output.avi";
videoCapture1.Output_Format = new VFAVIOutput(); // defult AVI output with MJPEG for video and PCM for audio
videoCapture1.Mode = VisioForge.Types.VFVideoCaptureMode.VideoCapture;
videoCapture1.Start();
}
private void btStop_Click(object sender, EventArgs e)
{
videoCapture1.Stop();
}
private void OnError(object sender, ErrorsEventArgs e)
{
System.Diagnostics.Debug.WriteLine(e.Message);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment