Also H.264 and H.265 are just formats; there are many encoders of varying quality which can generate such files and each encoder has tons of settings. I don't know which encoder macOS uses but ffmpeg includes state-of-the-art H.264 encoder (x264). Simply reencoding video from H.264 to H.264 using ffmpeg can give you better quality/size ratio than the original file.
> H.264 codec (or MPEG-4 Part 10), once upon a time know in the scene as DIVX.
No, DivX refers to MPEG-4 Part 2 which is a completely different codec.