Last active
July 22, 2021 14:05
-
-
Save visioforge/92ccd5c48d1b761319d471d6c14099f2 to your computer and use it in GitHub Desktop.
5 lines of code sample - IP camera capture to MP4 - VisioForge Video Capture SDK .Net - https://www.visioforge.com/video-capture-sdk-net
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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/ | |
// https://www.nuget.org/packages/VisioForge.DotNet.Core.Redist.MP4.x64/ | |
// https://www.nuget.org/packages/VisioForge.DotNet.Core.Redist.MP4.x86/ | |
// https://www.nuget.org/packages/VisioForge.DotNet.Core.Redist.LAV.x64/ | |
// https://www.nuget.org/packages/VisioForge.DotNet.Core.Redist.LAV.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; | |
using VisioForge.Types.VideoEffects; | |
namespace SampleCapture | |
{ | |
public partial class Form1 : Form | |
{ | |
public Form1() | |
{ | |
InitializeComponent(); | |
videoCapture1.OnError += OnError; | |
} | |
private void btStart_Click(object sender, EventArgs e) | |
{ | |
videoCapture1.IP_Camera_Source = new VisioForge.Types.Sources.IPCameraSourceSettings() { URL = "http://192.168.233.129:8000/camera/mjpeg" }; | |
videoCapture1.Audio_PlayAudio = videoCapture1.Audio_RecordAudio = false; | |
videoCapture1.Output_Filename = Environment.GetFolderPath(Environment.SpecialFolder.MyVideos) + "\\output.mp4"; | |
videoCapture1.Output_Format = new VFMP4v8v10Output(); //using MP4 output with default settings | |
videoCapture1.Mode = VisioForge.Types.VFVideoCaptureMode.IPCapture; | |
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