[Libav-user] Improving HTTP demux throughput

Jabotical james.nickerson at vistasystems.net
Thu Oct 30 21:53:04 CET 2014


It's delightful that libav can directly open remote files for demuxing via
HTTP, and I've been impressed with its usability and performance in that
regard for most cases. It handles HLS like a champ.

But certain videos are demuxed extremely slowly, with calls to
av_read_frame() averaging out to 100 ms or more even on a local network. The
examples I see this happen on are usually Quicktime videos, some created by
iOS devices and some not. And this is on Windows systems, if that matters (I
haven't been in a position to try it on anything else).

The only thread I could find that seemed relevant was this one:
http://libav-users.943685.n4.nabble.com/Libav-user-Why-is-HTTP-streaming-so-slow-td4653420.html#a4653560
Which never really got resolved other than postulating that the socket
buffer size was to blame. I tried increasing the socket receive buffer in
ff_listen_connect(), but all that did was make it considerably worse.

The culprit videos seem to require frequent seeking in the muxed content, in
order to demux it. It's no surprise, then, that libav demuxes them much more
slowly, if it only maintains one socket connection at a time and has to keep
creating new sockets each time it dances back and forth instead of
downloading contiguous data.

I suspect the problem is the way the separate streams within the file are
arranged, since it seems as though the audio is all demuxed from a few MB at
the beginning, while the video comes from the entire length of the file. So
is there any way to get libav to demux only one stream when av_read_frame()
is called, rather than dancing about creating new sockets each time it moves
back and forth between the streams?

Or, barring that, is it possible to get it to maintain more than one socket
while demuxing content streamed via HTTP over a network, so that separate
streams of contiguous data can be efficiently read? Or any other suggestions
for speeding up demuxing in this sort of case would of course be
appreciated!

Thanks!



--
View this message in context: http://libav-users.943685.n4.nabble.com/Improving-HTTP-demux-throughput-tp4660593.html
Sent from the libav-users mailing list archive at Nabble.com.


More information about the Libav-user mailing list