user26043: I was reading YouTube Help Recommended upload encoding settings page, and I found this command from a site Youtube recommended encoding settings for FFmpeg.
ffmpeg -f gdigrab -framerate 60 -i desktop -f dshow \
  -i audio="Microphone (2- Realtek Audio)" -c:v libx264 -preset slow -crf 18 \
  -profile:v high -level 4.0 -pix_fmt yuv420p -bf 2 -coder 1 -b:v 15M -c:a aac \
  -ar 48000 -ac 2 -b:a 384k output.mp4

I modified the command to capture my desktop and microphone, but I was wondering if this is the best quality I can get or whether there are any improvements I can make. My goal is to get the best quality for a 1080p60 video.

user1760: Remove:

-profile:v high -level 4.0 - You don't need to set a profile or level because you're not targeting any specific, limited, or outdated devices. These options don't matter because YouTube is going to re-encode whatever you give it and set its own profile and level.
-pix_fmt yuv420p - You can let YouTube deal with the pixel format.
-bf 2 -coder 1 - These are already handled automatically by -preset.
-b:v 15M - This is mutually exclusive with -crf. Just use -crf instead. It will let you set the quality instead of you trying to apply an arbitrary bitrate.
-ar 48000 -ac 2 - No need to change the audio rate or channel layout. If you do what to change those do it via the dshow -sample_rate and -channels input options.

So your command can look like:
ffmpeg -f gdigrab -framerate 60 -i desktop -f dshow -i audio="Microphone (2- Realtek Audio)" -c:v libx264rgb -preset slow -crf 18 -b:a 384k output.mp4


The input is RGB, so you can avoid the RGB to YUV conversion by using -c:v libx264rgb.
If your computer can handle it then consider using a slower -preset.
You can use flac or libopus for audio (change output.mp4 to output.mkv), but for microphone it will hardly matter.
You can try -crf 17 if you think you can see a difference. I wouldn't bother with the huge file increase from using lossless (-crf 0).
You can see if dshow is faster than gdigrab for capturing the desktop. I don't use Windows so I can't test for you.

Note that a non-FFmpeg based player may not be able to decode the file, but I'm fairly certain YouTube will have no issues with it.

26043: <p>I was reading YouTube Help <a href="https://support.google.com/youtube/answer/1722171?hl=en" rel="nofollow noreferrer">Recommended upload encoding settings</a> page, and I found this command from a site <a href="https://scribbleghost.net/2018/10/26/youtube-recommended-encoding-settings-for-ffmpeg/" rel="nofollow noreferrer">Youtube recommended encoding settings for FFmpeg</a>.</p>

<pre><code>ffmpeg -f gdigrab -framerate 60 -i desktop -f dshow \
  -i audio="Microphone (2- Realtek Audio)" -c:v libx264 -preset slow -crf 18 \
  -profile:v high -level 4.0 -pix_fmt yuv420p -bf 2 -coder 1 -b:v 15M -c:a aac \
  -ar 48000 -ac 2 -b:a 384k output.mp4
</code></pre>

<p>I modified the command to capture my desktop and microphone, but I was wondering if this is the best quality I can get or whether there are any improvements I can make. My goal is to get the best quality for a 1080p60 video.</p>
 1760: <p>Remove:</p>

<ul>
<li><p><code>-profile:v high -level 4.0</code> - You don't need to set a profile or level because you're not targeting any specific, limited, or outdated devices. These options don't matter because YouTube is going to re-encode whatever you give it and set its own profile and level.</p></li>
<li><p><code>-pix_fmt yuv420p</code> - You can let YouTube deal with the pixel format.</p></li>
<li><p><code>-bf 2 -coder 1</code> - These are already handled automatically by <code>-preset</code>.</p></li>
<li><p><code>-b:v 15M</code> - This is mutually exclusive with <code>-crf</code>. Just use <code>-crf</code> instead. It will let you set the quality instead of you trying to apply an arbitrary bitrate.</p></li>
<li><p><code>-ar 48000 -ac 2</code> - No need to change the audio rate or channel layout. If you do what to change those do it via the <a href="https://ffmpeg.org/ffmpeg-devices.html#dshow" rel="nofollow noreferrer">dshow</a> <code>-sample_rate</code> and <code>-channels</code> input options.</p></li>
</ul>

<p>So your command can look like:</p>

<pre><code>ffmpeg -f gdigrab -framerate 60 -i desktop -f dshow -i audio="Microphone (2- Realtek Audio)" -c:v libx264rgb -preset slow -crf 18 -b:a 384k output.mp4
</code></pre>

<ul>
<li>The input is RGB, so you can avoid the RGB to YUV conversion by using <code>-c:v libx264rgb</code>.</li>
<li>If your computer can handle it then consider using a slower <code>-preset</code>.</li>
<li>You can use flac or libopus for audio (change <code>output.mp4</code> to <code>output.mkv</code>), but for microphone it will hardly matter.</li>
<li>You can try <code>-crf 17</code> if you think you can see a difference. I wouldn't bother with the huge file increase from using lossless (<code>-crf 0</code>).</li>
<li>You can see if dshow is faster than gdigrab for <a href="https://trac.ffmpeg.org/wiki/Capture/Desktop#Windows" rel="nofollow noreferrer">capturing the desktop</a>. I don't use Windows so I can't test for you.</li>
</ul>

<p>Note that a non-FFmpeg based player may not be able to decode the file, but I'm fairly certain YouTube will have no issues with it.</p>
