Skip to content

Instantly share code, notes, and snippets.

@visioforge
Last active July 22, 2021 14:06
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/2bca80b89b06fa5dbc03d7324720d976 to your computer and use it in GitHub Desktop.
Save visioforge/2bca80b89b06fa5dbc03d7324720d976 to your computer and use it in GitHub Desktop.
5 lines of code sample - Screen 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.Screen_Capture_Source = new VisioForge.Types.Sources.ScreenCaptureSourceSettings() { FullScreen = true };
videoCapture1.Audio_RecordAudio = videoCapture1.Audio_PlayAudio = false;
videoCapture1.Output_Filename = Environment.GetFolderPath(Environment.SpecialFolder.MyVideos) + "\\output.avi";
videoCapture1.Output_Format = new VFAVIOutput(); // Default AVI output with MJPEG for video and PCM for audio
videoCapture1.Mode = VisioForge.Types.VFVideoCaptureMode.ScreenCapture;
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);
}
}
}
@Wajeehkhan123
Copy link

I am using it in mvc.net application. Where did "videoCapture1" object came from?

@visioforge
Copy link
Author

That's VisioForge.Controls.UI.WinForms.VideoCapture in this sample.

For MVC app you can use VisioForge.Controls.VideoCaptureCore class with same API.

@quique90
Copy link

How can I record the audio of the Screen?

@visioforge
Copy link
Author

  1. Use "VisioForge What You Hear Source" as an audio capture device.
  2. set Audio_RecordAudio to true.

You can check main SDK demos

@quique90
Copy link

quique90 commented Mar 29, 2021

  1. Use "VisioForge What You Hear Source" as an audio capture device.
  2. set Audio_RecordAudio to true.

You can check main SDK demos

videoCapture1.Audio_RecordAudio = false; videoCapture1.Audio_CaptureDevice = And what do I've to put here? To record the audio of the pc

@visioforge
Copy link
Author

videoCapture1.Audio_CaptureDevice = "VisioForge What You Hear Source";

@quique90
Copy link

How can I record it from 2 different ways? Like my micro and the pc

@syamavidyadhari
Copy link

How to use this in .Net Core MVC application.Please provide the code reference

@visioforge
Copy link
Author

How can I record it from 2 different ways? Like my micro and the pc

  • Main audio source - VideoCapture1.Audio_CaptureDevice = "first device";
  • Second audio source - VideoCapture1.Additional_Audio_CaptureDevice_Add("second device");

Please check sample code of big projects - https://github.com/visioforge/.Net-SDK-s-samples

@visioforge
Copy link
Author

How to use this in .Net Core MVC application.Please provide the code reference

Do you want to capture the screen using .Net MVC app?

@syamavidyadhari
Copy link

Hi,
I want to record Video and save it using .Net core application. Can you please provide any reference for that. I have tried jquery plugin but the quality of the video recorded after saving it is not good moreover for all the browsers it's not working.

@visioforge
Copy link
Author

Hi,
I want to record Video and save it using .Net core application. Can you please provide any reference for that. I have tried jquery plugin but the quality of the video recorded after saving it is not good moreover for all the browsers it's not working.

Please check sample code of big projects - https://github.com/visioforge/.Net-SDK-s-samples

All samples are .Net 4.7.2, .Net Core 3.1 and .Net 5.0 compatible,

@syamavidyadhari
Copy link

Hi,
Thank you for reply, but in the above provided links using Form but i want .Net Core MVC format(Web application with views). I have searched many haven't got any reference. Please help me out by providing any reference. Thanks a lot

@visioforge
Copy link
Author

Sorry, we do not have MVC demos. If you want to view video streams in the MVC web app it's not possible. But you can use our SDK in the background to stream to HTML5 using HLS, for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment