[Vorbis-dev] Seeking in WebM
Gunter Königsmann
gunter at peterpall.de
Sun Sep 15 23:10:04 PDT 2013
> First of all, I wonder if it's possible to seek to an exact audio
> sample in WebM. Whereas an Ogg page provides you with the granule
> position, Matroska provides a much less precise timecode, measured in
> milliseconds. So the second frame at time 41.6666ms gets rounded to
> 42ms in Matroska. If I seek using the Matroska timecode use it to
> calculate the granule position, I am off by a little. It's probably
> fine for playback, but Premiere asks me for audio at random times and
> they really should line up exactly.
I know this problem from cutting avi films with MP3 audio into
chapters: The audio packets will most probably never end exactly at the
beginning of a frame - so all you can do is 1.) to make sure that the
differences won't add up to more an audio packet's size on subsequent
cuts and 2.) to specify an audio-to-video delay in the stream's header
that tells the playback application how much to shift the audio to keep
the video synchronous to the audio.
>
>
>
> Secondly, it appears to me that I don't have any control during the
> encoding phase over how many samples are included in an Ogg packet,
> is that correct? I just feed libvorbis audio samples and watch as it
> produces packets, which I save in the Matroska file. But since I
> need to fit audio into these Matroska frames of a specific duration,
> I think I need to have a way to cut it off at a certain time but
> still connect seamlessly to the packet(s) at the next frame.
I think this concept was not included in ogg on purpose: - The minimum
audio frequency a single frame can hold is defined by its length - the
same holds true for the minimum difference between audio
frequenciesThis would make audio quality depend on the duration of the
packets (and might result in audible artefacts if the packet size
varies in variable-framerate-video) - and making constant-length audio
packets would somehow work like encoding video with a fixed interval
between intra-frames: In this case the character of the audio can
change greatly in the middle of a packet (making the packet's content
complicated and long) and if nothing happens at all this still will
generate new packets with complete descriptions of the sound every few
video frames.
>
> Any advice is greatly appreciated. As are any references for me to
> learn more about this stuff.
I don't know much about matroska but if it is as good as I assume and
the documentation half-ways matches it's quality there is a chance that
it will expand to the sync mechanisms that keep audio and video in sync
even if the video framerate and the runtime of the audio packets are
allowed to vary.
Wish you good luck,
Gunter.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/vorbis-dev/attachments/20130916/2a724644/attachment.htm
More information about the Vorbis-dev
mailing list