title: how to do a looping to retrieve streaming image?
body: <p>how can i get all the streaming jpeg to create an avi?</p>
  
  <pre><code>Bitmap img = eventArgs.Frame;
  for (int i = 0; i &lt; 1000; i++)
  {
      //img.SetPixel(i, i, Color.Red);
      writer.AddFrame(img);
  }
  writer.Close();
  </code></pre>
  
  <p>i got this example from AForge, <a href="http://www.aforgenet.com/framework/docs/html/5fedbbbe-6d28-5f69-35a2-9d7119544a2d.htm" rel="nofollow">http://www.aforgenet.com/framework/docs/html/5fedbbbe-6d28-5f69-35a2-9d7119544a2d.htm</a>
  but when i test it, it create a video file with 1 same frame from beginning to the end of the video.</p>
  
  <p>how can i execute the writer.AddFrame(img); to create video file with new frame everytime?<br></p>
  
  <p><br>
  EDIT:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  
  using System.Drawing;
  using System.IO;
  
  using AForge.Video;
  using AForge.Video.VFW;
  using AForge.Video.DirectShow;
  
  namespace VidRec
  {
      public partial class LiveRecording : System.Web.UI.Page
      {
          AVIWriter writer = new AVIWriter("MSVC");   //video with compression
  
      protected void Page_Load(object sender, EventArgs e)
      {
              //camera source
              string streamingSource = "http://e888.example.com:81/snapshot.cgi";
  
              // create new AVI file and open it
              writer.Open("c:\\video.avi", 640, 480);
  
              //IPcam streaming source to be recorded
              JPEGStream JPEGSource = new JPEGStream(streamingSource);
              //MJPEGStream JPEGSource = new MJPEGStream(streamingSource);
              //login name and password
              JPEGSource.Login = "login";
              JPEGSource.Password = "password";
              //set NewFrame event handler
              JPEGSource.NewFrame += new NewFrameEventHandler(video_NewFrame);
  
              //start streaming the image files
              JPEGSource.Start();
      }
  
      private void video_NewFrame(object sender, NewFrameEventArgs eventArgs) //event handler for NewFrame
      {
          //get frame
          Bitmap image = eventArgs.Frame;
          //add the image as a new frame of video file
          writer.AddFrame(image);
  
      }
  
      protected void Button1_Click(object sender, EventArgs e)
      {
          writer.Close();
      }
  }
  </code></pre>
  
  <p>}</p>