I'm going to start by saying that I'm not an expert in this field. Merely an amateur. I have pondered on this very issue for a long time and while I have not completely cracked the issues I have made some progress.
1. No matter how you compress your video or what format and container it is sent to YouTube in it will be re encoded to a multitude of formats and resolutions device dependant. WEBM up to highest resolution for chrome browser and other compatible devices sporting YouTube App like TV's etc
Mp4 up to 1080p for browsers not supporting WEBM and iOS devices. Mind that regardless of resolution of your iPad or iPhone you can only watch YouTube in up to 1080p for this reason. It used to go up to 1440p up until a year back. Old videos still have that option.
2. As YouTube WILL ALWAYS RE ENCODE your video it is marginally important what codec, container or bitrate will be used. Definitely don't use any lower bitrate then they reccomend.
3. It's very important what the subject is and how it is filmed. Someone had mentioned using +1 sharpness on most DJI drones. This is crucial. Otherwise built in noise reduction kicks in and leaves your footage without fighting chance. The more fine detail in the shot the more YT will make a mess of it.
Annoyingly the quite uniform areas in the shoot will get even more slaughtered and you may have big blocks appear over uniform areas like grass or water.
The more dynamic the use of the camera the worse it will fare when it comes to YT compression. Simple movements are a king when it comes to pure visual quality. So no sideways flight or moving camera to the side or if you do, do it slowly. I film very dynamically and have to pay the price.
3. Use extra steps to improve your footage. The one thing I will really reccomend is to put your project through a good noise reduction. Use something like DaVinci Resolve Studio or Neat Plugin for best results. You will be amazed. You can add a bit of sharpness as well before applying the Noise Reduction. If you are worried about jittery footage a small dose of motion blur could help as well.
4. I'm going to go back on what I have said before about little difference in what codec you will use. My mate who is very advanced in the technical aspects of video production suggested that exporting video in h.265 otherwise know as HEVC can get you better results when uploading to YouTube. It will produce file with same quality as mp4 but about 1/4 of the size. I have used it with some good results but sometimes I've had a feeling that while picture quality was improved somehow there was more noticable jitter. If you don't film as adventurously as I do this might not be a case for you. So do try it out.
5. YouTube sometimes messes up the compression. I've had instances where the algorithm was creating some awful artifacting and or the video playback would get stuck at some points and part of video would have had to be skipped to continue watching. Re-uploading usually helps with both.
Lastly I will attach a video where you can see some amazing artifacts produced by YT that for the life of me u could not get rid off regardless of what technique, codec, container or magic spell I've tried.
Look at water at 2.00 and 2.08 and and grass at top right at 2.13
Thanks for your patience if you've managed to read my essay and hit me up if you need any clarification