<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>

CC BY-SA 4.0
2019-08-21T18:40:12.397Z
2019-08-21T18:40:12.397Z
llogan
<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>

CC BY-SA 4.0
2021-01-14T15:27:09.233Z
@MarianD, note that by breaking lines using ```\``` you made this command linux (and mac) only, when there was no any information about OS and it's possible that the question is about windows.
Qwertiy
CC BY-SA 4.0
2021-01-15T00:04:36.870Z
@Qwertiy, you're right, I'm aware of it, but by scrolling the long line disappears the big picture (and the answerers' will for answering such a question). So I decided to use the POSIX continuation symbol `\ ` (except questions with `windows` tag) — for FFmpeg users it is “lingua franca”, well-known to Windows' users, too, which have no problem to translate it to the `^` symbol.
MarianD
<video><ffmpeg><youtube><recording>
FFmpeg : Desktop Recording for YouTube
Tommy
# FFmpeg : Desktop Recording for YouTube

(Asked by: username_0 on 2019-08-21)

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.

**Tags:** video, ffmpeg, youtube, recording

> **Comments:**
> **username_1**: @username_2, note that by breaking lines using ```\``` you made this command linux (and mac) only, when there was no any information about OS and it's possible that the question is about windows.  
> **username_2**: @username_1, you're right, I'm aware of it, but by scrolling the long line disappears the big picture (and the answerers' will for answering such a question). So I decided to use the POSIX continuation symbol `\ ` (except questions with `windows` tag) — for FFmpeg users it is “lingua franca”, well-known to Windows' users, too, which have no problem to translate it to the `^` symbol.  

---

## 1 answers

### Answer by username_3 on 2019-08-21. Score: 1

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.


---

