Arucarn
Posts: 6
Joined: Sat Apr 06, 2013 7:54 pm

Video Compression using ZIP etc

Sat Apr 06, 2013 8:02 pm

I have raspbmc loaded on my Raspberry Pi Model B, with a 16GB flash drive. I don't have the options to use cloud storage, a media server or external hard drive. I only have the memory on my SD card. I want to put my movies on it but I'm a little stretched for space. Then I thought: Would it be possible to have the movies compressed in a ZIP archive or RAR archive, etc. And you can play that archive in a media player. Like it decompresses the movie or something so you can watch it but still have lots of movies on your Pi. I'm wondering what do you guys think?

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Video Compression using ZIP etc

Sat Apr 06, 2013 8:47 pm

2 problems, any video codec worth anything at all is already compressed up to the hilt and zipping it is likely to increase its size, not decrease it. No 2, pulling things out of a zip archive in real time takes a lot of CPU horsepower the Pi doesn't have.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

Arucarn
Posts: 6
Joined: Sat Apr 06, 2013 7:54 pm

Re: Video Compression using ZIP etc

Sat Apr 06, 2013 8:50 pm

pluggy wrote:2 problems, any video codec worth anything at all is already compressed up to the hilt and zipping it is likely to increase its size, not decrease it. No 2, pulling things out of a zip archive in real time takes a lot of CPU horsepower the Pi doesn't have.
Why would it increase file size?

forumisto
Posts: 387
Joined: Fri Mar 16, 2012 8:41 am

Re: Video Compression using ZIP etc

Sat Apr 06, 2013 8:53 pm

Because the video and audio are compressed. Then a new compression uses the original file and information for the new file, and the final size is greater than the original size.

User avatar
liz
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 5212
Joined: Thu Jul 28, 2011 7:22 pm
Contact: Website

Re: Video Compression using ZIP etc

Sat Apr 06, 2013 8:54 pm

It's an information theoretic thing. You can demonstrate mathematically that it's impossible to come up with a compression scheme that makes *everything* smaller or equal-sized; some things get smaller, some get bigger. The trick is to make sure that the algorithm you use means that the things that get bigger only get a bit bigger, and that things that get smaller get much smaller.

Things that are already compressed look like random data; effectively, they have no patterns for a compression algorithm to exploit. So they're in the class of things that get bigger. What you're trying to compress is, sadly, in this class.
Director of Communications, Raspberry Pi

User avatar
Gert van Loo
Posts: 2487
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: Video Compression using ZIP etc

Sat Apr 06, 2013 9:04 pm

Just think of how much you can compress a .zip file. Not possible!
(If that would be possible you could zip up a .zip file, zip that up again etc. until at the end you have only one byte left.)

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Video Compression using ZIP etc

Sat Apr 06, 2013 9:14 pm

Suck it and see, is the easy answer.

Heres one I did :

fred.avi is a video taken out of my 6 year old Canon camera. The camera manages to compress and store it in real time, so it isn't going to be anything special on the compression front.
movie.zip is the same file in a zip archive :

sv@sv-desktop:~/Videos$ ls -lt
total 163048
-rw-rw-r-- 1 sv sv 83280989 Apr 6 21:49 movie.zip
-rw-rw-r-- 1 sv sv 83672126 Apr 6 11:28 fred.avi
sv@sv-desktop:~/Videos$

In this case it did compress slightly (392kB in an 83MB file), not really worth the effort at less than 0.5%.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

User avatar
Jessie
Posts: 1754
Joined: Fri Nov 04, 2011 7:40 pm
Location: C/S CO USA

Re: Video Compression using ZIP etc

Sun Apr 07, 2013 3:10 am

H.264 is as good as you will get with the pi, it's pretty good compression anyway. The only thing better is HEVC and there isn't enough grunt to decode that. You are just going to have get a 32 Gb sd and a 32, 64, or 128 Gb USB stick. Video encoded with H.264 is just efficient, you can take an 8Gb DVD and encode it with high quality settings and make it a mere 700 to 800 Mb and way less if you are willing to sacrifice quality.

Return to “General discussion”