Storing Video Data into a TTree

Hi

I am thinking of using TTree to store captured video frames (with some associated data). Are there recommendation or examples regarding using TTree with large data sets such as video frames? Is it an appropriate method for storing such data (i.e. instead of writing the frames out using other video compression frameworks).

For our application, it would be useful to consolidate the data with the video frames, and then process the single tree file for analysis. I’ve implemented a branch in a tree to store a class that contains the video frame data, however I’m finding it to be slow while writing to the disk (because of compression?), and I am uncertain about the best way to read the data later…

Specific questions:

  • Is there a recommended ROOT class to store the video data (which is just a stream of unsigned char bytes)? Or would storing the byte stream as an array, within a class associated with a branch, suffice?
  • If the video data per frame is typically about 400-700KB, are there any recommendations about splitting the branch, and about how to specify the buffer size?

Thank you

Hi,

the major reason for using a TTree is that only one entry is in memory at any given time. So yes, this can be useful for videos, too.

If you use any reasonable compression algorithm on the video stream then zipping it won’t help much; you should instead set the zip level to 0.

If we are talking about raw, uncompressed frames, e.g. RGB values, then the TTree’s compression cannot compete with a proper codec - they are very, very different. (Codecs compress by comparing the current frame’s images with those of the previous frames.)

Splitting the branch is only useful if you dedicated have regions defined in your application, and you want to process only a subset of these regions.

Let us know if you need more info.

Cheers, Axel.