I'm looking for image / video file formats that
- support lossy compression to reduce disk size and
- allow for fast subregion lookup. i.e. dont read the entire file when you only need to lookup a small space/time region.
The use case is for preprocessing large image and videos (i.e. we are keeping the raw data, which is why lossy compression is ok) and then being able to quickly lookup small regions for training ML algorithms.
So far I've found several candidates:
cloud-optimized-geotiff (CoG) format, which works very well for images. Unfortunately, to use it I need to use GDAL, which can be a pain to install, but it's not a huge deal. However, it lets me lookup arbitrary regions of large (20k x 20k) images very quickly, and I can either store the data with lossy jpeg compression or lossless compression. The main issue with the CoG format is that it doesn't support video.
numpy memmap - in terms of speed, this can't be beat. This can lookup arbitrary subregions of images or video in no time flat. However, the disk requirement is huge. I often see a 10x increase in disk usage with memmaps, which is not feasible when a single image/video data can be over 100MB. If mememaps had some sort of lossy block compression, then I'd probably be all set, but alas they do not.
hdf5 - this works for both image and video. Its quite a bit slower than memmaps (~100x), but it can load arbitrary subregions without loading the entire image. I've been using the
h5pybindings for this, and unfortunately they don't seem to expose any lossy compression algorithms that provide any meaningful disk savings.
Generally, I'm wondering if there are any other formats or libraries out that that I'm unaware of.
Specifically, is there any similar alternative to the CoG format that doesn't require GDAL? Is there any analog of the CoG format for multi-frame video data?