It might be a problem with the graphics driver.
Please uninstall the graphics driver completely.
And then, please install the latest version of the graphics driver and try recording again.
Also, please uninstall and install the latest version of Bandicam.https://www.bandicam.com/downloads/
If it does not seem to help, please let us know how to recreate your issue and your Bandicam format settings.
Also, please check if you have the same issue with the H264(CPU) codec in both AVI and MP4 containers.