[FFmpeg-devel] [PATCH] Add Win32 GDI-based screen grabbing

Don Moir donmoir at comcast.net
Tue Mar 25 10:30:01 CET 2014

----- Original Message ----- 
From: "Eli Kara" <eli at algotec.co.il>
To: "FFmpeg development discussions and patches" <ffmpeg-devel at ffmpeg.org>
Sent: Tuesday, March 25, 2014 4:22 AM
Subject: Re: [FFmpeg-devel] [PATCH] Add Win32 GDI-based screen grabbing

>> As far as performance, I actually found that it's pretty good on modern windows computers. The performance issues that I was 
>> seeing was solely due to using Windows 8.1 on an laptop with older Intel integrated graphics that didn't > have a fully supported 
>> driver.
>> Calvin
> I just have to mention something with regards to capturing from the screen. As far as modern operating system go, i.e: Win7 with 
> desktop composition and Windows 8 (where desktop composition cannot even be disabled),
> the performance will *always* be far from optimal. Copying from video memory back to system memory is an inherently expensive 
> operation, sometimes in the order of tens of milliseconds. Additionally, it will inevitably
> stall the entire GPU and WDM pipes. Actually, due to this, capturing this way is even slower than it used to be in Windows XP 
> (this is documented).
> Just a point to keep in mind..
> Regards,
> Eli

Just to echo and add to Eli,

With Vista and up, GDI is not hardware accerated when Aero is on. Don't know about Win 8. Turn Aero off and with Vista and Win 7, 
GDI goes back to hardware acceleration. It can have a radical effect on performance. Anything using GetPixel and SetPixel too often 
can bring a fast computer to a crawl with Aero on. Try the MS utility zoomin.exe with Aero on and off in Win 7. BitBlt can also 
suffer quite abit. With Aero off or in XP, BitBlt goes right to screen memory. With Aero on, it's layered in software.

Use Dib sections and access memory directly. Looks like MS is trying to phase out GDI in favor of Direct2D. Long and short is be 
careful and test. 

More information about the ffmpeg-devel mailing list