So I published something like that yesterday.
I've been using the "Handbrake" program for my private collection for years. This saves me several TBs (terrabytes).
What's important is that the better the source material is, the better your result will be. So, I always try to get the 4K source.
There is a wealth of information about the settings in the program itself (browser search). However, it is always best to work with a “variable frame rate”. Constant Quality: I have it on 24 RF. You have to experiment a little here. It is also important whether the video is in a room (do you need less) or outside (do you need more). If there is water or a lot of trees, the more details the higher the controller.
But I usually leave it at 24.
Edit: the codecs are x265, of course, which has much better compression than x264.
Enjoy