3
ffmpeg -f gdigrab -framerate 30 -i desktop output.mkv

I use this command and I have two questions:

  1. My screen allows full-hd, but seems like output.mkv in bad (not full-hd) quality. How to record screen in the best quality?

  2. My command doesn't record audio. How to record audio too?

3
+50

If you want your computer's audio to be recorded along with your screen at full resolution, rather than your microphone, (the question was unclear as to which one you wanted) follow these instructions:

The device 'Stereo Mix (Realtek Audio)' probably needs to be enabled, in my case, it wasn't.

Stereo mix is what allows you to record your computer's audio in Windows.

  1. Go to control panel --> hardware and sound --> sound

  2. Then click the 'recording' tab.

  3. Now right click inside the device list and make sure that 'show disabled devices' is ticked. Stereo Mix should then show up.

  4. Now right click it and select 'enable'.

Note that Stereo Mix's full name is 'Stereo Mix (Realtek Audio)'

Now, to record your audio and pc screen at full resolution, you would type:

ffmpeg -f gdigrab -framerate 30 -i desktop -c:v libx264 output.mkv -f dshow -i audio="Stereo Mix (Realtek Audio)" output.mkv

Also note that if you have multiple sound devices (i.e I use a laptop with a monitor - my 2 devices are system speakers and monitor speakers) make sure you have set the sound device to be your default in the volume tab (e.g. I would set my sound output to be the laptop speakers because they are my default). If you don't have multiple sound devices, then just ignore this.

You should now be able to record your screen and pc audio, if that's what you were looking for, otherwise, if you wanted your microphone to be recorded instead, see It Wasn't Me's answer.

Hope this helps

  • It's that's what i actually was looking. Thanks – Nikto Sep 4 '20 at 11:51
  • I can't play output.mkv. Final output file doesn't play. There is ffmpeg log: pastebin.com/29wUD1Vy Early, stereo mix was disabled, but now i have turned on Stereo Mix. – Nikto Sep 4 '20 at 14:40
  • OK - I had some problems with it too - removing the -qp 0 fixed it for me. Try doing that and let me know if it still happens. I updated my answer with the new code, minus the -qp 0. – pigeonburger Sep 5 '20 at 2:22
  • thanks, but i still have some issues. 1)When i say any phrase, i don't heard it in the final output file. 2)Sound from my computer successfully records, but i made test: I had runed my command and after that i was starting watch movie. And my movie in final output file freezes If you haven't understood me, i can give you a link on example of my final output file. How to fix it? And seems like resolution of final output file is better. Thanks again. – Nikto Sep 5 '20 at 18:43
  • And messages from ffmpeg here: Thread message queue blocking; consider raising the thread_queue_size option (current value: 8) Stream #0: not enough frames to estimate rate; consider increasing probesize Guessed Channel Layout for Input Stream #1.0 : stereo – Nikto Sep 5 '20 at 18:47
1

1. Get microphone device name using @Leo Chapiro/answer

2>&1 ffmpeg -list_devices true -f dshow -i dummy -hide_banner|find "Micro"

rem :: outputs is your microphone device :: 
[dshow @ 000001f8ff8d8c40]  "Microphone (Realtek High Definition Audio)"

2. Add your device input with -f dshow -i audio="Microphone (Realtek High Definition Audio)" ...

ffmpeg -f gdigrab -framerate 30 -i desktop -f dshow -i audio="Microphone (Realtek High Definition Audio)" output.mkv

3. For full hd, try:

ffmpeg -f gdigrab -framerate 30 -i desktop -c:v libx264 -qp 0 output.mkv  -f dshow -i audio="Microphone (Realtek High Definition Audio)" output.mkv

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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