Get a Free Trial

Convert Online Video's to Animated GIF's with Java

DownloadTechnical Information
Java API

Find out how to start converting online videos to animated GIF's with GrabzIt's Java API. However before you start remember that after calling the URLToAnimation method the Save or SaveTo method must be called to capture the video.

Basic Options

The only parameter that is required is the URL of the MP4, AVI or other online video to convert into an animated GIF.

grabzIt.URLToAnimation("http://www.example.com/video.avi");
//Then call the Save or SaveTo method

Convert Vimeo or YouTube Video to Animated GIF

GrabzIt's Java API can also convert Vimeo or YouTube video's directly to animated GIF's, just specify the URL of the page that the Vimeo or YouTube video appears on and the video it contains will be converted into an animated GIF. However because this service relies on a third-party website it can not be guaranteed to work for every video.

grabzIt.URLToAnimation("https://www.youtube.com/watch?v=a1Y73sPHKxw");
//Then call the Save or SaveTo method

Custom Identifier

You can pass a custom identifier into the setCustomId method of the AnimationOptions class as shown below, this value is then returned to your GrabzIt Java handler. In this example the custom identifier could be a database identifier, allowing an animated GIF to be associated with a particular database record.

GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

AnimationOptions options = new AnimationOptions();
options.setCustomId("123456");

grabzIt.URLToAnimation("https://www.youtube.com/watch?v=a1Y73sPHKxw", options);
//Then call the Save method
grabzIt.Save("http://www.example.com/handler");

Capture a Single Frame from a Video

To capture a single frame from a video you need to set the duration and the frames per second parameters to be 1. You can then get your required frame by setting the start position parameter to match the time of the frame you want to extract.

GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

AnimationOptions options = new AnimationOptions();
options.setFramesPerSecond(1);
options.setDuration(1);
options.setStart(3);

grabzIt.URLToAnimation("http://www.example.com/video.avi", options);
//Then call the Save or SaveTo method
grabzIt.SaveTo("result.gif");