Problem and Introduction¶
I wanted to include some gif screencasts in my posts and started looking for a neat solution. I can live with a command line or gui solution as long as it works reasonable well and is in the Debian Jessie (stable) repositories.
From the links above I managed to extract two different solutions:
byzanz - Debian package ‘byzanz’. This is the easiest and best solution I could find. Set the duration of the recording with the
-d option. Replace ‘foo.gif’ with your preferred filename:
byzanz-record -d 20 foo.gif
- record a video with ‘recordmydesktop’ (see code example 0), ‘gtk-recordmydesktop’ or use an existing video
- With ‘avconv’ you can directly convert to gif (see code example 1) and skip step 3. Another aproach is to extract stillimages with ‘mplayer’ (see code example 2) or with ‘avconv’ (see code example 3).
- convert to ‘gif’ with imagemagick (see code example 4)
Code example 0 (record a video; replace foobar.ogv with your filename):
recordmydesktop -o foobar.ogv
Code example 1 (direct video to gif conversion; replace foobar.ogv with your filename):
avconv -i foobar.ogv -pix_fmt rgb24 foobar.gif
Code example 2 (extraction of still images; replace foobar.ogv with your filename):
mplayer -ao null foobar.ogv -vo jpeg:outdir=output
Code example 3 (extraction of still images; replace foobar.ogv with your filename):
avconv -i foobar.ogv -r 15 output/image-%3d.png
Code example 4 (convert stillimages to gif):
convert output/* -layers Optimize output.gif
This solution produces usable gifs with small filesizes. The still image extraction and conversion to gif takes a lot of computing.
If you have any questions, suggestions, thoughts and comments please feel free to email me.
License of this blog post:
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.