ffmpeg how to record desktop video and audio in windows 10

I’m trying to record desktop video and audio in windows 10 with ffmpeg.

I Use this command:

ffmpeg -f gdigrab -framerate 30 -i desktop -f dshow -i audio="Stereo Mix (Synaptics SmartAudio HD)" d:\output.mkv 

but when I exit with q command from terminal I get this error:

[q] command received. Exiting.

[out#0/matroska @ 0000018ee98392c0] video:2862kB audio:186kB subtitle:0kB other streams:0kB global headers:4kB muxing overhead: 0.357037%
frame=   82 fps=8.8 q=-1.0 Lsize=    3058kB time=00:00:18.00 bitrate=1391.3kbits/s speed=1.92x  
... 
[libx264 @ 0000018ee98a9200] ref P L0: 48.9%  7.8% 34.7%  8.6%
[libx264 @ 0000018ee98a9200] ref B L0: 73.7% 22.0%  4.3%
[libx264 @ 0000018ee98a9200] ref B L1: 94.2%  5.8%
[libx264 @ 0000018ee98a9200] kb/s:1283.08

Conversion failed!

and the video is jerky and no audio.R

The version of ffmpeg is:

ffmpeg version 2023-07-19-git-efa6cec759-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers

and I enabled Stereo Mix in windows.

Any idea how i can fix it.

Thank you

Read more here: Source link