libcaptury is a realtime multimedia capturing framework for currently OpenGL video (to be extended to XShm and audio/alsa soon). Its uses are e.g. for capturing video from external OpenGL applications (via captury itself) and is currently also used by KDE's kwin to record your desktop efficiently (VideoRecord plugin).
libcaptury supports full encoding as well as incremential(!) encoding by only regions from the screen that have actually changed. Window managers (like kwin) do know of such areas and can make use of it.

Source Code