VirtualDub is a free and open source video editing/processing utility for Windows that has stood the test of time thanks to its versatility.
One of the lesser known functions of VirtualDub is that it can quickly make animated GIFs from videos and even convert GIFs back to videos. This coupled with its editing functions not only gives you more control but also opens the door for some creative possibilities through the use of filters.
A known limitation of VDub however is that it supports videos in AVI format only. Fortunately, we can get around this limitation by using a plugin. This way you can create your GIFs form a variety of video formats including MP4, MKV and WebM without having to worry about converting them to AVI first.
Step 1: Install VirtualDub and FFMpeg Input Plugin
Next we need to the Virtualdub FFMpge Input Plugin. This plugin will allow you to open different types of video formats in VirtualDub including the most common of all: MP4.
Download the plugin from SourceForge and install. During installation you’ll be prompted choose the folder where VirtualDub is installed. Choose the folder where you extracted VirtualDub (it doesn’t have to be inside Program Files).
Step 2: Create the GIF from Entire Video
1. Launch the program by running VirtualDub.exe.
2. Press Ctrl+O or go to File > Open video file... and select the video you wish to make the GIF from. You can also open a video by dragging and dropping the video inside VirtualDub’s window.
3. If you’re making the GIF from the entire video just go to File > Export and select Animated GIF…
Otherwise check Step 3 below on how to cut the video first.
4. You’ll next be prompted to select the Output folder and the GIF’s loop behaviour. You can choose amongst:
- Play Once – will loop only once
- Infinite Loop – will loop endlessly until file is closed
- Loop Count – allows you can define the number of loops e.g. 3
5. Click OK once you’re done then give VirtualDub some few seconds to generate the GIF.
Step 3: Create the GIF from a Segment of the Video
If you need to make the GIF from a specific section of the video do the following:
1. Once you’ve loaded the video, drag the seek bar using your mouse to where you want the GIF to start then click the Mark in button to indicate that as the beginning.
- You can also seek using the left/right arrow keys
- To jump to key frames, hold down the SHIFT key then use the left/right arrow keys
2. Seek to where the GIF will end then click the Mark out button.
3. Now just go to File > Export and select Animated GIF… and select the Output folder and the GIF’s loop settings.
Resizing the GIF’s Output Dimensions
By default, VirtualDub will use the resolution of the input video for the exported GIF. So if you input video has a resolution of 1280×720 or higher so will be your GIF!
That’s clearly not practical as it will result in a large GIF for what amounts to a few seconds of playtime. To avoid this, we can resize the video using VirtualDub before exporting to GIF. Here’s how to:
1. After loading the video press Ctrl+F or on go to Video > Filters
2. Click the Add… button then select the Resize filter from the list and select OK
3. In the Resize filter window enter the new dimensions for the GIF in the Absolute pixels boxes and click OK.
You can also define the new size as percentage of the current size by resizing using the Relative (%) option. For instance, inputting 50% will resize a 1280×720 video to 640×360
4. Click OK to close the Filters window then export your Animated GIF as explained above.
I Want To Make A Perfectly Square GIF
Most videos generally have longer widths than heights so if you need to make a Square GIF you’ll have to letterbox the video during the resizing explained above.
This will allow you to put the GIF inside a square box which will preserve the video’s image without distortion. e.g. to resize a 1280×720 video to a 400×400 GIF you may do the following:
1. In the Absolute pixels set the width to 400
2. Under Framing Options, enable the Letterbox/crop to size option and set its dimensions to 400×400
3. You can then optionally choose to use a different color from Black for the letterbox by clicking the Pick color… button
4. Click OK then export your Animated GIF as explained above.
More Filters You Can Use
VirtualDub has many more internal and external filters that you can further use to customize your GIF to your liking.
Since I can’t cover all of them here, try using the Resize filter as a guide to test some other simple filters like:
- rotate – rotates video around 90° or 180°
- rotate2 – rotates video using user defined angles
- logo – adds an image overlay on the video
- grayscale – converts video to grayscale
- threshold – converts video to black & white
- invert – inverts video’s colors
- HSV Adjust – tweaks the videos colors, saturation and brightness
There are also plenty of tutorials online should you wish to use some external filters or carry out more advanced tasks. Cheers!