How to fix "Could not run graph" error when recording the screen with audio using ffmpeg in Windows 10?
I want to record the screen with audio using ffmpeg in Windows 10.
The following command works but it does not record the audio:
.\ffmpeg -f gdigrab -framerate 30 -i desktop output.mkv
To fix the issue, first I enable Audio Mix device from control panel > sounds
and then tried to find it in my audio devices with the follwing command:
.\ffmpeg -list_devices true -f dshow -i dummy
I try different syntaxes to add audio to the video in the first command:
.\ffmpeg -f gdigrab -framerate 60 -video_size 1920x1080 -i desktop -f dshow -i audio="Stereo Mix (Realtek(R) Audio)" -vcodec libx264 -preset ultrafast -tune zerolatency -pix_fmt yuv422p -f mpegts udp://ip
.\ffmpeg -f gdigrab -i desktop -f dshow -i audio="Stereo Mix (Realtek(R) Audio)" -vcodec libx264 muxed-video-file.mp4
but the error is always the same:
Could not run graph (sometimes caused by a device already in use by other application)
audio=Stereo Mix (Realtek(R) Audio): I/O error
Please let me know if you know a working solution or a hint :-)
Solution 1:
I finally figured this out myself and I'm not sure if it applies in your situation but win 10 can cause virtual inputs like this to not be available due to privacy settings for the microphone. I'm using vb-audio "virtual audio cable" but I assume the same applies to Realtek stereo mix.
For me it was fixed by going to Privacy Settings In the App permissions section click "Microphone" And enable "Allow apps to access your microphone"