Closed fberna closed 3 years ago
It looks like am continuously overwriting the file. Yes, that's exactly what's happening. Move createing/disposing of
recorder
andrecorder.WriteHeader
call out of the loop.using (var recorder = new Recorder(dstFilePath + "00.mkv", kinect, configuration)) { recorder.WriteHeader(); while (true) { // get capture recorder.WriteCapture(capture); } }
Move createing/disposing of recorder and recorder.WriteHeader call out of the loop.
I tried but like that Unity crashes every time. It is probably due to RAM overload.
You should dispose Capture
objects when finished working with them. In this case, right after calling WriteCapture
.
You should dispose Capture objects when finished working with them. In this case, right after calling WriteCapture.
In this way, I will have my file in the right format but with zero frames in it.
using (K4AdotNet.Sensor.Capture capture = await Task.Run(() => kinect.GetCapture()).ConfigureAwait(true)
{
using (var recorder = new Recorder(dstFilePath + "00.mkv", kinect, configuration))
{
recorder.WriteHeader();
while (true)
{
recorder.WriteCapture(capture);
capture.Dispose();
}
}
}
Apparently you should be getting Capture
inside the loop before writing it to recorder
.
It works! Thank you
Hi guys, I am using the capture function in order to create directly a .mkv file from Unity. From the code below a get only a frame into the file. It looks like am continuously overwriting the file. Have some of you any suggestions?
Thx FB