• How to fix unaligned video and audio with a server-side sort buffer

    This article explains how you can create and configure a server-side sort buffer to help solve unaligned video and audio in a live application stream.

    You can configure application properties in Wowza Streaming Engine™ Manager or by editing [install-dir]/conf/[application]/Application.xml. If you make changes to Application.xml and you're using Wowza Streaming Engine media server software, any supported settings are displayed in the manager the next time it's started. Wowza Media Server™ software doesn't support Wowza Streaming Engine Manager, so you must edit Application.xml in a text editor if you're running Media Server software.

    Wowza Streaming Engine Manager configuration


    To configure a server-side sort buffer in Wowza Streaming Engine Manager:

    1. In the manager Welcome page, click the Applications tab at the top of the page.

    2. In the Applications contents panel, click the name of your live application (such as live).

    3. On the live application page Properties tab, click Streams in the Quick Links bar.

      Note: Access to the Properties tab is limited to administrators with advanced permissions. For more information, see Manage credentials.
    4. Click Edit in the Streams properties area and make the following changes:

      1. Select the Enabled check box next to sortPackets and set the value to true.

      2. Select the Enabled check box next to sortBufferSize and set the value to 750.

    5. Click Save, and then restart the application when prompted to apply the changes.

    XML configuration


    To configure a server-side sort buffer in Application.xml:

    1. Use a text editor to open the [install-dir]/conf/[application]/Application.xml file for your live application and add the following property to the Streams/Properties container. Be sure to add the properties to the correct <Properties> container in Application.xml as there are several such containers in the file.
      <Property>
          <Name>sortPackets</Name>
          <Value>true</Value>
          <Type>Boolean</Type>
      </Property>
      <Property>
          <Name>sortBufferSize</Name>
          <Value>750</Value>
          <Type>Integer</Type>
      </Property>
    2. Restart the Wowza media server software to apply the changes.

    Verify sort buffer configuration


    After the stream is first published, check the access log file in [install-dir]/logs to verify that the sorting buffer is configured properly. You should see a statement that looks like this:
    sortPackets[1]: sortBufferSize:750
    You can also search for the keyword sortPackets in the Logs feature in Wowza Streaming Engine Manager to confirm proper configuration.

    If you don't see this in the logs, go back and double-check to make sure that you put the properties in the correct <Properties> container and that they are not commented-out.

    Note: You can also try to reduce the video stream complexity. If the video stream is encoded using Main Profile, try Baseline Profile instead. Sometimes more complex H.264 encodes that use complex B-frame structures can cause the video stream to be out-of-sync with the audio during playback.

    Updated: For Wowza Streaming Engine 4.0 on 12-04-2014.

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