There's four factors that affect the size(MB, GB, that kind of size) of a video while keeping the same quality.
1. The codec(Xvid, h264, av1, stuff like that) used to compress it.
Except for a few specialized codec, a general rule of thumb is that the older a codec is, the less it will compress video for the same quality.
2. How fast you encode the video at.
There's many speed preset when encoding(compressing) something and, as a general rule of thumb, the faster the preset, the bigger the size will be for the same end quality.
3. How well the video image can compress.
The more complex the picture is(lots of detail or moving stuff frame to frame), the bigger the size will be. If you have a static background and almost no movement, then the size can be much smaller.
I actually have a very good practical example for that one, I've recently encoded 2 video, same quality, same codec, same speed and almost the same duration(less than 3 sec difference).
The first one has very simple content and I use 2 different quality. The high quality version is 240MB and the low quality version is 39MB.
The second video has more normal content and the high quality version is 491MB and the low quality version is 108MB.
That's quite a difference with everything else being the same, one being less than half the size of the other.
To clarify, those are the video only sizes, not with audio which is why the posts have different size than what I said.
And if you think HD is any different, here's an example of where everything being identical(except the duration which is about 11 min difference), both bluray sources, where
one video being grainy and
the other being clean resulted in one being almost twice the size(after adjusting for duration difference, it's more than twice before that) as the other.
4. What kind of audio or other stuff(fonts, chapters, pictures, whatever) is included with the video. Even if the video portion looks the same, the audio quality can be very different or someone could have added a lot more stuff in the container too.