DirectShow Registry Settings (Compact 2013)

3/26/2014

The following topics describe programming elements that can add, delete, enumerate, or represent DirectShow registry settings:

Windows Media Video Codec Performance

The HKLM\Software\Microsoft\DirectX\DirectShow\WMVDecoder registry key allows you to adjust Windows Media video codec playback performance and quality for x86 processors only. This entry is not available for other architectures.

[HKEY_LOCAL_MACHINE\Software\Microsoft\DirectX\DirectShow\WMVDecoder]
    "PostProcessing"=dword:FFFFFFFF

By default, each frame from a Windows Media video stream undergoes some level of post-processing after it is decoded.

The level of post-processing depends on the level of CPU performance. This post-processing smoothes the video frame by deblocking the image to smooth artifacts that are inherent to the digital compression process, and by deringing the image to correct for certain motion artifacts. Adjusting the amount of post-processing directly affects your target device's CPU usage.

The following table shows the allowable settings for the PostProcessing named entry.

  • FFFFFFFF
    Automatic. The Windows Media codec automatically sets the level of post-processing based on the incoming data and the CPU of your device.
  • 0
    Disabled. All post-processing is disabled. This setting produces the highest frame rates during playback, but at the expense of video quality.
  • 1
    Fast deblocking. The codec runs each frame through a coarse deblocking filter.
  • 2
    Full deblocking. The codec runs each frame through a fine deblocking filter.
  • 3
    Fast deblocking and deringing. The codec runs each frame through a coarse deblocking filter and through a deringing filter.
  • 4
    Full deblocking and deringing. The codec runs each frame through a fine deblocking filter and also through a deringing filter. This setting has the highest CPU usage. It produces the highest quality image for each individual frame; however, the overall frame rate may be degraded.

Audio and Video Thread Priorities

If DirectShow uses a very high percentage of your device's CPU when decoding video, you may experience choppy audio and video performance if other threads with higher priorities need to use the CPU.

If you must maintain smooth audio or smooth video playback at all times, you can use the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectShow\ThreadPriority to fine tune the priorities for the audio and video threads.

The following table shows the named entries and the associated registry values for this key.

Name

Type

Description

Critical

REG_DWORD

Default setting is the hexadecimal value F8, identical to the remapped value of THREAD_PRIORITY_TIME_CRITICAL (248).

Sets a new thread priority for DirectShow threads running with a priority of THREAD_PRIORITY_TIME_CRITICAL.

Highest

REG_DWORD

Default setting is the hexadecimal value F9, identical to the remapped value of THREAD_PRIORITY_HIGHEST (249).

Sets a new thread priority for DirectShow threads running with a priority of THREAD_PRIORITY_HIGHEST.

AboveNormal

REG_DWORD

Default setting is the hexadecimal value FA, identical to the remapped value of THREAD_PRIORITY_ABOVE_NORMAL (250).

Sets a new thread priority for DirectShow threads running with a priority of THREAD_PRIORITY_ABOVE_NORMAL.

Normal

REG_DWORD

Default setting is the hexadecimal value FB, identical to the remapped value of THREAD_PRIORITY_NORMAL (251).

Sets a new thread priority for DirectShow threads running with a priority of THREAD_PRIORITY_NORMAL.

BelowNormal

REG_DWORD

Default setting is the hexadecimal value FC, identical to the remapped value of THREAD_PRIORITY_BELOW_NORMAL (252).

Sets a new thread priority for DirectShow threads running with a priority of THREAD_PRIORITY_BELOW_NORMAL.

Lowest

REG_DWORD

Default setting is the hexadecimal value F8, identical to the remapped value of THREAD_PRIORITY_LOWEST (253).

Sets a new thread priority for DirectShow threads running with a priority of THREAD_PRIORITY_LOWEST.

AboveIdle

REG_DWORD

Default setting is the hexadecimal value F8, identical to the remapped value of THREAD_PRIORITY_ABOVE_IDLE (254).

Sets a new thread priority for DirectShow threads running with a priority of THREAD_PRIORITY_ABOVE_IDLE.

Idle

REG_DWORD

Default setting is the hexadecimal value F8, identical to the remapped value of THREAD_PRIORITY_IDLE (255).

Sets a new thread priority for DirectShow threads running with a priority of THREAD_PRIORITY_IDLE.

