This is a small script which will convert your video file into a gif file so that we can share it across Internet so that video player is not required to play it. The script is written in Linux Bash shell

#!/bin/bash
#Author: Surendra Anne(surendra@linuxnix.com)
#Purpose: To convert any video file into a GIF image file. The script will take one video file from command line arguments and do the conversion using mplayer and convert. So please install these two software’s before running this script.
#Licence: GPL v.3

[[ “$#” -ne 1 ]] && { echo -e “Script should be run as belown bash $0 video-filen Exiting the script..!”;exit 1; }
mkdir /tmp/images/
mplayer -ao null $1 -vo jpeg:outdir=/tmp/images/
convert /tmp/images/* /tmp/abc.gif
convert /tmp/abc.gif -fuzz 10% -layers Optimize /home/surendra/Desktop/opt-gif.gif
rm -rf /tmp/{abc.gif images/}


First line in the script will check if a file is passed to script or not, if not it will through some meaningful error message to user.
mplayer command will convert video file into jpeg images and the first convert command will club these image files to single animated gif file. The second convert command will compress the gif file considerably to 10% of actual size. And the file will be stored on desktop. You may have to change the locations to suite your requirements. 
The following two tabs change content below.
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.