One possible solution is byzanz if you don’t mind using CLI, byznaz run on  Ubuntu and I didn’t test it on different Linux distributions. Its quite rudimentary screen recorder with limited options.

![byzanz][1]

Byzanz records GIF's and runs from Terminal only.
it is not included in Ubuntu repositories and  it can be only installed through PPA.

Man pages:

    Usage:
    
      byzanz-record [OPTION...] record your current desktop session
   
    Help Options:
      -?, --help               Show help options
      --help-all               Show all help options
      --help-gtk               Show GTK+ Options
   
    GTK+ Options
      --class=CLASS            Program class as used by the window manager
      --name=NAME              Program name as used by the window manager
      --gtk-module=MODULES     Load additional GTK+ modules
      --g-fatal-warnings       Make all warnings fatal
    
    Application Options:
      -d, --duration=SECS      Duration of animation (default: 10 seconds)
      --delay=SECS             Delay before start (default: 1 second)
      -c, --cursor             Record mouse cursor
      -a, --audio              Record audio
      -x, --x=PIXEL            X coordinate of rectangle to record
      -y, --y=PIXEL            Y coordinate of rectangle to record
      -w, --width=PIXEL        Width of recording rectangle
      -h, --height=PIXEL       Height of recording rectangle
      -v, --verbose            Be verbose
      --display=DISPLAY        X display to use



  [1]: https://i.sstatic.net/20IU9.gif