[Libav-user] Seeking, timestamps, AVFrame, AVStream

Robert Krüger krueger at lesspain.de
Wed Sep 18 09:11:35 CEST 2013

On Tue, Sep 17, 2013 at 9:36 PM, James Board <jpboard2 at yahoo.com> wrote:
>>>Okay, that's helpful. But then how and where and by what program is
>>>timebase calculated?  Do the ffmpeg tools calculate it?  I don't see
>>>how they can.  They'd have to look at every frame in the video and
>>>that could take a very long time.
>>You should know that video formats reserve some space for metadata. And a
>> portion is dedicated to describe track properties like >VBR/CBR, total time
>> length and so on.
>>FFmpeg relies on those metadata to initiate everything but then can
>> recompute some on the fly, some other tools allows to actually >calculate
>> those track metrics directly from track content, it's safer but slower of
>> course.
> Let's say my input file is 500 GB and was generated by my capture card.
> Robert
> said the timebase member in ffmpeg structs hold the maximum granularity of
> all the timestamps.
> I'm wondering how that can be true.  It would take a very long time for
> ffmpeg to read
> 500 GB of data to figure out the maximum granularity of all timestamps, and
> that would
> definitely be noticeable.  Something else must happen.

To determine the timebase not all frames have to be read but for all
formats I have worked with so far, it is either in container or
bitstream metadata or defined by a standard.

Again, I recommend reading (there is so much material available via
Wikipedia or sources like wiki.multimedia.cx or others) over naive
guessing via observation (some is OK but without reading IMHO this
will be a slow learning curve).

I hope my comments have helped you somewhat. Over and out.

More information about the Libav-user mailing list