To reduce latency you keep your fragment duration around 3 – 4 seconds. Also, ensure that your key frame interval is same as your fragment duration. This may help in better fragment generation and reduce latency.
not clear about the reduce latency. In my camrea, i set framerate is 25fps, the key frame interval is 30. What's the fragment duration?
The fragment duration is set on the server side, in the livepkgr application. There is a event.xml file that can have this setting configured.
Also, there are few more things that could be done :
In server.xml there are tags that define the size of the recording before the flush to disk happens. You can reduce this value to have quicker flush to disk, reducing the latency.
<RecBuffer> <!-- Maximum number of seconds to wait before flushing the rec buffer.--> <!-- Lower values enable users to watch the recording with a lower --> <!-- latency relative to live, but at the cost of higher disk usage. --> <!-- Default is 5 seconds, minimum is 1 second --> <MaxFlushTime>5</MaxFlushTime> <!-- Maximum number of kilobytes to accumulate before flushing the --> <!-- rec buffer. Lower values enable users to watch the recording --> <!-- with a lower latency relative to live, but at the cost of higher --> <!-- disk usage. Default is 256 KB, minimum is 32 KB --> <MaxFlushSize>256</MaxFlushSize> <!-- Number of milliseconds to hold audio messages in the rec buffer --> <!-- while waiting for a video message. This allows for sorting of --> <!-- timestamps before flushing to disk in case video is delayed. --> <!-- By default this is blank, allowing FMS to automatically configure--> <!-- the lag to match the publishers buffer, eliminating A/V glitches --> <AllowedVideoLag></AllowedVideoLag> <!-- Absolute maximum size of the rec buffer, in kilobytes. This is --> <!-- intended as a safety net against AllowedVideoLag. Default 5 MB. --> <MaxSize>5120</MaxSize> <!-- Maximum gap between 2 adjacent messages when comparing the --> <!-- message timestamps with the real time. Server logs a warning --> <!-- when the timestamps between 2 adjacent messages is bigger than --> <!-- the difference in real time + MaxTimestampSkew. --> <!-- MaxTimestampSkew is in millisecond and is disabled by default --> <!-- To enable the warning, set value to positive value --> <MaxTimestampSkew>-1</MaxTimestampSkew> </RecBuffer>
Also, for more information please visit the following link to get to know more about http streaming. Also, I will recommend that your key frame duration of 30 seconds is a bit too high, it will be good if you keep it around 4 seconds.