Enable hardware-accelerated transcoding for Wowza Streaming Engine when running as a Windows service

This article describes a Windows service workaround to enable the Wowza Streaming Engine™ media server software Transcoder to use Intel Quick Sync hardware acceleration.

Problem


The Transcoder in Wowza Streaming Engine supports Intel Quick Sync hardware acceleration. On Windows, this acceleration relies on interaction with the hardware graphics drivers. In the Windows Vista and Windows Server 2008, Microsoft began isolating system services in a non-interactive environment called "Session 0 Isolation." Applications running in Session 0 Isolation don't have access to hardware drivers. This means that when Wowza Streaming Engine runs as a system service, it can't use hardware acceleration for transcoding.

Workaround


You can try to work around this issue by creating a setup where Wowza Streaming Engine is started when a server is rebooted and the server runs in an environment with full access to the graphics hardware. The general steps involved are:
 
  1. Create a Windows scheduled task that runs Wowza Streaming Engine when a particular user logs on to the server.
     
  2. Configure the server to automatically log on after reboot.

Create Windows Scheduled Task

  1. Open Task Scheduler (Start > All Programs > Administrative Tools > Task Scheduler).
     
  2. On the Action menu, click Create Task action, set the following values, and then click OK:

    General tab

    1. In Name, enter Wowza Streaming Engine.
    2. Click Change User or Group, and then select the user that will be used to automatically log on to the server and run Wowza Streaming Engine.
    3. Select Run only when user is logged on.
    4. Uncheck Run with highest privileges.
    5. Uncheck Hidden.

    Triggers tab

    1. Click the New button.
    2. In the New Trigger dialog box, in Begin the task, select At log on.
    3. In the Settings area, select Specific user, click the Change User button, and then select the same user as in the previous step (if not already selected).
    4. Clear all Advanced settings options except for Enabled, which must be selected. 

    Actions tab 

    1. Click the New button.
    2. In the New Action dialog box, in Action, select Start a program.
    3. In the Program/script field, enter %WMSAPP_HOME%/bin/startup.bat.
    4. Leave the Add arguments (optional) field blank.
    5. In the Start in (optional) field, enter %WMSAPP_HOME%/bin.

    Conditions tab

    Clear the following options:
    • Start the task only if the computer is idle for
    • Start the task only if computer is on AC power
    • Wake the computer to run this task
    • Start only if the following network connection is available 

    Settings tab

    1. Select the Allow task to be run on demand option.
    2. Clear the Run task as soon as possible after a scheduled start is missed option.
    3. Clear the If the task fails, restart every option.
    4. Clear the Stop the task if it runs longer than option.
    5. Select the If the running task does not end when requested, force it to stop option.
    6. Clear the If the task is not scheduled to run again, delete is after option.
If you click the Task Scheduler Library folder icon in the Task Scheduler contents panel, you should see a list of active scheduled tasks. The new Wowza Streaming Engine task should be displayed near the bottom of the list. If you right-click the Wowza Streaming Engine task and select Run, a command prompt will open and Wowza Streaming Engine will start. If a command prompt doesn't open, double-click the Wowza Streaming Engine task entry and make sure that it's configured according to the instructions above. After you've set up the task properly, log off the computer and log back on as the user for which you configured the task to run. You should see a command prompt open and the Wowza Streaming Engine server start. Go to the next section after you have this working.

Set Server to Auto-Logon on Reboot

Next, we'll set Windows Server to automatically log on as the user for which you configured the scheduled task to run. There are several methods to configure Windows autologon. The following article describes a built-in method for setting up autologon:
  There are also third-party tools that help to make autologon more secure by better protecting the user name and password of the target user and locking the server after logon. The following third-party tool can help make autologon more secure:
 

Notes

  • When using LogonExpert and the security setting Lock computer after logon, you may need to set the Delay computer lock for [x] seconds value to 20 seconds to enable Intel Quick Sync acceleration to work properly.
     
  • Make sure that you configure power settings on the server such that the current user isn't automatically logged off and the server doesn't go into Sleep or Hibernation mode. Also, make sure to adjust power settings so that the server always runs at full performance.
     
  • Running Wowza Streaming Engine in this manner shouldn't affect performance and should be as secure as when running it in standalone mode on a Windows computer. The autologon setup introduces a potential security issue because your Windows Server will always be running with a named user logged on to the system.
     
  • When the Wowza Streaming Engine scheduled task is stopped or the user logs off the server, Wowza Streaming Engine is stopped abruptly and streams can't be closed gracefully. When this happens, not all internal events will be fired properly, which could lead to recorded files not being closed properly. One workaround for this is to always stop Wowza Streaming Engine by running the %WMSAPP_HOME%/bin/shutdown.bat script.