You may come across issues such as hang or a crash when trying to use Windows Media Encoder from a service.

Say you have a COM object which instantiate Windows Media Encoder and passes this to a service. The service may do one or more of the following:

a. Screen Capture

b. Audio recording

c. Capturing some statistics such as screen capture size, audio recording quality etc.

This may lead to a hang or freezing of the screen and certain undefined behaviours’.

The reasons may be varied but one of the most probable reasons is that Windows Media Encoder is COM intensive. Passing the Windows Media Encoder object to a different process can certainly screw things up.

Possible resolutions can be:

1. To make every call to Windows Media Encoder in a single thread.

2. The best option is to write your own code using Direct Show. This way you have your own code and it works on XP, Vista, and Windows 7.

3. Use Expression Encoder which is a pretty good replacement for Windows Media Encoder.

-Shamik Misra

Windows SDK