righttotally.blogg.se

Simple screen capture windows
Simple screen capture windows










  1. #Simple screen capture windows how to#
  2. #Simple screen capture windows install#
  3. #Simple screen capture windows driver#
  4. #Simple screen capture windows code#

The SetupEncoding method described in this section initializes some of the main objects that will be used to capture and encode video frames and sets up the encoding parameters for captured video.

#Simple screen capture windows code#

Note that in order to reduce the size of the code listings in this article, the code in the walkthrough below omits explicit namespace references and the declaration of MainPage class member variables which are named with a leading underscore, "_". In the Browse tab search for the "SharpDX.Direct3D11" package and click Install.

#Simple screen capture windows install#

To install the SharpDX Nuget package, in Visual Studio select Manage Nuget Packages. To access this folder you must include the Videos Library capability. This example saves generated video files to the Videos Library on the device. In order to use the APIs in your app, you must include the Graphics Capture capability in the Package.appxmanifest file for your project. The example code in this walkthrough was created using the Blank App (Universal Windows) C# project template in Visual Studio 2019. We have tried to keep the Direct3D operations as discrete as possible to make it easier for you to substitute your own code or other libraries for these tasks. This library is no longer officially supported, but it was chosen because it's performance at low-level copy operations is well-suited for this scenario. For this example, we are using the SharpDX library to perform the Direct3D operations from C#. At a low level, this operation is done using Direct3D. Direct3D APIs are used to perform this copy operation quickly.Īs stated above, the copying of each captured frame is probably the most complex part of the implementation shown in this article. Copying frames - Frames are copied from the capture frame buffer into a separate Direct3D surface that can be passed to the MediaStreamSource so that the resource isn't overwritten while being encoded.Synchronization is important to allow frames to be captured and encoded simultaneously. This example uses events to coordinate the requests for new frames between the different components of the example.

#Simple screen capture windows driver#

Event handlers and threading - The primary driver of the main capture loop is the MediaStreamSource which requests frames periodically through the SampleRequested event.Initialization - This includes configuring the UWP classes described above, initializing the graphics device interfaces, picking a window to capture, and setting up the encoding parameters such as resolution and frame rate.

simple screen capture windows

The example code shown in this article can be categorized into a few different tasks:

  • The MediaTranscoder class receives the stream produced by the MediaStreamSource and encodes it into a video file.
  • simple screen capture windows

  • The MediaStreamSource class receives the captured frames and generates a video stream.
  • The Direct3D11CaptureFramePool class maintains a buffer of frames into which the screen contents are copied. GraphicsCaptureSession is used to start and stop the capture operation. The GraphicsCaptureItem class represents the window or display being captured.
  • The Windows.GraphicsCapture APIs do the work of actually grabbing the pixels from the screen.
  • simple screen capture windows

    The screen capture process uses three primary UWP features: While it may seem like there is a lot of code required to implement this scenario, the high-level structure of a screen recorder app is fairly simple. This article provides a walkthrough of an example app that records the contents of a window to a video file.

    simple screen capture windows

    For a simple end-to-end sample app that utilizes the concepts and techniques shown in this article, see SimpleRecorder. For information on screen capturing still images, see Screen capture.

    #Simple screen capture windows how to#

    This article describes how to encode frames captured from the screen with the APIs to a video file.












    Simple screen capture windows