ffcast -s ffmpeg -r 15 -- -pix_fmt rgb24 out.gif
I selected a region, did some
q, got a
(I ran that command in another terminal.)
FFcast helps the user interactively select a screen region and hands over the geometry to an external command, such as FFmpeg, for screen recording.
ffcast is the glorious product of some hacking at the Arch Linux community (mainly lolilolicon). You can find it on github (or in the AUR for Archers). Its dependency list is just
Internally, it works by invoking
libx11 (the same standard function
scrot uses) and letting the user select a screen region. It then substitutes the correct dimensions for
%d in the given command. There's a preset for
ffmpeg, which automatically inserts the correct selection area flags for it to record video.
You can also append
ffmpeg flags right after the command. Conveniently,
ffmpeg can output
.gif files if you specify
-pix_fmt rgb24. Then there's no need for an additional conversion step from some video format to GIF.
-r flag specifies frame capture rate (set to
15 frames per second in the example). Keep file size in mind when changing this.
ImageMagick has some GIF optimisation tricks that drastically reduce file size, preserving quality:
convert -layers Optimize out.gif out_optimised.gif invokes the general-purpose optimiser. There's an ImageMagick manual page on advanced animation optimisations.
I've strung these together as
ffcast -s ffmpeg -r 15 -- -pix_fmt rgb24 out.gif \
&& echo "Optimising" \
&& convert -layers Optimize out.gif out_opt.gif \
&& echo "Done!"