Author Topic: Ogg Suggestion  (Read 5702 times)

Tununias

  • Guest
Ogg Suggestion
« on: 20 March 2011, 07:59:21 »
As the title says, I suggest that the mods use .ogg instead of .wav to save space. I did a test with the Tech faction and this is what I got:
The bitrate I used was 58 kbps and I didn't notice the quality loss.

Name              Size   Percent          
==============================================
total:        39.2MB   100%            compressed = 20.2MB   51.53%
==============================================
sound:     16.1MB    41.07%    compressed = 12.1MB   75.16%
==============================================
models:     16MB    40.82%    compressed = 4.9MB   30.63%
==============================================
textures:     5.5MB    14.03%    compressed = 2.5MB   45.45%
==============================================
images:     1.1MB    2.81%    compressed = 703.3KB   62.44%
==============================================
folders:     404KB    1.01%    compressed = 1.1KB   0.27%
==============================================
xmls:        142.6KB    0.35%    compressed = 9.9KB   6.94%
==============================================
db(Thumb):     18KB    0.04%    compressed = 9.9KB   55%
==============================================
with ogg:     30.5MB    77.8%    compressed = 14.3MB   46.89%
==============================================
sound(ogg):  7.4MB    24.26%    compressed = 6.3MB   85.14%
==============================================
with flac:     33.7MB      85.97%     compressed = 18.7 MB 55.49%
==============================================
sound(flac):  10.6MB     63.47%      compressed = 10.6MB 100%
* Just added

This also shows the percentage of each type of file and also how well they compress with 7-zip.(you probably already noticed)

I'm not sure how important this suggestion is or if it this has already been discussed before, but I believe it would help a lot especially with larger mods.
« Last Edit: 20 March 2011, 17:24:28 by Tununias »

John.d.h

  • Moderator
  • Airship
  • ********
  • Posts: 3,757
  • I have to go now. My planet needs me.
    • View Profile
Re: Ogg Suggestion
« Reply #1 on: 20 March 2011, 08:11:27 »
You can use ogg vorbis already.  It's just a matter of somebody converting the files and replacing the references in the xml files.  My only objection (and it's a minor one) is that ogg is lossy.  FLAC would be nice if we have any expectation of people editing the files and using them in other projects.

Mr War

  • Guest
Re: Ogg Suggestion
« Reply #2 on: 20 March 2011, 13:00:39 »
This is really helpful, thanks

Tununias

  • Guest
Re: Ogg Suggestion
« Reply #3 on: 20 March 2011, 18:04:04 »
You can use ogg vorbis already.  It's just a matter of somebody converting the files and replacing the references in the xml files.  My only objection (and it's a minor one) is that ogg is lossy.  FLAC would be nice if we have any expectation of people editing the files and using them in other projects.
If I were to convert some of the techs and upload them, would I need to get permission first, or would a disclaimer and a link to the mod's faction discussion be sufficient? Or should I not bother with it? It doesn't take very long for me to do.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Ogg Suggestion
« Reply #4 on: 20 March 2011, 18:33:50 »
You can use ogg vorbis already.  It's just a matter of somebody converting the files and replacing the references in the xml files.  My only objection (and it's a minor one) is that ogg is lossy.  FLAC would be nice if we have any expectation of people editing the files and using them in other projects.
If I were to convert some of the techs and upload them, would I need to get permission first, or would a disclaimer and a link to the mod's faction discussion be sufficient? Or should I not bother with it? It doesn't take very long for me to do.
I don't think such a change is worth it. No sense taking the time for just a tiny filesize change.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

Gabbe

  • Guest
Re: Ogg Suggestion
« Reply #5 on: 20 March 2011, 18:34:43 »
But if you have the time go ahead?

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Ogg Suggestion
« Reply #6 on: 21 March 2011, 02:30:54 »
But if you have the time go ahead?
I suppose. What I would recommend is that all modders use OGG for sounds, but don't bother converting existing sounds. It's not really much of a difference...
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

Tununias

  • Guest
Re: Ogg Suggestion
« Reply #7 on: 21 March 2011, 05:10:40 »
But if you have the time go ahead?
I suppose. What I would recommend is that all modders use OGG for sounds, but don't bother converting existing sounds. It's not really much of a difference...
OK.

Tununias

  • Guest
Re: Ogg Suggestion
« Reply #8 on: 23 March 2011, 05:29:54 »
But if you have the time go ahead?
I suppose. What I would recommend is that all modders use OGG for sounds, but don't bother converting existing sounds. It's not really much of a difference...
The vbros packs are 403.2 MB but converted they are 303.5MB.
If you ever change your mind, I'm able to convert them in less than 3 minutes per faction. (I wrote a script that replaces the wav references to ogg references, and I'm able to convert audio files by folders). :P :P :P :P :P :P :P :P :P :P :P :P :P :P :P :P :P :P :P :P :P :P :P :P :P
« Last Edit: 23 March 2011, 05:43:47 by Tununias »

