Animated signature GIFS from AVI files Tutorial. (Linux)

Art tutorials only please. Anything else will be moved into Art & Signatures

Animated signature GIFS from AVI files Tutorial. (Linux)

Postby Xerxes on Tue Dec 16, 2008 12:17 pm

Note: This is reasonably advanced and hinges on you having Linux or Cygwin installed to carry this off. This tutorial uses only free software.

NOTE: you will need these installed: Imagemagick, Mplayer, Mencoder (which may be part of Mplayer) and any dependancies for them. Use "sudo apt-get install" to get them. :)

  1. If you are converting only an AVI, skip to step 10. If you wish to convert Youtube videos, continue.
  2. Navigate to your home directory (any will do, but for simplicity everything will be done here).
  3. Create a document called "youtube.sh", omitting the quotation marks.
  4. Open the file using whichever editor you want and add this code:
    Code: Select all
    wget -q -O - http://www.youtube.com/watch?v=$1|grep "/watch_fullscreen?.*video_id=.*\&t="|sed "s/^.*\&t=//"|sed "s/\&.*//"|xargs -i wget -O $2 http://youtube.com/get_video?video_id=$1\&t={}\&fmt=22
    Note that this will download the HD version of the youtube video in question, which might not exist. Try removing the &fmt=22 from the end to download the low quality version. HD versions are preferable, however as they don't have the artifacts and distortion of the normal youtube clips.
  5. Open a terminal.
  6. Run "chmod +x youtube.sh" to allow you to run the file as a script (again, omit the quotation marks).
  7. Find the video ID that you want to download by taking the unique identifier from the end of the youtube URL.
  8. Call the script:
    Code: Select all
    ./youtube.sh ID OutputFLV.flv
    . Obviously you can call the output file whatever you like. You will now have an FLV sitting in your home directory.
  9. Convert the FLV into an AVI (it is possible to convert from FLV->GIF, but the quality is horrible):
    Code: Select all
    mencoder -oac pcm -ovc lavc -o OutputAVI.avi OutputFLV.flv
    You will now have the FLV converted to an AVI file.
  10. You may now select the parts that you want to include by running avidemux, if you wish. Use the A/B buttons on the bottom right to select the parts and save the file.
  11. Now make a temporary file to save the individual frames from your AVI:
    Code: Select all
    mkdir ~/gif && cd ~/gif
    This will make a folder called "gif" in your home directory and change directory to it.
  12. Now, use Mplayer to convert EVERY frame into a jpeg:
    Code: Select all
    mplayer ~/OutputAVI.avi -vo jpeg
    Note, this will take up a LOT of space.
  13. You can now edit out the frames you do and don't want. :)
  14. Now, all that is left to do is convert the frames to a GIF!
    Code: Select all
    convert -enhance -resize 150x150 -delay 4 -loop 0 *.jpg ~/Desktop/FinalOutput.gif

    Your computer will probably freeze for a while at this point. Don't panic, just leave it to do its thing. :)
    The options are: resize (set to 150px*150px here), delay (4ms before starting), loop (0=infinite) and *.jpg which looks for every sequential JPG. Note that the file will be on your Desktop now.


Voila! You have a high quality GIF! :)

Example:


I created this tutorial whilst learning how to convert avis for Saggy's requested avatar/sig. Note, the file is 6.3Mb as I haven't optimised it yet. :). Link.


Youtube grabbing script adapted from: http://www.chuckcaplan.com/blog/archives/2007/07/how_to_convert_1.html
Image
Image
Image
Image
ImageImageImage
Image

Image
"I forgot about unspec" - ApacheFlame 05/02/15
User avatar
Xerxes
UKCS Vice President
Moderator
UKCS iSeries Attendee
 
Player: Xerxes
STEAM_0:0:2949329
 
Posts: 10573
Joined: Wed Jul 09, 2008 10:30 pm

Re: Animated signature GIFS from AVI files Tutorial.

Postby bullet_sponge on Tue Dec 16, 2008 8:36 pm

nice!

Thanks for that.

Now... If only I wasn't lazy!
Image
User avatar
bullet_sponge
UKCS Sponsor
 
Player: the spanish inquisition(bsp)
STEAM_0:0:9005143
 
Posts: 2087
Joined: Tue Aug 19, 2008 7:50 pm

Re: Animated signature GIFS from AVI files Tutorial.

Postby Xerxes on Tue Dec 16, 2008 8:37 pm

Well, I'll make a bash script for it at some point...:)
Image
Image
Image
Image
ImageImageImage
Image

Image
"I forgot about unspec" - ApacheFlame 05/02/15
User avatar
Xerxes
UKCS Vice President
Moderator
UKCS iSeries Attendee
 
Player: Xerxes
STEAM_0:0:2949329
 
Posts: 10573
Joined: Wed Jul 09, 2008 10:30 pm

Re: Animated signature GIFS from AVI files Tutorial.

Postby Podge on Thu Dec 18, 2008 2:35 pm

Good job man. :)
Retired UKCS TF2 Senior Admin
Image
User avatar
Podge
UKCS Admin
 
Player: OldManRodgers
STEAM_0:1:2582345
 
Posts: 8589
Joined: Sun Oct 21, 2007 1:02 am
Location: Ireland

Re: Animated signature GIFS from AVI files Tutorial.

Postby Xerxes on Thu Dec 18, 2008 3:26 pm

Thanks to both of you...at a later point I'll see if there are windows ports of the necessary programs...
Image
Image
Image
Image
ImageImageImage
Image

Image
"I forgot about unspec" - ApacheFlame 05/02/15
User avatar
Xerxes
UKCS Vice President
Moderator
UKCS iSeries Attendee
 
Player: Xerxes
STEAM_0:0:2949329
 
Posts: 10573
Joined: Wed Jul 09, 2008 10:30 pm

Re: Animated signature GIFS from AVI files Tutorial. (Linux)

Postby bullet_sponge on Thu Jun 04, 2009 11:44 am

following this on 9.04, sees as though I need to download avidemux separately.
Image
User avatar
bullet_sponge
UKCS Sponsor
 
Player: the spanish inquisition(bsp)
STEAM_0:0:9005143
 
Posts: 2087
Joined: Tue Aug 19, 2008 7:50 pm


Return to Art Tutorials

Who is online

Users browsing this forum: CommonCrawl [Bot] and 0 guests