user6671: I make short films which I distribute through YouTube. I know YouTube uses VP9 for streaming, but YouTube still recommends uploading with h.264. It makes more sense to me to upload in as similar a format as will be streamed by YouTube, but I might be missing something.
Also, would uploading in a higher quality codec like DNxHR or Prores (I'm not concerned about bandwidth or processing time) better preserve video quality after YouTube's encoding?

user1760: YouTube will re-encode whatever you give it. VP9 is currently too slow to encode. So the best choice is to either:

Give it the original footage, or if it is not accepted by YouTube or is too big to upload, then...
Re-encode to H.264

ffmpeg
ffmpeg will accept just about any input and will provide a great quality output. Development is very active, so it is best to use a recent build which you can download for Windows, OS X, or Linux.
Example commands
Encode H.264 video, stream copy audio, in Matroska container:
ffmpeg -i input.avi -c:v libx264 -preset medium -crf 18 -c:a copy output.mkv

Encode H.264 video, Vorbis audio, in Matroska container:
ffmpeg -i input.avi -c:v libx264 -preset medium -crf 18 -c:a libvorbis -q:a 5 output.mkv


-crf 18 is considered to be roughly visually lossless. The range is a log scale from 0-51. 0 is lossless (huge files), 23 is default.
-preset controls the encoding efficiency, and therefore affects the encoding speed. Generally it is recommended to use the slowest preset you have patience for, or if in doubt just use medium (the default). Choices are: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow.
Your player may not like the output, but YouTube will. If that is the case then just use a sane player such as VLC.

Also see

FFmpeg Wiki: H.264 Video Encoding Guide
FFmpeg Wiki: How to Encode Videos for YouTube and other Video Sharing Sites


user6273: tl;dr: Since Youtube reencodes all videos regardless of the upload format, it really isn't that important. Just export your video with a high bitrate to preserve quality. Also see my answer here regarding quality loss caused by Youtube.
Long answer: Each reencoding of a video to a compressed format lowers the quality. Usually, that means you'll lose quality at two points: When you export the edited video from your editing software and when you upload the exported video to Youtube, at which point it is reencoded to a highly compressed, streaming-compatible format. You have no control over that second step, so what you can do to achieve the maximum quality possible is make sure you lose as little quality as possible during the first encoding.
In theory, that would mean export to a perceptually (even though technically not) uncompressed format like Apple ProRes or DNxHD as you suggested. However, unfortunately, Youtube doesn't support those formats, so you'll have to use a compressed format. To minimize quality loss, set a high bitrate in your export settings (assuming rendering and upload time aren't an issue. If they are, you'll have to find some middle ground; exporting with a bitrate that is higher than the bitrate of the source material won't yield any more quality, so that is as high as I would go). If you do that, it doesn't really matter which codec you use, both are highly efficient regarding file-size/quality ratio (VP9 probably a bit more so, but that's more important when you're dealing with low bitrates). Youtube recommends H264, so that's what I would use. However, the best advice I can give you is to try out both, i.e. export the same video as both H264 and VP9 with identical bitrates/other settings, upload both to youtube and check which one looks better to you.

6671: <p>I make short films which I distribute through YouTube. I know YouTube uses VP9 for streaming, but YouTube still recommends uploading with h.264. It makes more sense to me to upload in as similar a format as will be streamed by YouTube, but I might be missing something.</p>

<p>Also, would uploading in a higher quality codec like DNxHR or Prores (I'm not concerned about bandwidth or processing time) better preserve video quality after YouTube's encoding?</p>
 1760: <p>YouTube will re-encode whatever you give it. VP9 is currently too slow to encode. So the best choice is to either:</p>

<ul>
<li><p>Give it the original footage, or if it is not accepted by YouTube or is too big to upload, then...</p></li>
<li><p>Re-encode to H.264</p></li>
</ul>

<h1><code>ffmpeg</code></h1>

<p><code>ffmpeg</code> will accept just about any input and will provide a great quality output. Development is very active, so it is best to use a recent build which you can <a href="https://ffmpeg.org/download.html">download</a> for Windows, OS X, or Linux.</p>

<h2>Example commands</h2>

<h3>Encode H.264 video, <a href="https://ffmpeg.org/ffmpeg.html#Stream-copy">stream copy</a> audio, in Matroska container:</h3>

<pre><code>ffmpeg -i input.avi -c:v libx264 -preset medium -crf 18 -c:a copy output.mkv
</code></pre>

<h3>Encode H.264 video, Vorbis audio, in Matroska container:</h3>

<pre><code>ffmpeg -i input.avi -c:v libx264 -preset medium -crf 18 -c:a libvorbis -q:a 5 output.mkv
</code></pre>

<ul>
<li><p><code>-crf 18</code> is considered to be roughly visually lossless. The range is a log scale from 0-51. 0 is lossless (huge files), 23 is default.</p></li>
<li><p><code>-preset</code> controls the encoding efficiency, and therefore affects the encoding speed. Generally it is recommended to use the slowest preset you have patience for, or if in doubt just use <code>medium</code> (the default). Choices are: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow.</p></li>
<li><p>Your player may not like the output, but YouTube will. If that is the case then just use a sane player such as VLC.</p></li>
</ul>

<h1>Also see</h1>

<ul>
<li><a href="https://trac.ffmpeg.org/wiki/Encode/H.264">FFmpeg Wiki: H.264 Video Encoding Guide</a></li>
<li><a href="https://trac.ffmpeg.org/wiki/Encode/YouTube">FFmpeg Wiki: How to Encode Videos for YouTube and other Video Sharing Sites</a></li>
</ul>
 6273: <p><strong>tl;dr:</strong> Since Youtube reencodes all videos regardless of the upload format, it really isn't that important. Just export your video with a high bitrate to preserve quality. Also see <a href="https://video.stackexchange.com/a/15815/6273">my answer here</a> regarding quality loss caused by Youtube.</p>

<p><strong>Long answer:</strong> Each reencoding of a video to a compressed format lowers the quality. Usually, that means you'll lose quality at two points: When you export the edited video from your editing software and when you upload the exported video to Youtube, at which point it is reencoded to a highly compressed, streaming-compatible format. You have no control over that second step, so what you can do to achieve the maximum quality possible is make sure you lose as little quality as possible during the first encoding.<br>
In theory, that would mean export to a <em>perceptually</em> (even though technically not) uncompressed format like Apple ProRes or DNxHD as you suggested. However, unfortunately, <a href="https://support.google.com/youtube/troubleshooter/2888402?hl=en" rel="nofollow noreferrer">Youtube doesn't support those formats</a>, so you'll have to use a compressed format. To minimize quality loss, set a high bitrate in your export settings (assuming rendering and upload time aren't an issue. If they are, you'll have to find some middle ground; exporting with a bitrate that is higher than the bitrate of the source material won't yield any more quality, so that is as high as I would go). If you do that, it doesn't really matter which codec you use, both are highly efficient regarding file-size/quality ratio (VP9 probably a bit more so, but that's more important when you're dealing with low bitrates). <a href="https://support.google.com/youtube/answer/1722171" rel="nofollow noreferrer">Youtube recommends H264</a>, so that's what I would use. However, the best advice I can give you is to try out both, i.e. export the same video as both H264 and VP9 with identical bitrates/other settings, upload both to youtube and check which one looks better to you.</p>
