Convert Your Video to GIF

Firstly we seperate our video to 10 seconds part which we want convert to gif format:
avconv -i sablonlar.ogv -ss 00:00:00 -t 00:00:10 output.mp4
Therewithal we changed sablonlar.ogv format to mp4 with this command.
We selected input video with -i parameter.
We selected start time of video with -ss parameter.
We selected how long would make recorded from start time of video with -t parameter.
Lastly we described output video name(output.mp4).


avconv -i output.mp4 -s 640x480 -vf format=rgb24 -pix_fmt rgb24 -r 6 output.gif
We selected input video with -i parameter.
We described codec formats with -vf format=rgb24 ve -pix_fmt rgb24 parameters.
We selected how many pictures would record in one second with -r parameter.
Lastly we named output picture(output.gif)
We can optimize output gif with GIMP:
From GIMP menu: Filters-Animation-Optimize(for GIF)
Process finished, but if you aren't glad about quality of video, we finish process ourselves.


Make a new folder and copy output.mp4 named video to this new folder.
We will take pictures from our video which is 10 seconds:
avconv -i output.mp4 -r 6 -s 640x480 image-%03d.png
We selected input video with -i parameter.
We selected how many pictures would record in one second with -r parameter.
We described width and length of our pictures with -s parameter.
Lastly we provide our output picture names as automatically.(image-%03d.png)
We can remove output.mp4 which is copy in our new folder.
Now we have about 60 pictures in-line, we will convert these pictures to a gif file with GIMP support.


Before we open GIMP, we must change reverse sequent of pictures
Open terminal:
x=999
for file in *.png; do mv $file $x.png;let "x-=1";done
(x number must be greater than your number of pictures)
Yes, we done.


Now we can open our picture which name has minumum number with GIMP.
We are selecting all pictures except picture which we opened(name has minumum number) in our new folder
Drag and drop pictures which selected to layer's part.
From Menu Filters-Animation-Optimize(for GIF)
File-Export As and extension will set as gif.
In new window, we are selecting As Animation and press Export button.
Result is wonderful, it's better than first gif animation which we made from command line...


If you wish, you can watch our video about this subject:
https://youtu.be/2hIEvs7RsfE


Applied in Linux Mint 17 and GIMP 2.8.10
Date of Article: 05.03.2016




HOME GNU/LINUX Gimp TURKISH