[FFmpeg-user] Black screen when capturing Windows desktop with audio (gdigrab, dshow)

German Geraskin german.geraskin at gmail.com
Mon Jan 23 14:57:18 EET 2023


Dear Markus,

My tests show that this issue does not depend on the encoders.
I tested libx264 (with fast, veryfast, ultrafast presets)/aac and
libvpx-vp9/libvorbis encoder combinations with the same result.

Examples (VP9 / Vorbis):

This command works as expected. (video only)
https://0x0.st/oh5V.webm/gdigrab-vp9-without-audio.webm

  ffmpeg.exe -f gdigrab -framerate 25 -offset_x 54 -offset_y 114
-video_size 960x540 -show_region 1 -i desktop -pix_fmt yuv420p -r 25
-g 50 -c:v libvpx-vp9 -crf 30 -b:v 0 -y gdigrab-vp9-without-audio.webm


This command produces a "black screen" issue. (video and audio)
https://0x0.st/oh5W.webm/gdigrab-vp9-dshow-audio-vorbis-ISSUE.webm

  ffmpeg.exe -f gdigrab -framerate 25 -offset_x 54 -offset_y 114
-video_size 960x540 -show_region 1 -i desktop -f dshow -i
audio="Microphone (Logitech USB Headset H540)" -pix_fmt yuv420p -r 25
-g 50 -c:v libvpx-vp9 -crf 30 -b:v 0 -c:a libvorbis -b:a 64k -y
gdigrab-vp9-dshow-audio-vorbis-ISSUE.webm


This is a workaround to avoid the "black screen" issue. (video and audio)
https://0x0.st/oh54.webm/gdigrab-vp9-dshow-audio-vorbis-SOLVED.webm

  start ffmpeg.exe -f gdigrab -framerate 25 -offset_x 54 -offset_y 114
-video_size 960x540 -show_region 1 -i desktop -f dshow -i
audio="Microphone (Logitech USB Headset H540)" -pix_fmt yuv420p -r 25
-g 50 -c:v libvpx-vp9 -crf 30 -b:v 0 -c:a libvorbis -b:a 64k -y
gdigrab-vp9-dshow-audio-vorbis-SOLVED.webm


So, I still think that this is a bug of OS Windows.

German

>
> Dear German,
>
> I tested on my notebook and have had same experience even without audio.
> To solve the issue in both I changed the preset to "fast" or "ultrafast"
> instead "veryfast".
>
> Markus


More information about the ffmpeg-user mailing list