View Full Version : Split .OGG file
Dark-Cracker
22nd March 2003, 02:50
Hi,
(for me a frame=a packet of data)
i want to make a little tool to get each size of the frame. for exemple i have a .ogg (10 Mb) i want to split it around (5Mb) i want to make a loop to find the frame where i want to cut , my loop will stop once i have the desired size to split and after i need to split the .ogg file at the calculated frame. does someone have an idear ? the structure on the .ogg format is down on the xiph.org siteweb.
thank u for ur help.
++
Suiryc
22nd March 2003, 16:25
Hi
you should try to have a look at vcut (part of vorbis-tools) that you can find on the XipH/Vorbis official site (http://www.vorbis.com/download_win.psp sources of vorbis-tools are at the bottom of the page). It's a tool to cut a Vorbis file IIRC.
This helped me with my tools.
Dark-Cracker
22nd March 2003, 17:48
thank u i will give it a shot :)
++
EDIT:
>vcut reads an Ogg Vorbis audio file and splits it at the given cutpoint, which is a sample number.
how can i calculate this sample number is there a structure defined for the .ogg file ? perhaps the posibility to obtain the first frame and the offset of the end of this file (and u will obtain the frame size) then jump to the second frame and do the same think, do u think is it possible and how ? is there a defined structure format for the .ogg ?
Bye.
Suiryc
22nd March 2003, 22:31
Well the library has the necessary functions to retrieve information from the Vorbis file (see the vorbis_synthesis_headerin function).
The first 3 Packets are headers. First one contains general information about the stream (samplerate, number of channels, etc) and will fill some part of a vorbis_info structure. Second one contains comments and will fill a vorbis_comment structure. Third one contains technical details on the stream (i.e. everything the library needs to know in order to properly decode the stream) and will fill some other parts of the vorbis_info structure.
vcut code show how to fill those structures and how to determine where you want to cut the file. If you want to cut according to a filesize you just need to keep a trace of how many bytes you read (either when reading from the file, or when processing Pages) and adapt vcut code accordingly.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.