Live Streaming Latency Issue through Wowza

Hi,

I’m having trouble to reduce the latency while trying to broadcast my webcam. I’m streaming the webcam feed to Wowza server through ffmpeg, both the ffmpeg and Wowza server resides on the same machine.

With the webcam, I’m obtaining the compressed mjpeg feed at ~30 fps @ 1280x720 as in the input. As the encoder, I’m using x264 with zerolatency tune and preset of ultrafast. With Wowza application, I’ve enabled the low latency option. An example cmd line for ffmpeg is the following.

ffmpeg -f v4l2 -s 1280x720 -input_format mjpeg -i /dev/video0 -c:v libx264 -preset ultrafast -tune zerolatency -f flv rtmp://wowzaserverip:port/live/myStream

The current latency is about 3 seconds, viewed from Test Player on Wowza Engine Manager. I’ve tried online suggestions here but the latency doesn’t vary at all. I’ve played with crf and other settings and the only difference I noticed was image quality. With zerolatency, there is already 0 bframe with rc_lookahead and slice_lookahead disabled. The latency in transcoding should be of minimal.

I’m really stuck in finding out what is causing the latency. Please advice if anyone has any suggestions. Thank you very much.

I think the NetStream.bufferLength is set to 3 seconds in the test players, as is the default with JW Player, but it is easier to modify in JW Player as shown in the example in that guide.

Richard

That’s great, thanks for the update. Further to that, as we understand it, the RTMP player will wait for 60 frames before displaying h.264 video, unless you set bufferLength to “0”. This setting can cause playback problems if the bitrate is close to the client’s bandwidth. This is discussed in this guide.

Richard

I think the NetStream.bufferLength is set to 3 seconds in the test players, as is the default with JW Player, but it is easier to modify in JW Player as shown in the example in that guide.

Richard

Thank you for your suggestion. After setting up the JWPlayer on localhost I was able to reduce the latency drastically with the setting

rtmp: {
		bufferlength: 0.05
	}