[vorbis] how to calculate frame # for vcut?

Michael Smith msmith at labyrinth.net.au
Sat Aug 10 01:15:24 PDT 2002



At 08:49 AM 8/10/02 +0200, you wrote:
>Hi,
>
>I have a question regarding vcut. In the man page, it says:
>
>DESCRIPTION
>        vcut  reads  an Ogg Vorbis audio file and splits it at the
>        given cutpoint, which is a sample number.
>
>
>What I want to do, is to cut an Ogg Vorbis file at a given time. Say, I 
>have an Ogg Vorbis file, which is 1 hour long, and I want to cut it into 
>two half hour parts.
>
>With a fixed bitrate format, the frame number to cut by can be easily 
>calculated, but how do I such here?

You use the granulepos given on each page. If you want to be more
exact, you can calculate an exact per-packet offset using the granulepos
and then using vorbis_packet_blocksize() as vcut does. 

Err... or maybe I misread your question. If you want to _use_ vcut,
the offset given to it is in samples - so if you want to cut at half
an hour, and your file is at 44100 Hz, use 44100*60*30 (whatever that is).

Mike

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis mailing list