• How to enable hardware-accelerated transcoding when running as a Windows service

    This article describes a Windows service workaround to enable Wowza Transcoder Intel Quick Sync and NVIDIA CUDA hardware acceleration.

    Notes:
    • Wowza Streaming Engine™ software or Wowza Media Server™ software (version 3 or later) is required.

    • Important: NVIDIA CUDA encoding acceleration isn't supported in the latest NVIDIA graphics drivers (340 and later). CUDA-based accelerated encoding is NOT supported in Wowza Streaming Engine™ 4.1.2 and later.

    Problem

    Wowza Transcoder supports Intel Quick Sync and NVIDIA CUDA hardware acceleration. On the Windows operating system, implementation of this acceleration relies on interaction with the hardware graphics drivers. In the Windows Vista and Windows Server 2008 operating systems, 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 media server software is run as a system service, Wowza Transcoder hardware acceleration isn't available.

    Note: Drivers for NVIDIA NVENC and NVIDIA Tesla GPU hardware are structured in a way such that the hardware acceleration capabilities are available to applications running in Session 0 Isolation.
    For more information about how Session 0 Isolation works, see Application Compatibility - Session 0 Isolation.

    Workaround

    You can try to workaround this issue by creating a setup where the Wowza media server software is started when a server is rebooted and the Wowza media 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 the Wowza media server when a particular user logs on to the server.

    2. Configure the server to automatically log on after reboot.

    Create Windows Scheduled Task

    To create a Windows Scheduled Task to run the Wowza media server software, do the following:

    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 media server.
      2. Click Change User or Group, and then select the user that will be used to automatically log on to the server and run the Wowza media server software.
      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 media server task should be displayed near the bottom of the list. If you right-click the Wowza media server task and select Run, a command prompt will open and the Wowza media server software will start. If a command prompt doesn't open, double-click the Wowza media server 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 media 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 logon 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 the Wowza media server software in this manner shouldn't affect performance and should be as secure as when running the Wowza media server 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 media server scheduled task is stopped or the user logs off the server, the Wowza media server 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 the Wowza media server by running the %WMSAPP_HOME%/bin/shutdown.bat script.


    Originally Published: 10-12-2011.
    Updated: For Wowza Streaming Engine 4.1.2 on 03-02-2015.

    If you're having problems or want to discuss this article, post in our forum.