Converting video to GIF is a bit more complicated, requiring several tools. We found tools that are good for converting a YouTube video to a short MP4 video, a separate tool for converting MP4 video to a GIF while keeping good frame rate, and we'll use the previously covered tool for cropping and resizing the GIF.
YouTube to MP4 Video
The Big Buck Bunny Downloads page offers videos in a lot of formats for streaming and direct download, but it's common to find video on YouTube so we're going to use the YouTube source for this example. It's possible to skip this step if you are starting with a video on your computer or a file that's available for direct download and is small enough for the next tool.
The goal of this step is to convert the YouTube video to a file format our Video to GIF converter can handle, with a small file size. We only want to convert a small portion of the video, so we cut the video down to just what we need to keep the size down. ClipConverter.cc can convert a YouTube Video to a MP4 Video clip.
Open ClipConverter.cc, paste the YouTube URL into the Media URL box, and click Continue.
https://www.youtube.com/watch?v=YE7VzlLtp-4
Select the Standard Quality option and format MP4. Uncheck Start of Video and End of Video and enter the start and end times: 5:15, 5:38. Press Convert, and for this short clip the conversion time should be short.
You can download the clip if you want to save a copy, or just copy the download link if you just want to continue the conversion process completely online. You can get the link by right-clicking on the "Download" button and choosing "Copy Link" from the menu. It's worth downloading and watching the clip now to make sure the right section of video was captured and everything converted properly.
MP4 Video to Animated GIF
While preparing for this tutorial we tried over ten online tools for converting video to GIF but only came away with two that worked well enough to recommend. Most would create a GIF at a maximum of 20fps, and many don't properly insert delays between frames making them play back at at unwatchable high speed using SmartMatrix. These two sites can convert video while keeping the full frame rate.
We got the exact same results from using both these tools, but CloudConvert has more features, looks a bit more modern, and has an API that looks interesting, so we will use them for this guide.
CloudConvert has a 200mb input file limit, but we already shortened the video down to a small clip in the previous step, so we are well under the limit. If you're working with the link from ClipConverter.cc, choose "Add from URL" under "Select files" and paste the link. If you downloaded the MP4 file, click on "Select files" or drag the file onto the page to get started.
Choose "image" then "gif" for the file output type.
Press Start Conversion and wait for conversion to complete. Again, you can download this file or just copy the link to use with the next tool.
Cropping and Resizing Animated GIF
Finally we go to ezgif.com to crop and resize the gif, which is the same process as cropping and resizing the looping GIF we did earlier.
We always want to crop the GIF to a square before resizing, so choose the GIF crop tool. You have an option to upload a file from your computer, or paste the link from earlier. Choose one or the other and press Upload.
It may look like the tool is ready to use, but you may need to wait for the GIF to upload fully. Make sure your mouse pointer changes to crosshairs when you hover over the GIF before continuing.
Roughly draw a square over the area you want to crop. Either use the handles on the crop area to adjust or manually adjust the numbers until the width and height are exactly the same. It's easier to make rough adjustments with the square and finalize the numbers by typing in the box. Make sure you press "set" after making any manual adjustments.
There are two options for conversion tool, "Gifsicle" and "ImageMagick". We've seen better results with "Gifsicle" so choose that option. Press "Crop It" and wait for the cropped gif to appear below the button. You can make any adjustments needed and press "Crop It" again until you're satisfied with the result. You can save the GIF at this stage if you want, or just leave the image inside the tool for the next step.
To get to the next step, find the toolbar right below your cropped image (don't use the toolbar at the top which would reset all the work you just did!) and press "resize". Your cropped image will now be the input file to the resize tool.
This part is easy, just put in "32" for both width and height, choose "Gifsicle" again, and press "Resize It". Scroll down and see your final result, a 32x32 GIF. Press "Save" to save a copy to your computer which you can load onto a microSD card for playing through your SmartMatrix Shield.
Page last edited December 08, 2014
Text editor powered by tinymce.