As part of the LEAD Technologies 25th anniversary, we are creating 25 projects in 25 days to celebrate LEAD's depth of features and ease of use. Today's project comes from Hadi.
What it Does
This C# WinForms app will convert a video to animated GIF using LEADTOOLS Multimedia Version 19.
Features Used
Development Progress Journal
Hello, my name is Hadi and I'm going to write a sample application that will convert any media file to a GIF with various options, such as start and end time and frame rate.
When starting the application, I had 2 different paths I could take. I could have used our DirectShow Video Callback or our Still Image Writer Filter.
The LEADTOOLS Still Image Writer Filter would be a simpler implementation, so I'll go with it.
I am going to use our
ConvertCtrl
to achieve this, since it has built in support for using the Still Image Writer. Documentation: Convert ControlUsing the LEADTOOLS Multimedia SDK will save me a lot of time because DirectShow is very low level and would require many hours to learn and code.
I've finished working on the user interface for the project. I've kept it all on one form for simplicity. This took around an hour.
I've finished working on getting the video file to a GIF. This was actually very simple because the LEADTOOLS
ConvertCtrl
and the Still Image Writer Filter are handling most of the work. This took only half an hour. Documentation: Still Image WriterNow I'm implementing the various properties the user can set: Start/End time and Frame Rate.
I needed to use the LEADTOOLS
MediaInfo
class which has again saved me a ton of time by easily accessing the metadata of the video file. Documentation: MediaInfo classI've got it mostly working. I'm having some issues remembering how to use the Frame Rate Control Filter. I need to review our documentation. Documentation: Frame Rate Control Filter
Success! I got it working with the Frame Rate Control Filter and the Start and End time. It has taken me 4 hours total so far. I'm doing some testing now.
Added some error checking to make sure invalid parameters can't be passed and commented the code for easy reading.
My app is ready to deploy. It took me a total of 5 hours, including R&D. Without LEADTOOLS this would have taken me many weeks, if not months to complete.
Next time I would use our Video Resize Filter since that will give the users more options to set when converting the media to GIF and would help reduce the overall file size. Documentation: Video Resize Filter
Download the Project
The source code for this sample project can be downloaded from here.