[Libav-user] Improving HTTP demux throughput

Jabotical james.nickerson at vistasystems.net
Fri Oct 31 01:04:07 CET 2014


wm4 wrote
> Generally, huge latencies are to be expected when a av_read_frame()
> call switches the segment (because it makes a new connection). The only
> solution I found was buffering data between demuxer and the rest, and
> running the demuxer in a separate thread.

Right, that makes sense. Though if you're referring to HLS segments, I
should make it clear that HLS videos are in fact among the ones that work
the best.

I guess what I'm asking could be summed up as "Is there a way to minimize
the number of times an av_read_frame() call makes a new connection?" It's
doing this *multiple times per frame* for some videos (again, not HLS, just
certain Quicktime files).

I'm already buffering data between the demuxer and the rest, and running the
demuxer in a separate thread. The problem is that for certain videos, the
throughput is abysmal. Calling av_read_frame() as fast as I can in its own
thread gets me like 300-500 kB / s (~2.4-4 Mbps) of video demuxed. For
longish videos with any sort of typical bitrate, that makes for a
loooooooooong time buffering.

This is opposed to videos where the demuxer doesn't make a new connection
every time you read a frame -- which includes every HLS video I've tried --
where I see many times that throughput.


> I don't know HLS very well, but if it really switches back and forth
> between the same segments (i.e. keeping http connections open would
> help), the libavformat implementation probably can't handle this
> efficiently. Then it will keep behaving bad until someone goes and
> fixes it.

Thanks for the feedback! But as noted above, I probably wasn't clear --
*this problem isn't due to HLS*, and HLS content always works wonderfully.
Presumably because it's been muxed in a way that's friendly to streaming.

Again, I appreciate the reply!

I have since noted that XBMC seems able to stream some videos via HTTP that
I'm having trouble with, even though they're using ffmpeg and their code
looks similar. Zeranoe's ffmpeg libraries have exactly the same results as
with libav ones I built myself.



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


More information about the Libav-user mailing list