Brendan Bolles wrote:> DiscardPadding seems to assume that you might top off an opus > frame with empty samples when the frame would spill onto the next > matroska timestamp. So rather than have continuous opus that > could be decoded one after another, you'd have to jump over these > little gaps?The intent was not to allow gaps in the file like this (that would confuse the encoder, compress badly, and complicate decoders, plus be unrepresentable in Ogg). The intent was to allow trimming from the _last_ frame in a stream to allow sample-accurate total duration. If there's some way to say that it cannot be used anywhere else in the spec, we should do so.> The document says it would be useful for Vorbis too, but Vorbis > seems to just emit packets as it wants and you don't really have > any control over the boundaries. I assumed we would just do the > same with Opus, even it it can be controlled better.Like Opus, the idea was to use it in the last frame only, for sample accurate duration. Right now if you mux a Vorbis file into MKV and then back into Ogg, the duration changes.
On Jan 17, 2014, at 3:00 PM, Timothy B. Terriberry wrote:> The intent was not to allow gaps in the file like this (that would > confuse the encoder, compress badly, and complicate decoders, plus be > unrepresentable in Ogg). The intent was to allow trimming from the > _last_ frame in a stream to allow sample-accurate total duration.Ahhh, that makes sense. So you'd add some samples at the very end just to complete that last Opus frame?> > Like Opus, the idea was to use it in the last frame only, for sample > accurate duration. Right now if you mux a Vorbis file into MKV and then > back into Ogg, the duration changes.I guess you mean if you put Vorbis into a Matroska without video? With video I'd think you'd want the Vorbis audio duration to always match the video. I don't think Vorbis has the fixed-frame issue of Opus where audio frames might not align with Matroska timestamps. Because you can't really control how many samples libvorbis emits at a time, I've just assumed vorbis packets don't necessarily align with timestamps in Matroska. You can't calculate the precise granulepos for a Vorbis packet unless you march through the entire stream from the beginning and there can't be any sample-accurate audio seeking in Matroska the way you can in Ogg. Am I right about that? Brendan
On Jan 17, 2014, at 3:19 PM, Brendan Bolles wrote:> I don't think Vorbis has the fixed-frame issue of Opus where audio frames might not align with Matroska timestamps.Whoops, I meant for the total duration of the file you should be able to have your vorbis length match the file duration length exactly. As my next paragraph said, in general I think the Vorbis packets will never align with the Matroska timestamps, and I don't *think* there's anything that can be done about it. Ditto for opus frames not aligning with Matroska timestamps. Brendan
Brendan Bolles wrote:> Ahhh, that makes sense. So you'd add some samples at the very end just to complete that last Opus frame?Correct.> I guess you mean if you put Vorbis into a Matroska without video?Right.> with timestamps in Matroska. You can't calculate the precise > granulepos for a Vorbis packet unless you march through the entire > stream from the beginning and there can't be any sample-accurate > audio seeking in Matroska the way you can in Ogg. Am I right about > that?I don't know enough about Matroska to be able to answer that question with any authority. I would be sad if that were true, though.