[theora-dev] How to get the duration of a file or track?
conrad at metadecks.org
Mon Aug 27 21:47:40 PDT 2007
On 28/08/07, Shane Stephens <shane.stephens at gmail.com> wrote:
> Please note that oggzinfo actually passes right through the file twice in
> order to gather these statistics - this is not necessary if you simply want
> to determine the Content-Duration. I'm also not 100% sure whether liboggz
> correctly supports chained oggs.
liboggz doesn't make any attempt to handle chaining -- for normal
reading, it simply calls page/packet callbacks as it sees them.
Consequently, oggzinfo will report info for the bitstreams in each
chain of a file, but does not take chains into account. As a result it
gets the duration and bitrates for chained files wrong.
liboggz and oggz-tools need at least the following to handle chained files:
- seeking should take chains into account
- reading should report chain boundaries (eg. a "new chain" callback)
- writing should allow writing of chains (currently you would
basically need to create a new OGGZ* writer for each chain, attached
to the same fd)
- oggzinfo should calculate duration for each chain, sum durations
for the whole file, and use per-chain duration for bitrate calculation
- oggz-validate, oggzrip, oggzdump, oggzdiff already handle chained files ok
- oggz-scan handles chained files, but reports scene-change times
relative to chain start
- oggzmerge: it would be non-trivial to merge chained files unless
the chain durations matched.
More information about the theora-dev