Anil Philip
2009-May-24 14:13 UTC
[Speex-dev] newbie qs. how to seek to a point in the Speex file?
Thanks for your reply. I am using JSpeex so it is not possible to use the libs you mention. I looked a little at the source in http://jspeex.sourceforge.net but cant see where the length can be stored. Unfortunately, that project does not seem to be maintained - no replies to queries posted on the forums. Does anyone know how to store the length of a JSpeex clip in the header? thanks, Anil --- On Wed, 4/22/09, Conrad Parker <conrad at metadecks.org> wrote:> From: Conrad Parker <conrad at metadecks.org> > Subject: Re: [Speex-dev] newbie qs. how to seek to a point in the Speex file? > To: goodnewsforyou at yahoo.com > Cc: "speex dev" <speex-dev at xiph.org> > Date: Wednesday, April 22, 2009, 6:29 AM > 2009/4/22? <goodnewsforyou at yahoo.com>: > > Although this actually pertains to JSpeex, I am asking > these questions here > > because they are general questions and also the JSpeex > project does not seem > > to be supported any more. > > 1) Can the duration of the clip be stored in it? Page > 24 here > > http://www.speex.org/docs/manual/speex-manual.pdf > describes the format, but > > I could not see where the duration of the clip is > stored. > > 2) Since the Speex compression is not linear, is it > still possible (say) for > > a 60 second clip which is 60Kb, to seek accurately to > 10 seconds on the > > time-line by discarding the first 10Kb of data? If > there is any example of > > how to do an approximate seek, it would be > appreciated. > > Hi, > > If you're talking about Speex data in an Ogg container > (which is the > format produced by speexenc) then: > > 1) no the duration is not explicitly stored in the Ogg > Speex file. You > need to read the granulepos (timestamp, in units of audio > samples) of > the last Ogg page in the stream. > > 2) to seek you need to seek for the Ogg page containing the > data. > > I suggest you use liboggz to handle the Ogg reading and > seeking: > http://www.xiph.org/oggz/. Info about the seek api is > in > http://www.xiph.org/oggz/doc/group__seek__api.html > > cheers, > > Conrad. >