forum

How to make your map fit the size limitations: Compression

posted
Total Posts
9
Topic Starter
ziin
Osu! maps, according to the current ranking guidelines, must be under 10 MB, or 20 MB if the song has a video. In this tutorial I will tell you smart ways to get your map under that limit.

There are 2 types of compression. Lossy and Lossless compression. Lossless implies that the quality never degrades and can be repeatedly compressed or decompressed. Lossy is a much more powerful form of compression which sacrifices quality for space/processor demand.

[Zip]
  • The osz package is actually a zip file, and will compress your beatmap, although not very much, since audio, video, and images are usually compressed very well. Zip and other archives are all lossless compression, otherwise you wouldn't be able to get your data back.
[Video]
  • Videos are usually where people go wrong. There are thousands of video codecs out there, and believe it or not, youtube is usually a terrible place to get videos. For the best quality, you should always downsize from a high resolution source (720p youtube is fine for this).

    h.264 and XviD are very good codecs to use, but like most video codecs, they are lossy, so do not re-encode multiple times, but encode from the high resolution source.

    Recommended reading: How to edit/re-encode video
[Audio]
  • Now that there is a limit on audio bitrate, it's not as much of a problem anymore. However long songs at 192 kbps will undoubtedly take up most of your space. I recommend using a variable bitrate between rate factor 2 and 5 (I try to stick around 4). With a variable bitrate, you get more compression in low activity areas, and more quality in higher areas.



    Programs such as Audacity 1.3.13 do an excellent job of saving variable bitrate audio with the correct plugins.

    Osu accepts 2 major file formats: mp3 and ogg vorbis. Vorbis has a clear advantage over mp3 at low bitrates (under 128 kbps), but suffers from lack of support by proprietary software like apple, since mp3 is the standard for audio. However, there are severely limiting returns on using anything higher than 128 kbps. For osu! it doesn't really matter which one you use.
[Images]

  • There are 2 major image formats which make up most of the images you find online: jpg and png. Png uses lossless compression which makes it ideal for small and or simple images. Complex images are better suited for jpg. The majority of image editing programs however do not naturally use png and jpg compression to the most of their ability however, leaving you with 4 kb pngs of 1 color, which could be compressed up to 400 times smaller.

    Gimp actually does a good job with jpgs.



    There are four important things to check: Optimize, Progressive, subsampling, and quality.
    Optimize is just a way to compress the jpg without losing quality and should always be checked.
    Progressive is a method to make jpgs "fade in" when downloaded from the internet. It has a side effect of making the image smaller so long as the image is over 20 kB.
    Subsampling is a way to improve quality or compression. No subsampling (1x1) will make text and lines much clearer at the cost of space. 2x2 subsampling does very well for photographs which do not have distinct lines (like text).
    Quality is the easiest way to keep the image looking good. I use 95, since the gains after 95 aren't really worthwhile.

    Pngs are actually much simpler to compress, but GIMP does not do it very well. Optipng and Pngout are two of the best tools to compress pngs. Optipng can find the optimum settings for the png, and pngout re-compresses the image using kzip. Often times just using pngout will reduce the image size by 20%.


    For even better compression, you can use a script which combines multiple compressors and brute forces close to the smallest file possible. The script's name is pngslim.
So there you have it.
Derekku
After a discussion with peppy, we suggest that VBR should be avoided if possible. However, a lower quality around 140-160 kbps VBR (like you mentioned) should be fine.

Nice tutorial, by the way.
OzzyOzrock
I'll take the time to make sense of all this when I need it.
Topic Starter
ziin

Derekku wrote:

After a discussion with peppy, we suggest that VBR should be avoided if possible. However, a lower quality around 140-160 kbps VBR (like you mentioned) should be fine.
I can only see 2 reasons to avoid VBR:
offset might change on different computers easier
it takes more processing power.

Am I right? I've got a pretty fast computer, so I don't really care that much about processing power, but I know that saving 5 MB on a map reduces operating costs of the site, as well as makes the downloads go faster for those with slow internet (I used to be in that group too).
Equivalent_old
I think it not the offset, but like V2 VBR sometime the mp3 will go beyond he limit of kbps rules which like it goes 198kbps to 200kbps in certain part. Mostly the issue here I think is V2 VBR. Where the bitrate is like doubtful to be unrankable or rankable within the requirement range.

Offset in VBR maybe another issues as I experienced someone saying my map is having late offset while at my side it perfectly good.
Topic Starter
ziin

Equivalent wrote:

I think it not the offset, but like V2 VBR sometime the mp3 will go beyond he limit of kbps rules which like it goes 198kbps to 200kbps in certain part. Mostly the issue here I think is V2 VBR. Where the bitrate is like doubtful to be unrankable or rankable within the requirement range.

Offset in VBR maybe another issues as I experienced someone saying my map is having late offset while at my side it perfectly good.
Bitrate limitations were put into effect because of filesize I think. Anything over 128 kbps is lost on my ears anyway.
Equivalent_old
Another reason why bitrate is limited is morality issues, as a respect to the artist/singer w/ever for their respective work. Osu! is not intended to distribute 320kbps high quality audio for free. If you want some 320kbps audio, go buy it at store nearby, lol
HakuNoKaemi
actually it is a way to respect copyrights things a bit more and to say "buy for better quality"... however 196 Kbps is just really good for mosts audio file ( you start losing quality from like 128-96 and below ).

Ah, actually ScriptPNG offer a bit less compression for pngs in exchange for an higher speed
Topic Starter
ziin
There are those who can hear the difference between high bitrates, but I can't tell even with high quality sound equipment.

After all, the only way to tell the difference is to listen to 2 different bitrates. If you load up a 128 kbps file, I doubt anyone could tell that it's 128 without comparing, and even then the difference is miniscule.

I've tried to use scriptpng but I never got it to work correctly. Instead if I want speed compression, I wrote a short script which runs the image through pngoptimizer, optipng, advdef, pngout, and deflopt. Most of the compression is in the filter type and compression value anyway.
Please sign in to reply.

New reply