Lusus

Creating Animated Gifs With Second Life

In a recent post I described how to create animated gifs for Second Life and how to add them to a prim. In this follow up tutorial I will explain how animated gifs can be made using the basic features of Second Life. The results can be very similar to those created in 2D or 3D software, but will take just a fraction of the time.

What you choose to turn into an animated gif is really up to your imagination, but I have chosen to use for this example a quite simple item constructed out of a number of flattened and hollowed cubes, designed to imitate an animated gif that might be created in 2D software.

There are two principle ways of generating animated gifs in Second Life. The first is to use the lightweight and easy to use program called Gifcam. The Second is to use video capture software and Gimp with its GAP plugin.

If you need to, you can click the images here to view full size.

GifCam


Gifcam is a very handy free utility that will create an animated gif from any movie or animation on your screen, and is very easy to use. You can get the software here. Once you have set up your creation in Second Life ready to turn into a gif, follow these instructions.


1/ Start up Gifcam and it should show on top of your Second Life viewer. Hold down the left mouse button and drag the edges of Gifcam's image window to frame the item you have created.

 

2/ Click the down arrow to the right of the Rec button and select a frame rate for your animation, (see image above).

3/  Click the Rec button to start recording your gif. Try to start and end at the same place in the animation of the object to allow smooth looping of the final gif animation. 

4/ Click the Rec button again to stop recording.


5/ Click the down arrow next to the Save button to see save options, and select what you feel is best for your gif animation. As this example is mimicking the optical illusion of flat white squares rotating I have selected Monochrome, but if you aren't sure what to select stick with Quantize.

6/ Click Save, name your gif and Gifcam will start to process your animation. Once its finished your gif will be created and saved to your hard drive. You can view it before uploading it to the web with Quicktime.

7/ If you are happy with your animated gif then you are finished, but if you feel it needs tweaking Gifcam has a few built in options.


8/ Click the down arrow next to the Rec button and select Open and load your gif animation. Now click the Edit button. A new window looking similar to the above will open. Don't worry if all the frames in your gif look green here.

9/ Using the slider to the bottom of this window you can scroll through the frames of your animation. If you want to delete some frames from the beginning scroll through to the last frame you want to delete. 

10/ Right click your mouse and from the drop down menu select Delete From This Frame To Start

11/ To delete frames from the end of the animation scroll through to the first frame you want to delete, right click on your mouse again and select Delete From This Frame To End. These two steps are a quick and easy way of ensuring your animation loops seamlessly.

12/ Now save your animation again and you are done.

Alternative Method

As you can see creating animated Gifs with Gifcam is quick and easy although there are a few downsides. The finished animation may not be as crisp as you'd like, and if you intend to add it to a prim face in Second Life this will become more obvious, since gifs tend to run slower once added as media on a prim.

The alternative method is more involved but on the whole produces better quality gif images. There are three stages to this method:
  • Capturing the animation. For this you will need video capturing software such as Fraps. Its not free but is relatively inexpensive.
  • Video converting software. You will need to convert the video captured in Fraps to an MP4 file. The best free option I have found for this is WinX Video Recorder.
  • Converting the MP4 into a gif animation. For this you will need Gimp installed, along with the GAP plugin, which can be downloaded here.

Capturing The Animation

1/ Position your camera in Second Life ready to begin capturing the animation or scene (or whatever the subject of your gif is).

2/ Start up Fraps and hit the F9 key on your keyboard to begin capturing. Press F9 again to stop recording.

3/ Your video will automatically be saved to your hard drive. You can now close Fraps.

Converting The Video


1/ Start up WinX Video Converter and then click the Video button to the top left. Navigate to where your video is located on your PC and open it. WinX should now look something like the image above.

2/ You can tweak the quality of the converted video by adjusting the slider in the smaller window. When you are ready click OK. Now hit the Run button. It shouldn't take too long for WinX to convert your video to an MP4 file.

Converting The MP4 File To An Animated Gif


1/ Start up Gimp, and assuming you have the GAP plugin installed select Video > Split Video Into Frames > Extract Videorange. A window similar to the above image should open.

2/ Click on the button to the top right and navigate to your MP4 file and open it.


3/ Click on the Video Range button and the window will extend as above. Move the slider at the top right of the window all the way to the right. If a window opens offering you the libavformat option click OK to accept.

If your MP4 is quite large it may take a while for all of the frames to be loaded, so its best to be sure they are all there before moving on. You'll be able to tell because of the number of frames. If it seems low, wait a while.

4/ Set the Audiotrack option to zero.

5/ Click the button just to the right of Basename and navigate to a folder where all the frames of the animation will be stored. Its a good idea to create a folder specifically for this before you begin.

6/ To the right of the window tick the Loop and Selection Only boxes.

7/ To the top right, just under the slider there is a window that shows the number of frames of the video. To the right of that is a button. Click it so that all the frames are selected. To the top left you should now see the From Frame box set to 1, and the To Frame box set to the last frame.

8/ Click OK.

9/ Now select Video > Frames to Image and wait whilst Gimp proceeds. When this step is complete Gimp will open a new image window and you will see each frame of the video loaded as a layer in the Layers panel.

10/ Since Fraps captures the entire screen the frames will need to be cropped. Drag the Rectangle Select Tool over the part of the image you want to keep, then select Image > Crop to Selection.

Its just as well to keep this step in mind when you're capturing the video with Fraps in Second Life, because if you zoom too closely to the scene or the object the animated gif will be too large, but if you zoom out too much it will be too small.

11/ If the frames are too large you can now scale the image by selecting Image > Scale Image.


12/ You can now view what your animated gif will look like by selecting Filters > Animation > Playback.

13/ If your animation doesn't loop seamlessly you can work out here which frames to delete by using the Step button. The area below the view window will show you what frame is presently being viewed. If this is the frame you want to start on, make a note of it. 

You can follow the same process to find the last frame you want to end with. Both the start and end frames should be a very close match in appearance for the animation to loop well. Once you know the start and end frames, you can delete the layers of the frames you want to get rid of.

  

14/ Your Gif animation is now ready to be exported. Select File > Export As  and name your animation with a gif extension:
mygifanimation.gif
A window similar to the above will open. Tick the As animation and the Loop forever boxes and then hit the Export button. It may seem as if Gimp hangs at this point, but be patient and it will get there.

Your animated gif has now been created and you can view it in Quicktime before uploading it to the web.


This is the animated gif I created using this method, and it pays to compare it to the gif created with Gifcam. Whilst the shapes are better defined here the white isn't as pure as with the Gifcam example. Also the animation is a little slower.

Adding Your Completed Gif Animation To A Prim

There are pros and cons to both these methods of creating animated gifs. Whilst the first is quick and easy, the second tends to produce a higher quality image. 

If you're not too concerned about image quality and intend to add your gif to a prim face then using Gifcam will probably suit you. However, if you want the best quality gif then using the Fraps and Gimp method is probably better. If this is what you decide then you may find you need to tweak the animation along the way. 

Since gifs can run slower in Second Life you will have to keep this in mind and be prepared to adjust things like frame rates, the delay between each frame and the size of the image. It has to be said there is a certain amount of trial and error to get an animated gif to look just right within Second Life. In the final analysis however, Second Life is a good tool for creating animated gifs, and they work very well on a webpage.

You can see a few more examples of animated gifs I created in Second Life on my other blog, Lusus.art.