LICEcap is GPL free software, each download package includes the source.
Features and options:
Record directly to .GIF or .LCF.
Move the screen capture frame while recording.
Pause and restart recording, with optional inserted text messages.
Global hotkey (shift+space) to toggle pausing while recording
Adjustable maximum recording framerate, to allow throttling CPU usage.
Basic title frame, with or without text.
Record mouse button presses.
Display elapsed time in the recording.
Requirements:
Windows: Windows XP/Vista/7/8/8.1/10/11 (might work with reduced functionality on older versions)
OSX: macOS 10.7-12.x Intel 64-bit or M1 (old versions: v1.30 supports macOS 10.6, and v1.28 supports macOS 10.4 and PPC)
Linux: apparently works with WINE
A reasonably fast CPU
A healthy amount of RAM (1GB+, especially when encoding to LCF)