I’m working with MS Kinect to record and replay color, depth and skeleton output.
I’m using BinaryWriter to write this information to a file. The process works well however the file size becomes huge over a short period of time (~15 GB in 5 minutes). Naturally when calling for “replaying this information”, loading this size of file takes a while to start playback. While the need is to be able to record about 1 hour of output. Going by that rate it will be 180 GB file by end of recording, which I’m guessing will be too much to load and start instant playback.
One potential solution is to detect when a size of file has reached say 1 GB and then create another file and keep repeating this process. That way I’ll end up with several 1 GB file for 1 hour recording. For a replay I’ll then load them up one by one.
Before I begin doing this, I have to keep in mind that the Kinect output is continuously streaming in. Hence creating new files can take a significant time overhead.
Questions:
-
Do existing file writing APIs in .NET provide a way to automate detecting the size of file and create another file and so forth?
-
Will creating new files every few seconds be a significant overhead? As the information I wish to record is streaming in at the rate of 30 frames per second which could mean losing some of it while the file is being created and so forth.
I think I need high accuracy as its a research application. I just did another test
30 mins of depth,color capture ended up with nearly 98 Gb file.
Using this code ( from Kinect.Toolbox ) takes foreever to playback-
{
while (reader.BaseStream.Position != reader.BaseStream.Length)
{
KinectRecordOptions header = (KinectRecordOptions)reader.ReadInt32();
switch (header)
{
case KinectRecordOptions.Color:
colorReplay.AddFrame(reader);
break;
case KinectRecordOptions.Depth:
depthReplay.AddFrame(reader);
break;
case KinectRecordOptions.Skeletons:
skeletonReplay.AddFrame(reader);
break;
}
}
}
If you don’t need intense accuracy you could reduce your sampling rate so that you still have enough to support the fps you will replay them in with a smaller file size.
The Kinect captures a lot of information, so it may be best to pinpoint exactly what you want to playback and only save that information.