[Libav-user] Slow loading/seeking when using custom IO

Pt Romac digidop at gmail.com
Tue Nov 29 23:13:49 EET 2016


I'm encountering a problem when using the latest source (and some older
versions, so I know it's something I'm doing wrong, and not a bug), but I'm
completely stumped and hoping someone will be able to help!

My custom IO looks exactly like this:


When opening an AVI (MP4, XVID), if I don't supply a seek function in my
call to avio_alloc_context, then the file opens and starts playing straight
away.  However, I can't seek without reading the rest of the file up until
the seek point, i.e. it doesn't seek, it just keeps reading.

If, on the other hand, I do supply a seek function, then seeking is fast.
But, the file takes a really long time to load.  It looks like it's taking
a long time for the read_header call inside avformat_open_input to complete.

I'm not an expert in video file formats, but I've ruled out the possibility
that this file can't be seeked quickly because any other clients I've seen
can do so with this same file.

Apologies for such a vague question.  I don't even know what code I could
send you as I can't imagine what could be the source of this problem
outside of my custom IO, but that code seems to be the same as other
projects.  Would anyone be able to point me in the right direction of where
to look, and prevent me from tearing out the scant remainder of my hair!?

Many thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20161129/c5fe11c2/attachment.html>

More information about the Libav-user mailing list