DXVA2_VideoProc Sample

Shows how to use DXVA Video Processing.

This sample programmatically generates video with a primary stream and a substream. The primary stream displays SMPTE color bars, and the substream is a semi-transparent rectangle. The video is then processed and displayed using a DXVA video processor. The user can change the planar alpha values, source and destination rectangles, color adjustments, and color space.

screenshot of the dxva2-videoproc sample

APIs Demonstrated

This sample demonstrates the following DXVA interfaces:

Usage

The DXVA2_VideoProc sample builds a Windows application.

Command line options:

Option Description
-hh Forces the application to use a hardware Direct3D device and a hardware DXVA device.
-hs Forces the application to use a hardware Direct3D device and a software DXVA device.
-ss Forces the application to use a software Direct3D device and a software DXVA device.

 

Keyboard commands:

Key Description
ALT+ENTER Switch between windowed mode and full-screen mode.
F1–F8 Enter one of the modes shown in the following table.
END Enable or disable debugging logging for dropped frames.
HOME Reset a parameter to its initial value.

 

Each of the function keys F1 through F8 switches to a mode in which the arrow keys can be used to adjust a particular rendering parameter. In addition, the color of the substream changes.

Key Description
F1 Adjust the alpha values.
  • UP: Increase the planar alpha of both streams.
  • DOWN: Decrease the planar alpha of both streams.
  • RIGHT: Increase the pixel alpha of the substream.
  • LEFT: Decrease the pixel alpha of the substream.
Substream color: White
F2 Adjust the primary stream's source area (zoom).
  • UP: Increase vertically (zoom in).
  • DOWN: Decrease vertically (zoom out).
  • RIGHT: Increase horizontally (zoom in).
  • LEFT: Decrease horizontally (zoom out).
Substream color: Red
F3 Move the primary stream's source area.
  • UP: Move up.
  • DOWN: Move down.
  • RIGHT: Move right.
  • LEFT: Move left.
Substream color: Yellow
F4 Adjust the primary stream's destination area.
  • UP: Increase vertically.
  • DOWN: Decrease vertically.
  • RIGHT: Increase horizontally.
  • LEFT: Decrease horizontally.
Substream color: Green
F5 Move the primary stream's destination area.
  • UP: Move up.
  • DOWN: Move down.
  • RIGHT: Move right.
  • LEFT: Move left.
Substream color: Cyan
F6 Change background color or color space.
  • UP, DOWN: Cycle through color spaces.
  • RIGHT, LEFT: Cycle through background colors.
Substream color: Blue
F7 Adjust brightness and contrast.
  • UP: Increase brightness.
  • DOWN: Decrease brightness.
  • RIGHT: Increase contrast.
  • LEFT: Decrease contrast.
Substream color: Magenta
F8 Adjust hue and saturation.
  • UP: Increase hue.
  • DOWN: Decrease hue.
  • RIGHT: Increase saturation.
  • LEFT: Decrease saturation.
Substream color: Black

 

In each mode, pressing the HOME key resets the parameters for that mode to their initial values.

Requirements

Product Version
Windows SDK Windows 7

 

Downloading the Sample

This sample is available in the Windows classic samples github repository.

DirectX Video Acceleration 2.0

DXVA Video Processing

Media Foundation SDK Samples