It will be great to record video of screen with ffmpeg like ShareX. Almost everything you done already (area selection, window selection). I want to have option to choose: bitrate, framerate, GIF or MPEG, codec and so on.
Yep, I know about builtin video recorder in MacOs. But it creates too heavy files.
Another screen recorder called Joyoshare VidiKit is much easier to use than FFmpeg. I was almost driven mad by those commands. The tool I use is able to record all videos in HD or 4K quality.