Video compression using octrees. Compresses video like a 3d volume. Also can be called volume compression.
Similar to quadtree compression but for videos. It uses octrees with the third axis being temporal. It treats the video like a voxel volume, and compresses it like a sparse voxel octree. Just like quadtree compression, it uses color error to decide where to split.
This compression is hardly practical, but it is a unique approach and is very fun.
Now is very fast thanks to multithreading.
Requires opencv dll files in the build directory and the opencv include files in the project directory under opencv2 in order to build.
You input a video and settings. The program will compress the video and then decompress it. The decompressed result will be saved as the filename + _compressed and will also be displayed. Use escape to exit video display. It will also show the percentage as it works, and will show the compression ratio at the end based on the number of vectors.
Takes up to 6 parameters as command line arguments.
- Filename of video relative to working directory.
- Max number of frames to process. So that you can test compression on just a small part of a longer video.
- The number of frames to process at a time. Higher means more efficient compression but more memory taken up. The amount you should set depends on the video resolution and the capabilities of your machine.
- The max color distance before a node is split. Smaller for higher quality.
- The max tree depth. Can be used to pixilate or lower overall quality.
- The max number of threads that can run at a time. Make 1 for single threaded. Change depending on the memory taken up(video resolution) and your cpu cores. For shorter videos just set it to a high number, so it does it all at once.
Default values:
- test_video.mp4
- 600
- 30
- 25
- 11
- 50
- Custom file format
- GPU acceleration.
- Combination with other compressions.
The file size of the saved mp4 video has nothing to do with the compression from this project. It is only to virw the result of the compression and is not an accurate represntation of the data saved. The program tells you the exact compression ratio when it is done.
4 times compression ratio.