I'm not sure if this has been discussed somewhere else, but I haven't seen any threads talking about this yet. I'm using a 4000 series Dahua NVR and at first, I was using H.265 on all of my cameras. Later on, I installed Home Assistant and found that many web browsers will not stream H.265 so I tried to switch to H.264. After changing the encoding settings in the camera webpage, Home Assistant would stream them just fine in Chrome. A few days later, I would check back, and HA couldn't get a stream going on any cameras. Well, sure enough, the encoding settings had been reset back to H.265. I could never get the settings to save permanently. Any time the NVR would reboot, they would change back. Even without a reboot, they would just change back every few days. I even tried changing the settings via the NVR instead of the cameras webpage. No luck. Well, today, I did a full factory reset and started over. When I was adding the cameras, I noticed a checkbox that says "H.265 Auto Switch". I've never come across this regardless of all the searching that I've done, but sure enough, this box was checked. I unchecked it and finished setting up my NVR. When I finished, I rebooted to see if the encoding would change to H.265. Sure enough, this was the problem the whole time. I can reboot the NVR now and my encoding settings will remain the same.
TL;DR If you're using a Dahua NVR and you want to use H.264 encoding, make sure to uncheck "H.265 Auto Switch" when you add your cameras.
TL;DR If you're using a Dahua NVR and you want to use H.264 encoding, make sure to uncheck "H.265 Auto Switch" when you add your cameras.