<br><blockquote type="cite"><div class="plaintext" style="white-space: pre-wrap;">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.</div></blockquote>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 - <div>so all you can do is</div><div> 1.) to make sure that the differences won't add up to more an audio packet's size on subsequent cuts and</div><div> 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.<br><blockquote type="cite"><div class="plaintext" style="white-space: pre-wrap;">
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.</div></blockquote>I think this concept was not included in ogg on purpose:</div><div> - The minimum audio frequency a single frame can hold is defined by its length</div><div> - the same holds true for the minimum difference between audio frequencies</div><div>This 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)</div><div> - 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. <br><blockquote type="cite"><div class="plaintext" style="white-space: pre-wrap;">
Any advice is greatly appreciated. As are any references for me to learn more about this stuff.</div></blockquote>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.</div><div><br></div><div>Wish you good luck,</div><div><br></div><div> Gunter.</div>