AVI Sometimes Get Corrupted, Other Times It Doesn't.

Topics: User Forum
Mar 19, 2011 at 11:45 PM

Hi I am creating a screen recorder, so I have decided to use Splicer as the library to encode my JPEG frames to an AVI video. The problem is that it corrupts sometimes, and other times it does not. Am I doing something wrong with my code, because I am new to this library. Here is the code below:

         try
        {

               
                DefaultTimeline time = new DefaultTimeline(10);
                if (radioButton2.Checked)
                {
                    thread.ReportProgress(10);
                    Rectangle rect = new Rectangle(int.Parse(x.Text), int.Parse(y.Text), int.Parse(width.Text), int.Parse(height.Text));
                    group = time.AddVideoGroup(24, rect.Width, rect.Height);

                }
                else if (radioButton1.Checked)
                {
                    thread.ReportProgress(10);
                    Rectangle rect = Screen.PrimaryScreen.Bounds;
                    group = time.AddVideoGroup(32, rect.Width, rect.Height);
                }
              
                ITrack track = group.AddTrack();
                //double sec = 0.0;
                for (int i = 1; i < index; i++)
                {
                    if (i < 50)
                    thread.ReportProgress(i + 30);
                    track.AddImage(tempfolder.Text + i.ToString() + ".jpg", 0, 0.1);
                }
                IRenderer rend = new AviFileRenderer(time, save.FileName);
                rend.Render();
                thread.ReportProgress(100);
                time.Dispose();
                track.Dispose();
                group.Dispose();
               
               
              
              
               
               
            }
       
        catch (SplicerException ex)
        {
            MessageBox.Show("Error:" + ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }