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.

  • @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
    Commented Jan 14, 2021 at 15:27
  • @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
    Commented Jan 15, 2021 at 0:04

1 Answer 1



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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.