[Libav-user] How do I seek to the very beginning of a file?

Michael Bradshaw mbradshaw at sorensonmedia.com
Thu Oct 18 21:35:30 CEST 2012

On Tue, Oct 16, 2012 at 9:33 PM, Don Moir <donmoir at comcast.net> wrote:
> Also just don't use AV_SEEK_BYTE because you will end up with logic that is
> worse. Most things like this lend themselves to timestamps anyway. But agree
> there were several cases in the past that a seek returned 0 instead of -1
> when it failed but that has gotten better. Apparently not for AV_SEEK_BYTE
> though.

FYI, I've reported it as ticket #1831:

I ended up just reading the first packet in the file to know which
stream it belongs to, and then seeking by that stream (and
AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY) to a very negative number to
ensure it seeks backward to the very first packet. It seems to work
for the time being.


More information about the Libav-user mailing list