How to compress movies filmed with my digital camera
I have a Canon A550, and I'm used to carrying it with myself all the time, especially when I am traveling. I take a lot of photographs, but I avoid making short movie clips. The problem is that they are uncompressed, so a short film will take a lot of space on my flash memory card; the same happens when I transfer the files to the hard disk. It breaks my heart to see how storage space is flushed down the toilet just like that.
My first computer (a 80286) had a 42 MB hard drive, so I still have a psychological trauma from those times :-)
To solve the problem, I wrote a simple Python program that will search a directory and its subdirectories for .AVI files, then convert them to Theora. Optionally, it will delete the original files and then tell you how much space was saved due to the use of video compression.
How it works:
- Download ffmpeg2theora
- Store it to a directory of your choice
- pathToConvertor is set to the full path to ffmpeg2theora
- Call the function traverse, supplying the path to your photo/movie directory as a string argument
ex: savedSpace, convertedFiles=traverse("D:\\Stuff\\Photos\\")
Once the script is done, you'll have a bunch of .ogg files sitting next to their original .avi sources. Naturally, you should delete the originals, to save the space.
You'll see that the code was designed to do that for you, but you'll have to change the function calls to enable this feature. If you study the code, you'll also notice that you can supply custom arguments to the video convertor, if you want better compression, or higher quality.
Note: this is a simple program, an exercise in recursively traversing directories the pythonic way; it's not meant to be the ultimate video conversion tool :-)