• How to set up low latency applications in Wowza Streaming Engine for RTMP streaming

    This article describes how to set up applications in Wowza Streaming Engine™ live streaming software to achieve the lowest possible latency from video capture to playback.

    Notes:
    • The properties used in this article to adjust the latency of a stream only affect RTMP-based clients.

    • To learn more about how to deliver low-latency streaming experiences using Wowza technology, see our Low-latency Streaming page.

    Contents


    Using a low-latency stream
    Changing player buffer time
    Encoder recommendations
    More resources

    Using a low-latency live application


    The Low-latency stream option can be enabled in your live application to lower stream latency. This setting is normally used for applications that publish and play live video content to one or a few client applications, such as in a video chat.

    Wowza Streaming Engine Manager configuration

    To enable Low-latency stream:

    1. In Wowza Streaming Engine Manager, click the Applications tab, and then click the name of your live application (such as live).

    2. In the Setup tab of the details page, click Edit.

    3. Enable Low-latency stream, click Save, and then restart the application when prompted to apply the changes.

    XML configuration

    To enable Low-latency stream:

    1. Use a text editor to open the [install-dir]/conf/[application]/Application.xml file for your live application and change the Streams/StreamType property value to live-lowlatency.

    2. Restart the Wowza media server software to apply the changes.

    Changing player buffer time


    On the player side, it's important that the NetStream.setBufferTime() method is set to zero (in ActionScript 3 use "NetStream.bufferTime = 0;"). This will give you the lowest possible latency on the playback side.

    Although zero gives you the best possible latency, it might not give you the smoothest playback. So you may need to increase the buffer time to a value slightly greater then zero (such as .1 or .25). When using H.264-encoded video, we've found that any buffer setting greater then zero introduces a latency of at least 2-3 seconds with video encoded at 30 frames-per-second (fps) (and even higher at lower frame rates). This seems to be a player issue.

    Note: When using JW Player, the buffer length is set using the bufferLength parameter. See How to use JW Player with Wowza Streaming Engine.

    Smoothing low frame rate playback

    When running with NetStream.setBufferTime set to zero, you can often see lower frame rates due to the way the player renders the frames immediately. You can sometimes smooth playback by decreasing the flushInterval property value. However, using flushInterval will also cause the server's per-stream CPU load to increase so you won't be able to handle as many concurrent sessions per server.

    Wowza Streaming Engine Manager configuration

    To smooth playback using the flushInterval setting:

    1. In Wowza Streaming Engine Manager, click the Applications tab and select your live application in the contents pane.

    2. In the details page, click the Properties tab, and then click Custom in the Quick Links bar.

      Note: Access to the Properties tab is limited to administrators with advanced permissions. For more information, see Manage credentials.
    3. In the Custom section, click Edit.

    4. Click Add Custom Property, specify the following settings in the Add Custom Property dialog box, and then click Add:

      • Path - Select /Root/Application/Streams.

      • Name - Enter flushInterval.

      • Type - Select Integer.

      • Value - Enter 25.

    5. Repeat the previous step to add the onFlushNotifyClients property using the following values:

      • Path - Select /Root/Application/Streams.

      • Name - Enter onFlushNotifyClients.

      • Type - Select Boolean.

      • Value - Enter true.

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


    XML configuration

    To smooth playback using the flushInterval setting:

    1. Use a text editor to open the [install-dir]/conf/[application]/Application.xml file for your live application and add the following properties 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>flushInterval</Name>
      	<Value>25</Value>
      	<Type>Integer</Type>
      </Property>
      <Property>
      	<Name>onFlushNotifyClients</Name>
      	<Value>true</Value>
      	<Type>Boolean</Type>
      </Property>
    2. Restart the Wowza media server software to apply the changes.

    Encoding recommendations


    Latency is also introduced into the process on the encoding side. We've found that you can achieve very low latency encoding using the Flash player's built-in encoding (Microphone and Camera). The built-in encoding system in the Flash player uses Sorenson Spark (a variant of H.263) for video and Speex for audio. To achieve low latency, it's important that you configure your encoder to produce a reasonable quality at the lowest possible bitrate. The VideoChat example in your Wowza media server software installation is a good example of how to use the built-in Flash encoder to produce a low latency stream.

    Increasing the frame rate and/or decreasing the keyframe interval can improve playback time in some cases.

    Note: The Speex audio codec uses an encoding methodology that encodes a fixed number of samples per packet. Because of this, it's actually better to use a slightly higher sample rate to achieve lower latency since packets are generated more often per second. So we suggest that when you use the built-in Microphone to encode audio, set the Microphone.rate to 11KHz or 22KHz.

    More resources


    Low-Latency Streaming: What is it and do you need it?

    Originally Published: 10-01-2010.
    Updated: For Wowza Streaming Engine on 09-01-2015.

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