An experimental video encoder. Written in an independent study course during High School.
This project features a video encoder. It takes data from your video stream and makes it smaller. The video was designed for academic purposes rather than industry purposes. H.264 and Google's recent VP9 projects achieve superior compression ratios. The current implementation features the Fourier Transform, which is a function used to analyze frequencies, to compress your data. The Fourier Transform, compared to the standard Discrete Cosine Transform has the unique property of being able to ridiculously scale quality down and still achieve recognizable images.
In the image you see below you can see that the quality scaled by an enormous factor. Showing a compressed image frame using normal settings would be a little redundant as there is no visible difference to the real image.
Intentional Crazy Quality Scale Down =>
On normal settings, the algorithm achieves ratios comparable to older versions of MPEG, with quality slightly superior to MPEG
The video encoder allowed me to implement a Video Chat service similar to Skype.
First the frame is analyzed for similar sub-frames. If the sub-frames have barely changed, they are culled. The remaining frames are converted to the YCbCr color channels from RGB. On the remaining frames have the Fourier Transform (or DCT) performed on the data. The Fourier Transform is more compressible than the RGB values.
This is all performed in a buffer, which you can then export yourself. In order to keep the DIY feel to the project, you should add your own compressor to exporting the buffer. I used miniz.c.
I wanted to use VP8 from Google, but I couldn't build it properly without setting up a bunch of dependencies. After setting up the dependencies (finally), I found that their library made it difficult to do anything other than encode directly to a file. Since I needed this for a networking algorithm, I ditched VP8 and tried FFMPEG, and ran into the same issues.
That's when I decided to learn video and image compression, and the technology behind it. Hopefully this can be utilized for academic purposes by someone else.
For Academic Purposes, I wanted to see what would happen. Also partially because I couldn't determine the scale factors for the DCT using the FFTW libraries, due to a lack of clear documentation. When I did figure out how to use the DCT (which does get slightly better performance), it did not retain the interesting scaling properties of the Fourier Transform.
Editing just a few lines of code will make this use the DCT, or other kinds of transforms.
My friend had a blue shirt that day. So blue, that mathematically it wasn't converted to grayscale. I set the scale factors up as high as I could for that video, and as you can imagine, it compressed pretty well.
