Screen recording using ffmpeg
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.
-
Go to control panel --> hardware and sound --> sound
-
Then click the 'recording' tab.
-
Now right click inside the device list and make sure that 'show disabled devices' is ticked. Stereo Mix should then show up.
-
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
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
Save audio="String"
in variable in loop:
- In command line:
for /f tokens^=2delims^=^" %i in ('"2>&1 ffmpeg -list_devices true -f dshow -i dummy -hide_banner|find "Micro""')do set "_mic="%~i""
- In Bat/Cmd file:
for /f tokens^=2delims^=^" %%i in ('"2>&1 ffmpeg -list_devices true -f dshow -i dummy -hide_banner|find "Micro""')do set "_mic="%%~i""
To direct use in loop audio="String"
in loop:
- In command line:
for /f tokens^=2delims^=^" %i in ('"2>&1 ffmpeg -list_devices true -f dshow -i dummy -hide_banner|find "Micro""')do
ffmpeg -f gdigrab -framerate 30 -i desktop -f dshow -i audio="%~i" output.mkv
- In Bat/Cmd file:
for /f tokens^=2delims^=^" %%i in ('"2>&1 ffmpeg -list_devices true -f dshow -i dummy -hide_banner|find "Micro""')do
ffmpeg -f gdigrab -framerate 30 -i desktop -f dshow -i audio="%%~i" output.mkv
-
Some further reading:
[√] DirectShow