You can configure ShareX to record a lossy video, or encode the video right after you record it.
bitrate = target size / duration
, so you can approximate how long your video can be whilst falling under 8MB.
There’s also the more advanced way of doing it which is to use the actions feature. It automatically execute a command to encode the video using ffmpeg.