Video

REG_DWORD

Default setting is the hexadecimal value FB, identical to the remapped value of THREAD_PRIORITY_NORMAL (251).

Sets a new thread priority for the video rendering thread in DirectShow.

The setting for Normal does not affect the video rendering thread.

All of the named values, except for Video, are associated with standard operating system thread priority levels. For more information, see SetThreadPriority.

DirectShow threads that are identified with the standard operating system thread priorities run at the priority levels specified by these registry settings instead of the normal values. These settings only affect threads that are owned by DirectShow. They do not affect the global OS priority levels and they do not affect threads owned by Windows Media Player.

The following registry key example shows the default values for this registry subkey.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectShow\ThreadPriority]
    "Critical"=DWORD:F8
    "Highest"=DWORD:F9
    "AboveNormal"= DWORD:FA
    "Normal"= DWORD:FB
    "BelowNormal"= DWORD:FC
    "Lowest"= DWORD:FD
    "AboveIdle"= DWORD:FE
    "Idle"= DWORD:FF
    "Video"= DWORD:FB

Note

The default settings for the DirectShow thread priorities provide satisfactory results for almost all devices and these values should not be changed unless absolutely necessary.

Adjusting the thread priorities from their default values can be risky because the adjustments can cause unexpected performance issues for other applications running concurrently with your DirectShow application. Such issues can be very difficult to test, diagnose, and resolve.

If you need to adjust the DirectShow audio and video thread priorities, make sure the DirectShow priorities are higher than the audio and video driver priorities in your OS design. Also make sure the audio priority is higher than that of the software mixer. If you do not perform these actions, the result will be in audio and video playback performance issues.

Video Renderer Settings

You can control the settings of the video renderer with the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\DirectX\DirectShow\Video Renderer.

The following table shows the named entries for this key.

Name

Type

Description

MaxBackBuffers

REG_DWORD

The default setting is 1.

This value controls the number of back buffers the video renderer can use.

Do not set this value greater than 2.

Depending on the quality of the surface flipping implementation in the display driver, the value 0 can sometimes provide the best performance.

SurfaceTypes

REG_DWORD

This value defines the types of video surfaces that the video renderer uses.

It is a bitwise combination of the DirectShow DirectDraw Surface (AMDDS) definitions shown in the table following this one.

Always set this value to a hexadecimal value, not a symbolic constant.

If you set this value to 0x00 (AMDDS_NONE), the video renderer uses GDI.

UseOverlayStretch

REG_DWORD

The default setting is 1.

This value controls aspect ratio preservation in the overlay area.

Set this value to 1 to stretch the video image to fill the overlay area.

Set this value to 0 to preserve the aspect ratio of the video image.

UseScanLine

REG_DWORD

The default setting is 0.

This value defines whether the video renderer uses IDirectDraw::GetScanLine to determine when to blit or flip.

This is typically an expensive operation, so it is turned off by default.

Set this value to 1 to turn it on.

KeyColor

HEX

This value defines the color key when playing back video using an overlay on a non-palettized display, which is a display with a color depth greater than 8 bits per pixel (bpp).

This is a hexadecimal RGB value.

KeyIndex

HEX

This value defines the color key when playing back video using an overlay on a palettized display, a display with a color depth less than or equal to 8 bpp.

This is a hexadecimal value ranging from 0 to 2^(color depth) - 1.

The following table shows the DirectShow DirectDraw Surface (AMDDS) values for use with the SurfaceTypes named entry.

Flag

Hexadecimal value

Description

AMDDS_NONE

0x00

No support for Device Control Interface (DCI) or DirectDraw.

AMDDS_DCIPS

0x01

Use DCI primary surface.

AMDDS_PS

0x02

Use DirectDraw primary surface.

AMDDS_RGBOVR

0x04

RGB overlay surfaces.

AMDDS_YUVOVR

0x08

YUV overlay surfaces.

AMDDS_RGBOFF

0x10

RGB off-screen surfaces.

AMDDS_YUVOFF

0x20

YUV off-screen surfaces.

AMDDS_RGBFLP

0x40

RGB flipping surfaces.

AMDDS_YUVFLP

0x80

YUV flipping surfaces.

AMDDS_ALL

0xFF

Use all available surfaces.

AMDDS_DEFAULT