will

  • Golem
  • ******
  • Posts: 783
    • View Profile
Re: Ogg Suggestion
« Reply #9 on: 23 March 2011, 07:42:01 »
If you ever change your mind, I'm able to convert them in less than 3 minutes per faction. (I wrote a script that replaces the wav references to ogg references, and I'm able to convert audio files by folders).

Neato!

Have you seen http://github.com/williame/GlestTools/blob/master/glest_mod_pack.py ? If you want to add ogg conversion to that, it would be a great way to really trim down mod download sizes!

John.d.h

  • Moderator
  • Airship
  • ********
  • Posts: 3,757
  • I have to go now. My planet needs me.
    • View Profile
Re: Ogg Suggestion
« Reply #10 on: 23 March 2011, 08:54:27 »
Have you seen http://github.com/williame/GlestTools/blob/master/glest_mod_pack.py ? If you want to add ogg conversion to that, it would be a great way to really trim down mod download sizes!
Maybe if the modder provides a wav, the script could put an ogg in the addon and a flac in the extras/resources file?  Then everybody's happy. :)

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Ogg Suggestion
« Reply #11 on: 23 March 2011, 10:33:59 »
Are you shure ogg gives so much benefit compared to wav for the small unit sounds?
Of course if things get bigger it's a very big difference, but keep in mind its lossy and its not such a big difference ( in my opinion )
What we learned for example too is that small tgas are sometimes bigger if saved as png and more important, if you use png 7zip compresses not as good as if you would use tga .....( same thing here, its only like this for SMALL textures ).

All I wanted to say is that a conversion tool is maybe not a really good idea. The modder has to decide whats to do and no automated script should be used for this.
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

will

  • Golem
  • ******
  • Posts: 783
    • View Profile
Re: Ogg Suggestion
« Reply #12 on: 23 March 2011, 12:38:40 »
Are you shure ogg gives so much benefit compared to wav for the small unit sounds?

I think the numbers given at the beginning of the post prove it?

Quote
All I wanted to say is that a conversion tool is maybe not a really good idea. The modder has to decide whats to do and no automated script should be used for this.

You are an optimist.  Modders spend hundreds of hours tweaking models but then package them badly.  Even megapack has missing files.  The number of mods that have broken capitalisation in filenames, missing files, textures that aren't powers of 2, gazillions of debris and .thumbs and such etc is staggering.  Point to a mod that doesn't have some small such bug?

Its true that a power-modder will perhaps want to exercise total control over all aspects of packing their mod.  They can of course zip it up raw.

But I favour the adoption of a mod packing script that does all this for mainstream modders who focus on modding not packing, so sensible "optimise this for download please and tell me what is missing/broken" can benefit normal players.

Unfortunately my mod packing script has not been used in anger yet.  But it's there for anyone to use.

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Ogg Suggestion
« Reply #13 on: 23 March 2011, 12:45:28 »
The numbers on top are based on ogg with 56 kps which is out of any discussion, becasue its muchh too bad. Maybe you don't hear it, but I hear it , its just telephone quality. And beside of this I don't understand the numbers you showed there. Why should textures be smaller when using ogg? Thats complete nonsens in my opinion, so I think I don't understand your numbers.

or what does this mean:
sound(ogg):  7.4MB    24.26%    compressed = 6.3MB   85.14%

Does it mean you saved 24,6%? If its like this, it's eexactly like I said. Given the fact that you typically should use 128 kbit for ogg compression I bet it's bigger with ogg than without.

( but in general its important that people understand how much disk space can be saved using ogg ( for every sound that is a bit longer than 1 or 2 seconds)! )
« Last Edit: 23 March 2011, 13:01:53 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

will

  • Golem
  • ******
  • Posts: 783
    • View Profile
Re: Ogg Suggestion
« Reply #14 on: 23 March 2011, 13:02:20 »
total:        39.2MB   100%            compressed = 20.2MB   51.53%

so the mod was 39.2MB total?

Quote
sound:     16.1MB    41.07%    compressed = 12.1MB   75.16%

of which 16.1MB - that is to say 41% of the uncompressed mod - was audio?  Ok.

I see you said that 16.1MB of audio - WAV presumably, or various bitrates of other formats - compressed down to 12.1MB.  Ok.  That means it compresses not as well as the rest of the mod.

Quote
with ogg:     30.5MB    77.8%    compressed = 14.3MB   46.89%
So you mean when you converted all the sound to ogg @ 58Kbps (its VBR in there though) it took 30.5MB on disk and compressed to 14.3MB - waha, that would save over 5MB on the download and 10MB on disk!

Quote
sound(ogg):  7.4MB    24.26%    compressed = 6.3MB   85.14%
So that was the component of that 'with ogg' mod that was sound?  from 16.1MB down to 7.4MB on disk, and from 12.1MB down to 6.3MB in the download?  Neat.

