Skip navigation
hawey bai
Currently Being Moderated

How to decrease the latency with flash+http+camera video?

Sep 26, 2011 11:59 PM

I build a HTTP server between live camera and flash player. The flash player connect http server with NetStream. But i find there is a long latency and NetStream doesn't decode frames when the buffersize reach a special value. So i want to know, how to decrease the latency in those environment?

 

And why the frame cannot be decoded when the buffersize reachs a special value. I find the buffersize*framerate is about 64. Can i low this value?

 
Replies
  • Currently Being Moderated
    Sep 27, 2011 1:06 AM   in reply to hawey bai

    Hi,

     

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 28, 2011 3:41 AM   in reply to hawey bai

    Hi,

     

    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>
    
    
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 28, 2011 11:22 PM   in reply to hawey bai

    Hey,

     

    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.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points