Let's start with a basic overview of the terms you need to know about.
Codec: From COmpression-DECompression, this is method by which the video is encoded.
Encoder: The program which compresses video data into a particular codec. Some encoders give better results than others.
ProRes: A common intermediate codec, used for editing and for creating master files for archiving. Avid's DNxHD is similar.
H.264: The most common codec in use today for delivery, and also widely used as a capture codec.
Container: A file format that holds a movie encoded with a codec. Common containers (which might contain data encoded with H.264 or some other codec) include QuickTime Movie (.mov), MPEG-4 (.mp4).
Data rate: Usually expressed in Mbps, or Megabits per second, this defines the amount of data which is used to display the video. Higher data rates generally give better quality.
Here's a still from the original master file'"shot in ProRes 422 HQ on a Blackmagic Cinema Camera and not corrected [prores-hq]
First, you take your final edit, then export a compressed video at a reasonably high bitrate, and at the maximum resolution you want to show. Then, you upload it to a sharing service, which will compress it much further, and also prepare smaller versions of your movie for those on slower connections and/or smaller devices. You only have to send one file, and they take care of the rest for you.
Exporting from FCP X is straightforward.
Most of FCP X's export presets output an H.264 video suitable for uploading, though you can export a ProRes file, XDCAM or other codecs too. Usually, H.264 gives the best results for a fairly small data rate (15'"20 Mbps) so all you need to do is choose Share > Apple Devices, then under Settings, change Apple Devices to Computer for a file you can pass to every video sharing service and play on Macs and PCs.
Two notes here: Faster Encode will be much, much faster than Higher Quality, and is unlikely to be much (or any) worse in quality. By all means test on your own footage, but I haven't seen any problems at all with Faster Encoding. More speed tests here.
A comparison between high quality and faster encode'"different, but not markedly better or worse from each other.
Note also that compression quality can vary widely between different encoders and different editors. I've been very happy with the output from FCP X, and Noam Kroll found that Premiere Pro did a poor job in comparison. Your mileage may vary.
Export it once, then drag it to Vimeo or YouTube manually.
No matter how you encode your video, it's going to be compressed again for the web, even for the highest quality they offer. This can be quite disheartening when you first realize it'"nobody will ever see the clean original source file you see in your edit, or even the compressed version you output. They're going to crunch it way, way, down.
How far does that compression go? At Vimeo and YouTube, your 1080p file will be crunched to around 4'"4.5Mbps for the video component'"much less than the 15-20Mbps you probably sent them.
Here's the range of files YouTube produces if you upload 1080p.
So how do you make your files look the best? At the very least, you should make the first movie look good enough that the online compression pass has a clean source to work from, but not so big that it takes forever to upload.
If you have a paid Vimeo Pro or Plus membership, you can do two things which impact quality. First, you can optionally enable 1080p playback on a per-video basis. The downside of this is that 720p playback is then disabled, and some slower computers can have issues with 1080p playback. Still, for the best quality, it's a good option if the majority of your audience can play back 1080p files.
Upgrade your video if you want to enable 1080p playback.
Secondly, if you allow it, Vimeo members can choose to download the original file that you uploaded, for far better quality than they'd see through the site normally. That means that your original 15'"20Mbps file can be shared, making pixel peepers happy the world over. While it's great that this option is available for the video geeks like us out there, it's unlikely to be noticed by mainstream viewers. The standard 1080p and 720p files on Vimeo still look pretty good, though.
As an alternative workflow for Vimeo uploads, some people have tried exporting using the ProRes Proxy format instead of H.264. The data rate is much higher, about 38 Mbps, but the codec is optimized for editing rather than delivery'"it's less efficient than H.264. So why bother? Because ProRes Proxy does a better job of preserving film-like grain and fine detail. Check out this movie for an example of the kinds of results you can get.
Even if Vimeo has the 'filmmaker' market, there are many more viewers at YouTube, so you'll need to target both sites, best quality or not. While it used to be the case that YouTube used lower data rates than Vimeo, they're now almost the same'"slightly higher for 720p files, and slightly lower for 1080p files. However, YouTube's compression simply isn't as clean as Vimeo's, and there's a slight gamma shift in their final video too.
Here's a zoomed comparison of the same frame on Vimeo (left) and YouTube (right).
You'll see more blockiness more often at YouTube, and there's not much you can do about it. Even the upscaling method which some people have tried doesn't seem to work any more. If you're curious'¦
In FCP X, this is pretty easy. Assuming you have a 1080p project, you can right-click, duplicate it, then change its settings to 4K (UHD) project at 3840x2160 using the same frame rate. You can then export a 4K H.264 file using the Master File option.
Master File exports can be sent to a variety of codecs.
However, if you upload your 4K file to YouTube and check out the results, you may be disappointed. It seems that while this trick used to give the 1080p stream a higher data rate that it would have otherwise, it doesn't any more. The data rate on the 1080p stream made from a 4K file is the same size as the 1080p stream made from a 1080p source. Alas.
The YouTube output sizes from a 4K upload are just the same as from a 1080p upload, and don't look any better either.
While the advice here has been tested, your results may not vary. Different videos will compress in different ways and benefit from different treatments. As well, online sharing sites change their rules often, so always run your own tests to make sure that you're still doing the best you can. Right now, if I'm shooting 1080p, I'd upload a high quality 1080p to Vimeo, and a high quality 1080p file to YouTube. If you're shooting 4K, then YouTube will show it off better if your audience has screens large enough.
At the end of the day, though, you have to remember that while it's your job to do the best you can, many viewers will simply watch the default, much lower quality versions. Most people look at the people in your movie, and not the pixels in their faces. Content will always be king, and the technical goalposts will always be moving. And that's OK.