Hello, I'm working on a game and I want to encode all the sound files that I have (probably over a 100) with Ogg Vorbis. Most of these sound files are really small, about 3 - 6kb each. Each sound file contains a word, i.e. "cat", "bat". When I encoded some of them I noticed that the ogg file is never smaller than 4kb, even if the original wav file was less than 4kb. I saw in the libogg documentation that an ogg page is typically 4kb. So I'm assuming that because of that, the smallest a file can ever be is always 4kb. Is there any overhead that can be removed during the encoding or is there a setting that could get the encoding to have a smaller page size, thereby generating a file less than 4kb? Thanks, Elliot <p><p><p>--- >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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
> Is there any overhead that can be removed during the encoding or is there a > setting that could get the encoding to have a smaller page size, thereby > generating a file less than 4kb?Probably the way to get around this is to concatenate all your WAVs into one long one with, say, half a second of silence between each sound bite. Then encode them into one ogg. Record the offsets into the ogg for each soundbite and make a big lookup table. When you want to play a certain sound, seek to the appropriate offset and decode it. Or maybe a few files with a dozen sound bites in each. Just a suggestion, though. I've not done any such thing myself, but I think some others on the list have done something similar. -- Graham Mitchell - computer science teacher, Leander High School "It is not possible to be 'incidentally a Christian'. The fact of Christianity must be overwhelmingly first or nothing. This suggests a reason for the dislike of Christians by nominal or non-Christians: their lives contain no overwhelming firsts but many balances." -- Sheldon Vanauken --- >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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
> So I'm > assuming that because of that, the smallest a file can ever be is always > 4kb.That's about right. Every time a vorbis file is encoded the necessary codebooks and info. for decoding the file are packed into the first few ogg pages. They usually run somewhere between 3-6k if I remember correctly. If you are encoding at the same quality setting for all the files, you only need to read the codebooks and settings once, I believe. So you could change the decoder to get the first few ogg pages from one file, and then once its primed just run the decode loop on the rest. You'd have to go in and take out the first few ogg pages of each of the encode files also. Requires a some work. Another option would be to encode them all as one file and then use offsets. Later, Alan <p>--- >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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
At 06:24 PM 3/12/02 -0500, you wrote:>Hello, > I'm working on a game and I want to encode all the sound files that I >have (probably over a 100) with Ogg Vorbis. Most of these sound files are >really small, about 3 - 6kb each. Each sound file contains a word, i.e. >"cat", "bat". When I encoded some of them I noticed that the ogg file is >never smaller than 4kb, even if the original wav file was less than 4kb. I >saw in the libogg documentation that an ogg page is typically 4kb. So I'm >assuming that because of that, the smallest a file can ever be is always >4kb. >Is there any overhead that can be removed during the encoding or is there a >setting that could get the encoding to have a smaller page size, thereby >generating a file less than 4kb?Other people have given some answers, but I'll go into a bit more detail here. The page size (as documented) is the typical size - but pages CAN be smaller - and they are, in cases like really short files. The main overhead here is the headers. There are three header packets: primary header (very small), codebook header (big. Usually near 4 kB), and the comment header (tiny if you don't add any comments. Obviously, it grows if you do). Whilst this overhead can't be removed, if you have a controlled environment (such as a game), it's very possible to work around this, with some minor tool modifications. First, I'll make the assumption that you use the same encode settings (and encoder version) for every ogg file - if that isn't true, this technique won't work. Encode a file as normal. Strip off the first 3 packets (the 3 headers), and store these seperately. Store the rest of the file as normal (but note that normal players won't be able to play these, as the headers are missing). Repeat (except now just discard the headers, as they'll be the same for the other files) for every other file. Now, you have the headers seperately, then lots of very small files containing only the vorbis audio packets. When decoding, submit the header packets directly to the decoder (you'll need to use libvorbis directly for this, rather than vorbisfile - but that's reasonably straightforward). THEN start sending the audio packets to the decoder as you normally would. Michael <p>--- >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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
On Tue, 12 Mar 2002 elliot_kwestel@nysunburst.com wrote:> Hello, > I'm working on a game and I want to encode all the sound files that I > have (probably over a 100) with Ogg Vorbis. Most of these sound files are > really small, about 3 - 6kb each. Each sound file contains a word, i.e. > "cat", "bat". When I encoded some of them I noticed that the ogg file is > never smaller than 4kb, even if the original wav file was less than 4kb. I > saw in the libogg documentation that an ogg page is typically 4kb. So I'm > assuming that because of that, the smallest a file can ever be is always > 4kb. > Is there any overhead that can be removed during the encoding or is there a > setting that could get the encoding to have a smaller page size, thereby > generating a file less than 4kb? > > Thanks, > ElliotI'm not sure what type of game you're making, but also consider that the costs of using ogg-compressed audio files may not be worth it for the small space savings you'd gain. 100 words * 6 KB/word still isn't much unless you're downloading it over a 9600 Kb/s modem. <p>--- >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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.