1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Why does compressing sometimes not work?

Discussion in 'Windows & Other Software' started by Craig321, 26 Jul 2006.

  1. Craig321

    Capodecina

    Joined: 2 May 2004

    Posts: 19,974

    Hi,

    Just a quick question:

    How come sometimes I can compress a file and loose 100mb++ off it, but then other times I compress a file and loose a few KB off it.

    I always do it the same way and use the same compression program but just don't get why it does that?

    Thanks,
    Craig.
     
  2. bledd

    Don

    Joined: 21 Oct 2002

    Posts: 46,787

    Location: Parts Unknown

    it always depends on how the file has been made, and how compressed it already is

    great example is a divx video or an mp3 audio file, if you compress them with XP's "compress" tool (not the zip function) or 7zip, you'll still get pretty insignificant reductions, but if you were to compress a RAW avi file, you'd get awesome compression on it, the codecs used in these files (mp3 + divx) are all aimed at lower filesizes, so are optimized to be smaller

    the same goes with pictures, if you compress a bmp file, you'll get awesome results, and with a jpg or png file you'll get very little compression (as they are already compressed)

    also, with an empty word document, its usually around 25-30kb yes? (i don't use office at all), but if you compress it, its probably around 10-12kb (ms want files that don't lag when you open them, so i guess they use little optimization) -maybe its just bad programming in this case!



    to test it for yourself, open notepad, and type..

    test test test test test

    (over and over for ages) then save it, it'll be 1byte large for each character, so my passage of tests above would be 24bytes if i saved it, and its easy to compress because its repetative!, your average compression tool will see that and 'think' "ok, i'll put a key in that says, test=1(space), and will replace your text with 11111. (for example)

    an mp3 will have very little duplicate information in its file, wheras a wav file, will store a lot of information that is made obsolete to us
     
  3. Energize

    Caporegime

    Joined: 12 Mar 2004

    Posts: 28,971

    Location: England

    Yeah pictures videos and music are already compressed, if you want to compress them more youll have to use a special program designed to do it because winrar 7zip etc only use lossless compression.
     
  4. therealnerd2

    Mobster

    Joined: 25 Oct 2002

    Posts: 2,569

    Location: Cambridge,York,Bristol

    Good answer this. Another point about normal text files is that the alphanumeric keyboard uses say around 65 possible different characters (lowercase,uppercase,numbers and some symbols). But each byte (character) in a text file can be one of 256 possible things - so you can chuck four text characters into one, and there you have 75% compression already!

    NOTE: all above is rough examples, not exactly accurate :p
     
  5. Craig321

    Capodecina

    Joined: 2 May 2004

    Posts: 19,974

    So basically it'll suck at compressing already compressed files (as said above, mp3, compressed videos etc.)?

    Thanks for clearing it up for me :)

    Craig.
     
  6. Energize

    Caporegime

    Joined: 12 Mar 2004

    Posts: 28,971

    Location: England

    If you really needed to, you can use another codec to compress it. Ogg is much better than mp3/wma/aac for example and x.264 is better than xvid/divx/wmv/mpeg1&2
     
  7. Fillado

    Wise Guy

    Joined: 19 Jul 2004

    Posts: 2,039

    Location: West Yorkshire

    Try creating a massive text file full of just 1's so it's a couple of MBs big, then zip it up and it'll go down to practically nothing (as per one of the above explanations) :D
     
  8. Craig321

    Capodecina

    Joined: 2 May 2004

    Posts: 19,974

    Hehe nice, just compressed 1mb of ones to 192bytes :D

    Craig.