I haven't looked too deep into Handbrake in a few years (so someone correct me if I am wrong), but I don't think they use ffmpeg. Their core, the codec libraries, is mostly the same as ffmpeg, but ffmpeg is not the "foundation" of Handbrake
They use libx264 for H.264 video encoding (and maybe libx265 for HEVC).
What do you think they use to split the video from the audio in the source file, decode the source video frames, resize and crop every frame, and then mux the resulting new video stream with the (possibly also recompressed) audio stream?