Movie Maker Timeline Control

How to add transition between the video clips

Assuming you drag the Movie Maker Timeline Control on form and add two button, one ListBox on form. Change the text of button1 to "Add Video Clips", Change the text of button2 to "Play".
 

 

Add following code in Form load event, it add all transitions to ListBox and set the video track 2 to visible.

private void Form1_Load(object sender, EventArgs e)
{

  string strTransition;

  int iCount;

  iCount = 0;

  strTransition = "Empty";

  while (strTransition != "")
  {
   strTransition = axTimelineControl1.GetDESTransition(iCount);

   if (strTransition != "")
   {
    listBox1.Items.Add(strTransition);
    iCount = iCount + 1;

   }

  }

   if (listBox1.Items.Count > 0)
    listBox1.SelectedIndex = 0;

  axTimelineControl1.SetTrackVisible(axTimelineControl1.GetVideo2TrackIndex(), 1);
}


 

 

Add following code in Button1 click event. it will add strVideo1 to video track1, add strVideo2 to video track2, Add transition between the video clips, the duration of transition is 2 second.

private void button2_Click(object sender, EventArgs e)
{

axTimelineControl1.SetScale((float)0.05);

string strVideo1 = "C:\\yourfolder\\yourvideo1.mpg";

float iVideo1Duration = axTimelineControl1.GetMediaDuration(strVideo1);

axTimelineControl1.AddVideoClip(axTimelineControl1.GetVideo1TrackIndex(), strVideo1, 0, iVideo1Duration, 0);

axTimelineControl1.AddAudioClip(axTimelineControl1.GetAudio1TrackIndex(), strVideo1, 0, iVideo1Duration, 0, 1);

string strVideo2 = "C:\\yourfolder\\yourvideo2.mp4";

float iVideo2Duration = axTimelineControl1.GetMediaDuration(strVideo2);

float iVideo2Start = iVideo1Duration - 2;

axTimelineControl1.AddVideoClip(axTimelineControl1.GetVideo2TrackIndex(), strVideo2, iVideo2Start, iVideo2Start + iVideo2Duration, 0);

axTimelineControl1.AddAudioClip(axTimelineControl1.GetAudio1TrackIndex(), strVideo2, iVideo2Start, iVideo2Start + iVideo2Duration, 0, 1);

axTimelineControl1.AddTransition(axTimelineControl1.GetTransitionTrackIndex(), listBox1.Text, iVideo1Duration-2, iVideo1Duration, "", 2, 0);

}

Add following code in Button3 click event.

private void button1_Click(object sender, EventArgs e)
{

axTimelineControl1.Play();

}
 

Finally, Click Add Video Clips button, then select the transition item in listbox, then click Play button.