One of the best tools I use is ffmpeg
. It can take most video from a screencast tool such as kazam
and convert it to another format.
Install this from software-center - it is automatically installed if you install the excellent ubuntu-restricted-extras
package.
Kazam can output in the video formats mp4
or webm
. Generally you get better results outputting in mp4
format.
example GIF making syntax
The basic syntax to convert video to gif is:
ffmpeg -i [inputvideo_filename] -pix_fmt rgb24 [output.gif]
GIFs converted - especially those with a standard 25/29 frame-per-second can be very large. For example - a 800Kb webm 15-second video at 25fps can output to 435Mb!
You can reduce this by a number of methods:
framerate
Use the option -r [frame-per-second]
for example ffmpeg -i Untitled_Screencast.webm -r 1 -pix_fmt rgb24 out.gif
Size reduced from 435Mb to 19Mb
file-size limit
Use the option -fs [filesize]
for example ffmpeg -i Untitled_Screencast.webm -fs 5000k -pix_fmt rgb24 out.gif
Note - this is an approximate output file size so the size can be slightly bigger than specified.
size of output video
Use the option -s [widthxheight]
for example ffmpeg -i Untitled_Screencast.webm -s 320x200 -pix_fmt rgb24 out.gif
This reduced the example 1366x768 video size down to 26Mb
loop forever
Sometimes you might want the GIF to loop forever.
Use the option -loop_output 0
ffmpeg -i Untitled_Screencast.webm -loop_output 0 -pix_fmt rgb24 out.gif
further optimise and shrink
if you use imagemagick
convert
with a fuzz factor between 3% and 10% then you can dramatically reduce the image size
convert output.gif -fuzz 3% -layers Optimize finalgif.gif
finally
combine some of these options to reduce to something manageable for Ask Ubuntu.
ffmpeg -i Untitled_Screencast.webm -loop_output 0 -r 5 -s 320x200 -pix_fmt rgb24 out.gif
followed by
convert output.gif -fuzz 8% -layers Optimize finalgif.gif
example
