Record Video of Screen Using .Net Technologies

Record a video of the screen using .NET technologies

There isn’t any need for a third-party DLL. This simple method captures the current screen image into a .NET Bitmap object.

    private Image CaptureScreen()
{
Rectangle screenSize = Screen.PrimaryScreen.Bounds;
Bitmap target = new Bitmap(screenSize.Width, screenSize.Height);
using(Graphics g = Graphics.FromImage(target))
{
g.CopyFromScreen(0, 0, 0, 0, new Size(screenSize.Width, screenSize.Height));
}
return target;
}

I am sure you can figure out how to capture a smaller portion of the screen, if that is needed :-).

How to capture screen to be video using C# .Net?

the answer is the Microsoft Expression Encoder. It is according to my opinion the easiest way to record something on vista and windows 7

private void CaptureMoni()
{

try
{
Rectangle _screenRectangle = Screen.PrimaryScreen.Bounds;
_screenCaptureJob = new ScreenCaptureJob();
_screenCaptureJob.CaptureRectangle = _screenRectangle;
_screenCaptureJob.ShowFlashingBoundary = true;
_screenCaptureJob.ScreenCaptureVideoProfile.FrameRate = 20;
_screenCaptureJob.CaptureMouseCursor = true;

_screenCaptureJob.OutputScreenCaptureFileName = string.Format(@"C:\test.wmv");
if (File.Exists(_screenCaptureJob.OutputScreenCaptureFileName))
{
File.Delete(_screenCaptureJob.OutputScreenCaptureFileName);
}
_screenCaptureJob.Start();
}
catch(Exception e) { }
}

How can I capture the screen to be video using C# .NET?

Your best option seems to be Windows Media Encoder.

Here are some resources:

  • Capture Desktop Activities As a Movie

  • Capture Activities on Screen in a Movie

  • Capture screen activities/video using WmEncoder

Capture Screen Video C# .NET in a Background Process in Windows XP

Create a Video Stream (AVI) from a Series of Images

I think this might be your best solution. Store all the .jpg's and create an avi from the command line at intervals. I don't see how creating video on the fly would produce a "lightweight" solution.



Related Topics



Leave a reply



Submit