Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Graphics
  4. Fastest way to capture screen?

Fastest way to capture screen?

Scheduled Pinned Locked Moved Graphics
graphicscsharpquestionc++game-dev
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Daniel Jansson
    wrote on last edited by
    #1

    What is the fastest way to capture the entire screen or a single window? It's simple to do with GDI but I feel that there must be faster ways to do this. I want to capture at least 30 images per second without affecting the computers performance to much. Any ideas? Is it possible to use directx to directly access the buffer on the graphics card? Language: Preferably .net and C# but c++ will do as well.

    M 1 Reply Last reply
    0
    • D Daniel Jansson

      What is the fastest way to capture the entire screen or a single window? It's simple to do with GDI but I feel that there must be faster ways to do this. I want to capture at least 30 images per second without affecting the computers performance to much. Any ideas? Is it possible to use directx to directly access the buffer on the graphics card? Language: Preferably .net and C# but c++ will do as well.

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      Maybe something useful here: Various methods for capturing the screen[^] Mark

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      D 1 Reply Last reply
      0
      • M Mark Salsbery

        Maybe something useful here: Various methods for capturing the screen[^] Mark

        Mark Salsbery Microsoft MVP - Visual C++ :java:

        D Offline
        D Offline
        Daniel Jansson
        wrote on last edited by
        #3

        Thank you, that was a really interesting article. Can´t figure out why I didn't find it when I searched :) However, GDI as mentioned in the article is to slow and according to the author (not tried it myself yet though), directx is to slow as well ("GetFrontBufferData() is a slow operation by design") That leaves me with the WMEncoder solution which seems great but it requires the Windows Media Encoder to be distributed with the application, and I don't want to do that. Anyone seen another approach to this?

        M 1 Reply Last reply
        0
        • D Daniel Jansson

          Thank you, that was a really interesting article. Can´t figure out why I didn't find it when I searched :) However, GDI as mentioned in the article is to slow and according to the author (not tried it myself yet though), directx is to slow as well ("GetFrontBufferData() is a slow operation by design") That leaves me with the WMEncoder solution which seems great but it requires the Windows Media Encoder to be distributed with the application, and I don't want to do that. Anyone seen another approach to this?

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          You can only do so much. Reading from a display adapter is slow no matter what you do. The best you could hope for is full read/write access directly to video RAM, which you're not going to get in a generic way that works on all machines. Your frame rate is pretty much unrealistic - especially for full screen. For example, just one of my screens at 30fps would require over 200MB of pixel data to be copied per second, and that's just getting the raw data. Then you probably need to do something with all that data. I've found GDI to be the most efficient, and the capture time is pretty insignificant compared with actually processing the data (compressing, saving, etc.). Good luck :) Mark

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups