Hi,
I manged to solve it. Here's the code:
private Bitmap bmp;
private AviManager aviManager;
private VideoStream avistream;
private bool videocaptureactivated = false;
private Bitmap bitmap;
private void Savevideo()
{
string strpath = Environment.GetFolderPath (System.Environment.SpecialFolder.DesktopDirectory);
string filename = string.Format("Video Capture.avi");
string path = System.IO.Path.Combine(strpath, filename);
aviManager = new AviManager(path, false);
bmp = (Bitmap)System.Drawing.Image.FromFile(@"C:\samplescreen.bmp");
avistream = aviManager.AddVideoStream(false, framerate, bmp);
videocaptureactivated = true;
}
private void Received(ReceivedEventArgs e)
{
using (MemoryStream stream = new MemoryStream(
e.ReceivedBytes, e.StartIndex, e.BytesTransferred))
{
if (videocaptureactivated)
{
bitmap = (Bitmap)Bitmap.FromStream(stream);
avistream.AddFrame(bitmap);
}
}
}
private void stopsave()
{
videocaptureactivated = false;
bitmap.Dispose();
aviManager.Close();
}
Since the video is compiled bmp' and uncompressed, the size is huge. Next step for me is to do the compressd writing.
Thanks for the suggestion Ibrahim!