How to Capture Screen to Be Video Using C# .Net

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



Leave a reply



Submit