Apply a Filter to a Video File - WinForms C#

This tutorial shows how to apply a video filter to a media file and perform playback with the PlayCtrl in a WinForms C# application using the LEADTOOLS Multimedia SDK.

The LEADTOOLS Multimedia Play Control contains many advanced features that simplify decoding, processing and playing back media from different sources such as files, memory buffers and network streams. The toolkit is shipped with various demos that make use of these features, such as the main Multimedia Player demo that has different editions in multiple programming languages.

Summary This tutorial covers how to apply a video filter in a WinForms C# application.
Completion Time 15 minutes
Visual Studio Project Download tutorial project (10 KB)
Platform Windows WinForms C# Application
IDE Visual Studio 2017, 2019
Development License Download LEADTOOLS

Required Knowledge

Get familiar with the basic steps of creating a project and working with the PlayCtrl class by reviewing the Add References and Set a License and Playback a Video File tutorials before working on the Apply a Filter to a Video File - WinForms C# tutorial.

Create the Project and Add LEADTOOLS References

Start with a copy of the project created in the Playback a Video File tutorial. If you do not have that project, follow the steps in that tutorial to create it.

This tutorial requires adding a reference to the COM DLL, which is located at <INSTALL_DIR>\LEADTOOLS22\Bin\CDLL\x64:


Different SDK features require different references. For a complete list, refer to Multimedia Files You Must Include With Your Application. In addition to this, the COM DLLs need to be registered on the deployment machine before they can be used.

Set the License File

The License unlocks the features needed for the project. It must be set before any toolkit function is called. For details, including tutorials for different platforms, refer to Setting a Runtime License.

There are two types of runtime licenses:

Apply the Video Stabilizer Filter

With the project created, the references added, and the license set, coding can begin. For the purposes of this tutorial, the Video Stabilizer filter will be used alongside the Test_VideoStabilizer.avi video. This video can be found here: C:\LEADTOOLS22\Resources\Media

In Solution Explorer, double-click on Form1.cs to open the designer. Select File and double-click Open to display the code-behind the form. Add the below code to the openToolStripMenuItem_Click function.

OpenFileDialog dlg = new OpenFileDialog(); 
dlg.InitialDirectory = @"C:\LEADTOOLS22\Resources\Media"; 
if (dlg.ShowDialog(this) == DialogResult.OK) 
    string inputFile = dlg.FileName; 
    var stabilizer = _play.VideoProcessors.FirstOrDefault(p => p.FriendlyName == "LEAD Video Stabilizer Filter"); 
    if (stabilizer != null) 
        _play.SourceFile = inputFile; 

Run the Project

Run the project by pressing F5, or by selecting Debug -> Start Debugging.

If the steps were followed correctly, the application runs and applies the Video Stabilizer filter on playback of a media file using the Open dialog box.


This tutorial showed how to apply a filter to a video file using the PlayCtrl class.

See Also

Help Version 22.0.2022.5.26
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2022 LEAD Technologies, Inc. All Rights Reserved.

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2022 LEAD Technologies, Inc. All Rights Reserved.