For a new project I need an audio live stream with very low latency (< 500 ms) from microphone to an online audience (web browsers).
So far I have tried a Wowza (trial licence) AMI on AWS (application with low-letency, otherwise standard settings), using Flash Media Live Encoder on the broadcaster side and the JWPlayer on the audience side. However, latency is very bad (20-30 seconds). Is there anything I can do to improve latency? I have searched this forum, but there is not much about audio only streaming. I can’t imagine that a latency that high is normal for low latency live streams. Especially if it’s sound only. Is there an encoder that is better suited than Flash Media Live Encoder?
Thanks for your help.
Hello there and welcome to the Wowza support forum.
20 to 30 seconds sounds like you are doing HDS streaming (HTTP) as opposed to RTMP streaming? HTTP segmented streaming is high latency.
Take a look at this guide for lowest latency:
How to achieve the lowest latency from capture to playback
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.
Note: When using JW Player, the buffer length is set using the bufferLength parameter. See How to use LongTail JW Player 6 with Wowza Media Server.
HTTP streaming sends chunks to the client. The client needs 3 chunks cached before it starts playing.
By default Wowza is set to send 3, 10 second chunks in each packet sent to the client. You can modify this behavior by editing the Application.xml file.
This guide explains how to control how the segmenter segments an incoming live stream:
How to configure Apple HTTP Live Streaming packetization (cupertinostreaming)
How to configure Adobe HDS packetization (sanjosestreaming)
I hope this answers your questions.
Kind regards,
Salvadore
I have taken this information straight from the guide posted above:
How to achieve the lowest latency from capture to playback
Although zero will give 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 30 fps video (and even higher at lower frame rates). This seems to be a player issue.
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 NellyMoser ASAO or Speex for audio. To achieve low latency, it’s important that you configure your encoding to produce a reasonable quality at the lowest possible bitrate. The VideoChat example that ships with Wowza Media Server 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 key frame interval can improve playback time in some cases.
Kind regards,
Salvadore
Hi Salvadore,
thanks a lot for your quick answer. I’ve changed to RTMP streaming and added “bufferlength: 0” to my JWPlayer. Now latency is indeed much lower (3 seconds audio only and 5 seconds audio and video, using Flash Media Live Ecnoder). However, it is still too much latency. Flash Media Live Ecnoder has a max buffer size of 1 second. Is there another encoder with lower buffer size I can use? Are there other settings to further decrease latency?
I did some testing with UDP (using GoCoder on my iPhone with WiFi, audio only), which decreased latency to 2 seconds. It does not seem possible to deliver a RTPS stream using Flash Media Live Ecnoder. What other encoder can I use?
Kind regards,
Simon