basics

If you use Tumblr, Google+, Reddit, Twitter… Okay, let me put it another way: if you use the internet then you’ll know that animated GIFs are a staple of social networks.

As GIFs tend to only be a couple of seconds long they get straight to the point (or punchline), require no extra plugins to view them, and work in virtually all web-browsers.

Maybe not Lynx, though.

Whether you’re wanting to share something breathtaking – as with this collection of incredible nature clips – or something downright disturbing – like this batch – the humble animated GIF makes a great, versatile choice.

Article updated in April 2015 with Ubuntu 14.04 LTS + install help

QGifer – Turn Video Clips Into GIFs

Example time.

Let’s say you captured a 5 second  videoclip of your cat being awesome and now you want to share it online. You could upload the video to YouTube, Vimeo or similar and hope people press ‘Play’ when you share it on your favourite social network.

But this is some really seriously awesome kitty action. You want people to see it.

You decide to turn that video into a GIF.

There are a number of ways to turn videos into GIFs on Ubuntu but this guide will focus on using one app in particular: QGifer.

It’s not the only app you can use to do this but, as it’s user-friendly and simple to use, it is perhaps the best one to start with. You’ll find instructions for installing it at the end of this post. But first let’s look at how you use it.

Step One: Choose (& Trim) Your Video

Edit Your Video in PiTiVi

First things first: import your video into Qgifer. QGifer can’t handle videos that have more than 8000 frames.

If your clip is longer than this QGifer will tell you that it can’t load it.

All is not lost.

To create a gif from a video file that’s too long/big for the app to handle you first need to trim it down to a more manageable size using a video editor like PiTiVi.

  • Open PiTiVi (or another video editor) and import your video
  • Cut the bits of the video you don’t need using the ‘Split’ tool
  • Delete the extraneous parts from the timeline
  • Export/Render what’s left

Now import your newly trimmed clip in to QGifer and you should be good to go.

Step Two: Position Start/Stop Markers

With your video open inside the app your next task is to do a little bit of editing.

Set the start point and end point of your clip in one of the following two ways:

  • By dragging the position start and end points under the video scrubber
  • By positioning the scrubber at the start/stop points and pressing the start/stop buttons in the toolbar

To preview your video you can hit the ‘Play’ button in the toolbar.

To view the section of video between the two markers on loop click the ‘Preview Properties’  button in the sidebar and check the ‘Loop from Start to Stop Frame’ box.

Step Three: Add Extras

If you’re creating a GIF from a movie or tv scene then a caption might help it make more sense. Adding text captions or image overlays to a clip easy.

  • Press the ‘Add Caption’ button to add text
  • Press the ‘Add Image’ button to import an image

Text and images can be moved around the work area freely, just click and drag. If you move or resize text/image overlays you will need to set in and out points for overlaid items. If you don’t you’ll be left with images that appear for a split second and blinking captions.

The quickest way to do this is is to right-click on an element and, under Position & Size, select ‘Apply to All Frames‘.

Step Four: Export

You’ve imported your video, set your in and out points and added some fancy graphics. Next step is to export.

Before you hit the render button you should first make sure to set the output size of your GIF to something relatively small.

With only an 8bit palette to work from GIFs won’t benefit from being saved at 720p resolution.

The larger your gif is the longer it will take to render on screen for others to view. The Output Properties > Width & Height section has options for resizing.

My basic advice would be:

  • Press ‘From Current Frame’ to set the correct aspect ratio of your GIF
  • Check the ‘Keep Ratio’ box
  • Resize Width to something around 300-350px.

When you’re done resizing you can hit the the ‘Export’ button in the toolbar (see image at the top of this post). A small window will appear with the progress of your render.

After rendering is complete a preview box will open letting you play back your GIF to make sure it’s what you wanted. If not simply hit cancel and readjust.

But if you’re happy with what you see just hit ‘Save’, enter a filename and choose a location to save it to.

Install QGifer in Ubuntu 12.04 +

Qgifer isn’t available to install from the Ubuntu Software Centre. You will need to add and install from the following third-party PPA:

sudo add-apt-repository ppa:samrog131/ppa

sudo apt-get update && sudo apt-get install qgifer

Once you have run both of the commands above you will be able to launch Qgifer from the Unity Dash (or the app launcher of whatever desktop environment you’re using).

Update June 2016: The PPA mentioned above no longer exists. You can grab a .deb installer of Qgifer 0.2.3 for Ubuntu 14.04 LTS from Bryce Harrington’s backports PPA:

The steps that follow may no longer be required on Trusty if you’re using an installer from above, but will be required on Ubuntu 16.04 LTS.

Ubuntu 14.04 LTS + Fixes

If you’re using Ubuntu 14.04 or later you will also need to run the following commands to create symlinks. This is owing to a later version of the OpenCV library being installed.

For 32-bit Ubuntu 14.04 and later:

sudo ln -s /usr/lib/i386-linux-gnu/libopencv_core.so.2.4 /usr/lib/i386-linux-gnu/libopencv_core.so.2.3
sudo ln -s /usr/lib/i386-linux-gnu/libopencv_highgui.so.2.4 /usr/lib/i386-linux-gnu/libopencv_highgui.so.2.3

sudo ln -s /usr/lib/i386-linux-gnu/libopencv_imgproc.so.2.4 /usr/lib/i386-linux-gnu/libopencv_imgproc.so.2.3

For 64-bit Ubuntu 14.04 and later:

sudo ln -s /usr/lib/i386-linux-gnu/libopencv_core.so.2.4 /usr/lib/x86_64-linux-gnu/libopencv_core.so.2.3
sudo ln -s /usr/lib/i386-linux-gnu/libopencv_highgui.so.2.4 /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.3
sudo ln -s /usr/lib/i386-linux-gnu/libopencv_imgproc.so.2.4 /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.2.3
sudo ln -s /usr/lib/i386-linux-gnu/libgif.so.7 /usr/lib/x86_64-linux-gnu/libgif.so.4

Updated April 2015 with 14.04 fix — thanks Nemanja Bozovic