I see you also gave numbers for using flac instead of ogg, and the numbers were 18.7MB on the download instead of 20.2MB.  Still worth doing in my opinion.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Ogg Suggestion
« Reply #15 on: 23 March 2011, 18:39:45 »
Yes, OGG is losely, but I don't think that's an issue. I've never seen anyone editing sound files, and its far better to remake something from scratch then. For most sound effects, such as explosions, strange beeps and whistles of spells, and voices are perfectly fine at 56kbps, though music should be 96 or 128 kbps.

Might I ask how you converted (what program) for the mass conversions? Did you also change the XMLs to link to OGG instead of WAV files?
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

Tununias

  • Guest
Re: Ogg Suggestion
« Reply #16 on: 23 March 2011, 20:29:49 »
Yes, OGG is losely, but I don't think that's an issue. I've never seen anyone editing sound files, and its far better to remake something from scratch then. For most sound effects, such as explosions, strange beeps and whistles of spells, and voices are perfectly fine at 56kbps, though music should be 96 or 128 kbps.

Might I ask how you converted (what program) for the mass conversions? Did you also change the XMLs to link to OGG instead of WAV files?
I use the program Sound Converter on Linux. (it's from the getdeb repositories for Ubuntu, I don't know if it's available for Windows).
With that I can convert them by selecting each sounds folder of each unit and convert them instead of each individual wav file. The program will also try to convert the g3d files too so I can't just select the entire mod. :(
I wrote a bash script that will replace the the xmls. I left the music file alone sense they're already ogg.

sound(ogg):  7.4MB    24.26%    compressed = 6.3MB   85.14%
This means that the ogg files only take up 7.4 MB and 24.26 percent of the total mod(not the original) instead of 41 percent.
« Last Edit: 23 March 2011, 21:10:37 by Tununias »

Tununias

  • Guest
Re: Ogg Suggestion
« Reply #17 on: 23 March 2011, 20:53:31 »
Here are my scripts:
start_script.sh
       "#! /bin/bash
        kgb script.sh.kgb
        chmod +x script.sh
        ./script.sh"

script.sh
       "!/bin/bash
        startdirectory="."
        searchterm=".wav"
        replaceterm=".ogg"
        for file in $(grep -l -R $searchterm $startdirectory)
        do
        sed -e "s/$searchterm/$replaceterm/ig" $file > /tmp/tempfile.tmp
        mv /tmp/tempfile.tmp $file
        echo "Modified: " $file
        done
        rm script.sh"


The first will extract the kgb file, make it executable, and run it.
The second will replace the ".wav" to ".ogg" in all the xmls in the folder and all the subfolders the script is in, and then delete itself.
The reason I have two scripts and one is compressed in kgb(it can be changed to 7zip or something else) is because the script will also replace the the .wav reference in the sciript.(I marked it as yellow)

And here is the link to the scripts and another script to get kgb. ;) http://www.mediafire.com/?n76aj6nffur87fc
« Last Edit: 23 March 2011, 21:18:37 by Tununias »

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Ogg Suggestion
« Reply #18 on: 24 March 2011, 19:36:01 »
Why'd you bother compressing a script? ::)
Egypt Remastered!

Proof: Owner of glest@mail.com

Tununias

  • Guest
Re: Ogg Suggestion
« Reply #19 on: 24 March 2011, 20:21:35 »
Why'd you bother compressing a script? ::)
It put the two files into one.
« Last Edit: 25 March 2011, 05:33:06 by Tununias »

Tununias

  • Guest
Re: Ogg Suggestion
« Reply #20 on: 26 March 2011, 03:17:24 »
I don't know. For a few factions, I sometimes get a sharp staticy(like having a tv with black and white dots on very loudly, but for less than a second) sound at different times. I've looked at sound files and they seem fine. I'll see if reconverting them fixes it or not.

Tununias

  • Guest
Re: Ogg Suggestion
« Reply #21 on: 26 March 2011, 03:44:24 »
I don't know. For a few factions, I sometimes get a sharp staticy(like having a tv with black and white dots on very loudly, but for less than a second) sound at different times. I've looked at sound files and they seem fine. I'll see if reconverting them fixes it or not.
It didn't work, and also some of the units' sounds cut off and don't play the whole thing, it's exactly the same as before. I have no idea what it could be though.  :'(  I'm going to go watch a romance anime now.

John.d.h

  • Moderator
  • Airship
  • ********
  • Posts: 3,757
  • I have to go now. My planet needs me.
    • View Profile
Re: Ogg Suggestion
« Reply #22 on: 26 March 2011, 05:03:09 »
I don't know. For a few factions, I sometimes get a sharp staticy(like having a tv with black and white dots on very loudly, but for less than a second) sound at different times. I've looked at sound files and they seem fine. I'll see if reconverting them fixes it or not.
The same thing happened to me when I tried to do it a long time ago (with the same converter, I think).  The game has no problem handling ogg sounds, and the ones I recorded from scratch in Audacity were fine, but the ones I converted from wav were staticky and would cut off.  I think it's really picky about the encoding -- maybe a specific bitrate or number of channels?  Sorry, I don't know much about sounds.