OBS Studio, which hosted on github is an excellent open source video recording tool on both Linux and Windows.
Install and Setup
Install on Linux Mint 18.3:
glxinfo | grep "OpenGL"
sudo apt-get install ffmpeg
sudo add-apt-repository ppa:obsproject/obs-studio
sudo apt-get update
sudo apt-get install obs-studio
After starting obs, in File > Settings > Output > Recording, set the Recording Path to your choice. Then set Recording Quality to Same as stream. This produces minimum output file, while the quality is good enough through my test.
The default Recording Format is flv, install VLC to play files with this format on Linux.
In Settings > Hotkeys, you can assign Alt-Shift-a and Alt-Shift-s to Start Recording and Stop Recording respectively. These are global hotkeys, you can use them to start and stop recording when OBS is not active window.
Usage
Add a source to record video or audio in OBS. For video recording, and all actions are in a window, add a Window Capture source. For recoding whole desktop including actions between multiple applications, add a Screen Capture source.
If only want to record audio, add a Audio Output Capture or Audio Capture Device source.
You can add multiple sources for one scene. but it seems unnecessary for simple recording tasks.
Then press Start Recording button on the right side.