MediaCrush converts GIFs to video, and will host straight video files. It's open source, you might gain something from browsing the code.
Converted the recorded video into several images using avconv [2] something like this
avconv -i 00:00 1.mkv -t 15 op/frame_%03d.jpg
Create a gif using ImageMagick Convert Command-Line Tool [3] convert -resize 427x240 op/frame_*.jpg op.gif
Result is 20 mb GIF image.. I had to reduce the frames and some other parameters to reduce the size.I feel HTML5 video is a better alternative, but I still need a gif.
[1] http://www.omgubuntu.co.uk/2013/12/simple-screen-recorder-li...