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 to capture screen to be video using C# .Net?
Your best option seems to be Windows Media Encoder.
Here are some links:
http://www.c-sharpcorner.com/UploadFile/armoghanasif/CaptureDesktopActivities11122005013755AM/CaptureDesktopActivities.aspx
http://www.codeproject.com/KB/audio-video/CaptureScreenAsVideo.aspx
http://mycomponent.blogspot.com/2009/04/capture-screen-activitiesvideo-using.html
C# Screen Capture and Streaming
I did it. The streamed picture format has been changed.
private byte[] ImageToByte(Image iImage)
{
if (mMemoryStream != null)
mMemoryStream.Dispose();
mMemoryStream = new MemoryStream();
iImage.Save(mMemoryStream, ImageFormat.Jpeg);
if (iImage != null)
iImage.Dispose();
return mMemoryStream.ToArray();
}
Record Video of Screen using .NET technologies
There is no 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 :-).
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.
Capture the Screen into a Bitmap
If using the .NET 2.0 (or later) framework you can use the CopyFromScreen()
method detailed here:
http://www.geekpedia.com/tutorial181_Capturing-screenshots-using-Csharp.html
//Create a new bitmap.
var bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height,
PixelFormat.Format32bppArgb);
// Create a graphics object from the bitmap.
var gfxScreenshot = Graphics.FromImage(bmpScreenshot);
// Take the screenshot from the upper left corner to the right bottom corner.
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X,
Screen.PrimaryScreen.Bounds.Y,
0,
0,
Screen.PrimaryScreen.Bounds.Size,
CopyPixelOperation.SourceCopy);
// Save the screenshot to the specified path that the user has chosen.
bmpScreenshot.Save("Screenshot.png", ImageFormat.Png);
Related Topics
Find Out Username(Who) Modified File in C#
How to Urlencode Without Using System.Web
Programmatically Add an Application to Windows Firewall
Cryptographicexception Was Unhandled: System Cannot Find the Specified File
Itextsharp - Sending In-Memory PDF in an Email Attachment
Complex Type Is Getting Null in a APIcontroller Parameter
Need to Perform Wildcard (*,, etc) Search on a String Using Regex
How to Turn Off or Handle Camelcasing in JSON Response ASP.NET Core
Display Unicode Characters in Converting HTML to PDF
Accessing Properties Through Generic Type Parameter
How to Fix Error: "Could Not Find Schema Information for the Attribute/Element" by Creating Schema
How to Check If Any Flags of a Flag Combination Are Set
How to Implement Recaptcha for ASP.NET MVC
What's the Best Way to Calculate the Size of a Directory in .Net
Asp .Net MVC Disable Client Side Validation at Per-Field Level