OBS software is free, open source software for recording and editing video. It is open source, cross platform (Windows, Mac, Linux) can record video, and stream everything that happens on your computer screen.
It is written in C and C++, and uses all known and unknown streaming services of our time: Twitch.tv, Youtube/Youtube Gaming, hitbox, beam.pro, Daily Motion, Livecoding.tv, Web.Tv, and many others still.
Of course, it can also be used to record on video what is happening on your computer screen, even if you are playing a game.
It utilizes its potential DirectX 11 but you can configure it for OpenGL as well. For video encoding, it uses, among other things, codec capabilities such as x264 free software library, Intel Quick Sync Video and Nvidia NVENC to create video streams in H.264/MPEG-4 AVC format, offering the best possible ratio between file size and quality.
GitHub releasenotes
Download the application on the platform you are interested in