[FFmpeg-devel] Fix for poor bandwidth usage on Windows

Don Moir donmoir at comcast.net
Fri Oct 5 22:43:19 CEST 2012

> We had noticed that when we streamed a video using ffmpeg we'd get much 
> lower bitrates than what we expected based on our bandwidth. We did some 
> investigation and tracked down the problem to the way ffmpeg's 
> networking code calls send(). It was calling the function many times 
> with small chunks of data (including lots of calls with 1 byte, 8 bytes, 
> etc.). This appears to be fine on Linux but on Windows this causes a 
> significant slowdown due to the way the send() function behaves. To fix 
> this we changed the ffmpeg RTMP code to buffer the data and only call 
> send() when the buffer fills up (we use a 64K buffer). This improved the 
> speed by over 10x. Our patch was specific to RTMP since that's the only 
> thing we were using; however, you probably want to do this buffering in 
> a more generic way at the TCP level.
> I've attached the affected files. The buffering happens in the 
> ff_buffered_urlwrite function in rtmppkt.c.

Probably still want to buffer some but did you try to disable the Nagel algorthm ? Enabled by default on windows.

Did not look at the code at all so just something to try.

More information about the ffmpeg-devel mailing list