This calculation only works if you encode at constant bitrate.
I usually encode at constant quality. The output size heavily depends on the input video. So, I wrote a wrapper in python that parses the HandbrakeCLI output estimates the final size based on percent completed & the current output file size. Then I can stop early if I realize the file is gonna be huge / the output quality is so shitty that I have to bump the quality factor.