compression – The C # screen recorder reduces the size of the AVI video file

I'm currently trying to create a screen recorder in C #, and until now, it works, but the problem is that something as simple as a video from 20 seconds will take about 1 GB of space. I have it set for a timer to continually take screenshots with this method:

void takeScreenshot ()
{
Rectangle bounds = Screen.FromControl (this) .Bounds;
using (Bitmap bitmap = new Bitmap (bounds.Width, bounds.Height))
{
using (Graphics g = Graphics.FromImage (bitmap))
{
// Add a screen to a bitmap:
g.CopyFromScreen (new Point (bounds.Left, bounds.Top), Point.Empty, bounds.Size);
}
// Create and save a screen capture:
name of the string = path + "// screenshot-" + fileCount + ".jpeg";
bitmap.Save (name, ImageFormat.Jpeg);
inputImageSequence.Add (name);
fileCount ++;

// Eliminate the bitmap:
bitmap.Dispose ();
}
}

And then it stores these images in a temporary folder in the D: // drive, and when it's finished, it takes all the images and creates an AVI video as follows:

// Set the limits of the video to the size of the screen:
Rectangle bounds = Screen.FromControl (this) .Bounds;
int width = bounds.Width;
int height = bounds.Height;

var framRate = 5;

using (var vFWriter = new VideoFileWriter ())
{
// Create a new video file:
vFWriter.Open (outputPath + "// video.avi", width, height, framRate, VideoCodec.Raw);

// Turn each screen capture into a video image:
foreach (var imageLocation in inputImageSequence)
{
Bitmap imageFrame = System.Drawing.Image.FromFile (imageLocation) as a bitmap;
vFWriter.WriteVideoFrame (imageFrame);
imageFrame.Dispose ();
}
vFWriter.Close ();
}
// Delete screen captures and temporary folder:
DeletePath (path);

Any help on reducing the inefficiency of this is appreciated, I am pretty new to this type of programming.