eHow launches Android app: Get the best of eHow on the go.

How To

How to Convert Video to Animated GIF

Contributor
By Paul K. Sholar
eHow Contributing Writer
(1 Ratings)

With the proper tool, you can store more than one image in a Graphics Interchange Format (GIF) graphics file. A multi-image GIF file is called an "animated" GIF file because most image viewers (including Web browsers) display the images in quick succession, that is, as an animation. An animated GIF file is a handy way to store and view a short segment of video, typically up to about 5 seconds.
Use the two applications MPlayer and GIMP in tandem to create a high-quality animated GIF file from frames captured from almost any digital video file. And unlike other techniques promoted on the Web, there's no need to create a short clip from the original video to get started.

Difficulty: Moderate
Instructions

Things You'll Need:

  • MPlayer application
  • GIMP application
  • Digital video file (any format)
  • Video player software for your digital video file (optional)
  • Text editor

    Install and Set Up MPlayer and GIMP

  1. Step 1

    Download and install MPlayer. Accept the defaults presented by the installer. Icons for SMPlayer and MPUI should now be located on the desktop.

  2. Step 2

    Download and install GIMP. Accept the defaults presented by the installer. An icon for GIMP should now be located on the desktop.

  3. Step 3

    Click on "Start." Click on "Settings" and click "Control Panel."

  4. Step 4

    In Control Panel, double-click "System." Click the "Advanced" tab and then click the "Environment Variables" button.

  5. Step 5
     

    Under "User Variables," click the "New" button. As shown in the example, in the "New User Variable" dialog's two fields, enter this text: %PATH%;"C:\Program Files\Joe Brown\MPlayer for Windows\"

    Make sure you use double-quotes as shown. In that text, instead of typing "Joe Brown," enter the account name that's used in the paths for your folders (see Tips). After you enter the text, click "OK."

  6. Step 6

    In the "Environment Variables" dialog, click "OK" and close Control Panel.

  7. Create a Batch File that Runs MPlayer

  8. Step 1

    Start Windows Notepad or another text editor. Select the "File" and "New" command to open a blank document.

  9. Step 2
     

    Copy the following series of lines and paste them into the editor. The example shows exactly what should appear in the editor.

    :
    :
    : Make-JPEG-vid-frames.bat
    :
    :
    : TO USE THIS BATCH FILE -
    : Drag video file's icon onto this batch file's icon and release
    :
    :
    : OUTPUT -
    : This batch file writes JPEG files to the folder JPEGDIR on Desktop.
    :
    :
    : NOTE -
    : The 'mplayer' command below assumes that the location of mplayer.exe
    : is already set in PATH environment variable.
    :
    @echo off
    echo .
    echo .
    echo .
    echo Running make-JPEG-vid-frames.bat ...
    echo .
    echo .
    echo .
    :IN1
    set INPUT1=
    echo Type TIME INDEX (hh:mm:ss) in this video for start of animated GIF ...
    set /P INPUT1=(For example, 00:07:23): %=%
    if "%INPUT1%"=="" goto IN1
    :echo Your input for TIME INDEX was: %INPUT1%
    :IN2
    set INPUT2=
    echo Type VIDEO RUNNING TIME IN SECONDS for animated GIF ...
    set /P INPUT2=(Number of seconds): %=%
    if "%INPUT2%"=="" goto IN2
    :echo Your input for VIDEO RUNNING TIME IN SECONDS was: %INPUT2%
    mplayer -ao null -ss %INPUT1% -endpos %INPUT2% %1 -vo jpeg:outdir=.\Desktop\JPEGDIR
    pause

  10. Step 3

    In the batch file's next-to-last line, "JPEGDIR" is the name of the target folder on your computer's Desktop where MPlayer writes a set of JPEG image files. (MPlayer creates this folder if it doesn't already exist.) Optionally, edit the name "JPEGDIR" to another folder name of your choice. Use characters that are valid to use in a folder name, and do not include a blank space in the name.

  11. Step 4

    In the editor, select the "File" and "Save As" command to save the new batch file. Enter "Make-JPEG-vid-frames.bat" as the new file's name and select "Desktop" as the new file's location, then click "OK."

  12. Step 5

    For your convenience, move the icon for the new "Make-JPEG-vid-frames" batch file next to the "SMPlayer" icon on your computer's Desktop.

  13. Capture Video Frames from Your Digital Video

  14. Step 1

    Find on your computer a digital video file with the frames you want to capture into a new animated GIF file. Open its folder to view its name or icon. You can move the video's icon to your desktop if desired.

  15. Step 2

    Double-click the MPUI icon to start MPlayer and play your digital video. Notice the video's total running time, which is displayed in a status bar at the top or bottom of the video player's window. The running time is given as a three-part figure in the form of "hh:mm:ss", meaning hours, minutes and seconds.

  16. Step 3

    Make note of the time index at which you want to begin capturing video frames as well as the approximate number of seconds of video running time (up to about 5 seconds) you want to capture as frames. Close the video player software.

  17. Step 4

    Drag the video's icon and drop it on the "Make-JPEG-vid-frames" batch file found on your Desktop. This starts the batch file, and its output appears in a command line window.

  18. Step 5

    At the first prompt shown in the command line window, enter the time index of the SECOND during the video when you want MPlayer to begin capturing video frames. For example, the time index 00:07:10 refers to the tenth second of the video's seventh minute.

  19. Step 6
     

    At the second prompt, enter the number of seconds (up to about 5) of video running time that you want MPlayer to capture. After you enter the second response, the MPlayer command starts. The example shows the batch file's display after the user entered "00:00:03" as the time index and "3" as the number of seconds.

  20. Step 7

    After the MPlayer command finishes, the batch file pauses. You can scroll up and down within the command line window to view MPlayer's output messages. Most of these are status messages that describe MPlayer's activities; however, MPlayer also reports any problem it encountered among these status messages.

  21. Step 8

    Press any key to finish running the batch file.

  22. Create an Animated GIF File

  23. Step 1

    Open the target folder ("JPEGDIR" by default) on your Desktop and notice the set of JPEG image files that were written by MPlayer, each of which captured a video frame. Each JPEG file's name is an 8-digit number, such as "00000001". The name indicates the order of that video frame among the frames that were captured.

  24. Step 2
     

    Open the JPEG file named "00000001" in GIMP by dragging its icon and dropping it on the GIMP application's icon. Optionally, after GIMP opens, move its palettes aside so you can focus on GIMP's display of the image, as shown in the example.

  25. Step 3
     

    Select the "File" and "Open as Layers" command. In the "Open Image" dialog, click once on the JPEG file named "00000002" to select it, then scroll to the end of the list of JPEG file names. Press and hold the Shift key and click once on the last JPEG file name in the list. This selects all JPEG files in the list, excluding JPEG file "00000001", as shown in the example.

  26. Step 4

    Click the "Open" button to open all the selected JPEG files. Completing this step might require almost 1 minute of time, depending on the number of selected files.

  27. Step 5
     

    Select the "File" and "Save As" command. In the "Save Image" dialog, click on the control labeled "Select File Type (By Extension)". In the list that appears, select "GIF image" and click the "Save" button, as shown in the example.

  28. Step 6
     

    In the "Export File" dialog, click the control labeled "Save As Animation" and click the "Export" button, as shown in the example. In the target folder ("JPEGDIR" by default), notice that a new GIF file now exists with the name "00000001" (8 digits). Optionally, rename the new GIF file as you prefer.

  29. Step 7

    Double-click on the new GIF file to view it and observe its animation. If you're satisfied with the new animated GIF file, move it to a more permanent location on your computer.

  30. Step 8

    When you've finished making animated GIFs from this set of JPEG files, move the JPEG files as a set from the target folder ("JPEGDIR" by default) to another folder, or delete the entire set.

Tips & Warnings
  • Use GIMP to make more than one animated GIF file from the same set of JPEG files found in the target folder ("JPEGDIR" by default). That is, in GIMP's "Open Image" dialog, select a different subset of the target folder's files for each new animated GIF file you want to create. To capture the video frames for 5 seconds of video running time, MPlayer writes between 100 and 150 JPEG files to the target folder on your computer's Desktop. Each of these files is likely to be under 10 kilobytes (KB) in size. Each time you use the "Make-JPEG-vid-frames" batch file, MPlayer by default writes another set of JPEG files to the target folder ("JPEGDIR" by default) using the same sequence of file names (that is, 8-digit numbers). So, remove any JPEG files in the target folder that have 8-digit file names before starting to capture another set of JPEG files for a new animated GIF file. To find your account name used in folder paths, use Windows Explorer to open any folder shown on your Desktop, then in the Address field near the top of the Windows Explorer window, notice the name that appears in the path after "Documents and Settings". That is your account name on this computer. Use the SMPlayer application to view digital videos. To address a problem with SMPlayer's MPlayer command-line interface, consult the SMPlayer documentation. To address a problem with GIMP, consult the GIMP documentation.
  • You must have sufficient account privileges on your computer to install MPlayer and GIMP.
Subscribe

Post a Comment

Post a Comment

Related Ads

  • Have you done this? Click here to let us know.
I Did This
Get Free Computers Newsletters

Copyright © 1999-2009 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy.   en-US Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.

eHow Computers
eHow_eHow Technology and Electronics