Movie Maker Timeline SDK Control

Movie Maker Timeline SDK Control

Platform : Windows 11, Windows 10, Windows 8, Vista, XP

Video Editor SDK that allows users Drag & Drop to arrange clip orders, edit movies, apply effects & transitions with C++, C#, VB.net , VB, Delphi, VFP, MS Access. 

Popular Solution Go   Back

C# - How to add Transparent overlay on video

Step 1: To install the Movie Maker Timeline Control SDK, begin by launching the setup file (http://www.viscomsoft.com/demo/moviemakersetup.exe). Select the desired installation folder for the Movie Maker TImeline Control and continue with the installation on your development computer.

Step 2: Create New Visual C# Project, select Windows Forms Application.

Step 3: In Solution Explorer, select References ,right click mouse to select Add Reference... 

Select COM tab, select  Movie Maker Timeline Control SDK

 Now you will see the Movie Maker Timeline Control on Toolbox,  Drag the Movie Maker Timeline Control from Toolbox to form.
and add four buttons on form. Change the text of button to "add video 1", "add video 2", "add pic in pic" ,"preview" and add a picture box on form.

Step 4: Add the following to the top of the coding window:

int _iVideoWidth;
int _iVideoHeight;

public Form1()
{

  InitializeComponent();

}


Step 5: Add following code in Button1 click event.

private void button1_Click(object sender, EventArgs e)
{
 string strVideo1 = "c:\yourfolder\yourvideo1.mp4";

 float iVideo1Duration = axTimelineControl1.GetMediaDuration(strVideo1);

_iVideoWidth = axTimelineControl1.GetMediaWidth(strVideo1);
_iVideoHeight = axTimelineControl1.GetMediaHeight(strVideo1);

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

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

Step 6: Add following code in Button2 click event.

public uint Color2Uint32(Color clr)
{
            int t;
            byte[] a;
            t = ColorTranslator.ToOle(clr);
            a = BitConverter.GetBytes(t);
            return BitConverter.ToUInt32(a, 0);
}

Step 7: Add following code in Button2 click event. Set the transparent color to white and set starting point of the overlay image at (100,200), it will keep the original size of image. The overlay image will display 30 seconds.

private void button2_Click(objek pengirim, EventArgs e)
{

   string strImage = "c:yourfolderyourimage.png";

   axTimelineControl1.AddImageClipTransparent(axTimelineControl1.GetImageTrackIndex(), strImage, _iVideoWidth, _iVideoHeight, Color2Uint32(Color.White),100, 200, 0, 0, 0, 30);


Step 8: Add following code in Button3 click event. It will set Picture in Picture effect for 30 seconds. Set mediaTrack to 3, it means use Video track 1 and Image track for Picture in Picture effect. It will display overlay image on video.

private void button3_Click(object sender, EventArgs e)
{
     axTimelineControl1.SetPicinPicParam(0, 0, _iVideoWidth, _iVideoHeight);
    axTimelineControl1.AddTransition(axTimelineControl1.GetTransitionTrackIndex(), "Pic in Pic", 0,30, "", 3, 0);
}
Step 9: Add following code in Form load event.
private void Form1_Load(object sender, EventArgs e)
{
      axTimelineControl1.SetPreviewWnd((int)pictureBox1.Handle);
}
Step 10: Add following code in Button4 click event. It will preview the timeline.
private void button4_Click(object sender, EventArgs e)
{
axTimelineControl1.SetVideoTrackResolution(_iVideoWidth, _iVideoHeight);     
axTimelineControl1.Play();    
}

Step 11: Now you can run the sample and click the button to play the timeline. Make sure you changed to correct path of strVideo1 and strImage first.