I am presently using ffmpeg to pull a stream from a camera using RTSP, and then output it as an HLS stream. I also have a webpage with a video.js player, using the example code found on this page.

My full ffmpeg command is as follows:

ffmpeg -rtsp_transport tcp -fflags nobuffer -i rtsp://my_rtsp_url_here -c copy -f hls -hls_base_url http://my_base_url_here/ -hls_time 2 -hls_list_size 8 -hls_flags delete_segments stream.m3u8

(As you can see, I've already done some things in an attempt to reduce latency, such as setting -fflags nobuffer.)

Currently, latency seems to be sitting at at least 12 seconds, though I don't have an exact measure. I would be interested in any suggestions for reducing latency, even if that means switching protocols. The only requirement is that I'd like to be able to serve this stream on a webpage.

I suspect that reducing video.js' buffer might help, but I don't know how to go about doing that.

1 Answer 1


I've solved my issue by switching webservers. Previously, I was using Python's builtin http.server, which was taking over 2 seconds to serve a single 2-second segment. (Naturally, this caused clientside stuttering and forced it to increase its buffer.)

Now, using Apache (though any other production webserver would probably be just as good) I'm enjoying stutter-free streaming at acceptable latency levels.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.