0xFF

Use all available surfaces.

AMDDS_YUV

0xA8

(AMDDS_YUVOFF | AMDDS_YUVOVR | AMDDS_YUVFLP)

AMDDS_RGB

0x58

(AMDDS_RGBOFF | AMDDS_RGBOVR | AMDDS_RGBFLP)

AMDDS_PRIMARY

0x03

(AMDDS_DCIPS | AMDDS_PS)

Encoder Quality Settings

You can establish quality levels and associated parameters for image encoding with the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectShow\ImageSink\Quality\<Quality Level>\<File Extension>\<Parameter Name>. The IImageSinkFilter Interface uses this key to obtain parameter values that pass to the image encoding factory.

The quality level, file extension, and parameter name are all integral to the path of the registry key. The following table shows the named values for a parameter. Each of these values corresponds to a member of a StructEncoderParameter structure.

Name

Type

Description

GUID

REG_BINARY

No default setting.

This value is the GUID that identifies the encoding parameter.

NumberOfValues

REG_DWORD

No default setting.

The number of parameters values contained in the Value value.

Type

REG_DWORD

No default setting.

A value that identifies the data type of the parameter.

Value

REG_DWORD

No default setting.

The value of the parameter. If NumberOfValues is greater than 1 then this value must be provided a binary data that encodes all of the values.

The following example shows a registry entry that sets one value for the Compression parameter when encoding a JPEG file at quality level 0.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectShow\ImageSink\Quality\0\jpg\Compression]
"GUID"="0xe09d739d-ccd4-44ee-8eba-3fbf8be4fc58"
"Value"=dword:00000003
"Type"=dword:00000004
"NumberOfValues"=dword:00000001

Memory Usage and Performance During Streaming

The following registry key can be used to control how much memory is allowed for the buffer during streamed playback of media by using Windows Media technologies:

HKEY_CURRENT_USER\Software\Microsoft\Netshow\Player\

This entry gives you a choice between memory usage and performance. For very high bit-rate, high definition video files, you need to allow a very large amount of memory to avoid running out of buffer when a long stream of hard frames arrive.

The registry keys are just multipliers of the pre-roll value set in the file. They should be specified as percentage numbers. Therefore, a number of 300 means a multiplier of 3x. 1 means 0.01X.

Name

Type

Description

PrerollMinMultiplier

REG_DWORD

This is the low watermark, issuing a freeze if the buffer goes below multiplier * pre-roll value.

PrerollMaxMultiplier

REG_DWORD

This is a high watermark, limiting buffering to the amount specified by pre-roll * multiplier.

Settings for the MPEG-2 Program Stream Multiplexer Filter

You can use the following registry key to recommend for the number and size of MediaSamples allocated for the connection between the MPEG-2 Program Stream Multiplexer Filter and the DVR Engine Sink filter:

[HKEY_LOCAL_MACHINE\Software\Microsoft\Dvr\DvrPsMux]

Name

Type

Description

OutputBufferCount

REG_DWORD

The number of samples, which is chosen based on system memory constraints and performance requirements.

OutputBufferSize

REG_DWORD

This value is the most important. To process video streams that are larger than the MPEG-2 video constraints specified in the DVD-Video spec (section 5.4.1.2), increase the media sample size to a value greater than the default of 128Kb.

Choose a sample size that is big enough to hold a complete I-frame, and include any audio data that may accompany it.

These values are not set by default. They assist in recommending the number and size of media samples allocated for the connection between the MPEG-2 Program Stream Multiplexer Filter and the DVR Engine Sink filter.

The following list contains programming elements that can add, delete, enumerate, or represent DirectShow registry settings:

MPEG Splitter Settings

You can control the number and size of the buffers available on the input pin of the MPEG-1 Parser/Splitter with the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\Multimedia\DirectShow\MPEG Splitter.

The upstream asynchronous file source filter uses this key during pin negotiation; see File Source (Async) Filter.

The following table shows the named entries for this key.

Name

Type

Description

BufferCount

REG_DWORD

The default setting is 4.

This value controls the number of buffers the MPEG-1 Stream Splitter Filter uses.

BufferSize

REG_DWORD

The default setting is 10000.

This value defines the size, in bytes, of each buffer.

See Also

Reference

DirectShow Reference
DMO Wrapper Filter