Record streams of D435i on Android
Hi,
I use the following code to record streams. However, if I config.enableRecordToFile("streams.bag"); the code will stuck at mPipeline.start(config).
Without it the app runs smoothly.
Is it because of the wrong folder of "streams.bag"?
Thank you!
Yixun
RsContext.init(getApplicationContext());
mRsContext = new RsContext();
mPipeline = new Pipeline();
config.enableStream(StreamType.DEPTH, DEPTH_STREAM_WIDTH, DEPTH_STREAM_HEIGHT);
config.enableStream(StreamType.COLOR, DEPTH_STREAM_WIDTH, DEPTH_STREAM_HEIGHT);
config.enableStream(StreamType.INFRARED, 1, DEPTH_STREAM_WIDTH, DEPTH_STREAM_HEIGHT, StreamFormat.Y8, 30);
config.enableRecordToFile("streams.bag");
//the app stuck here if enableRecordToFile
mPipeline.start(config)
-
Hi Yixun Liu May I first confirm if you have defined values in your script for DEPTH_STREAM_HEIGHT and DEPTH_STREAM_WIDTH
Does the problem still occur if you define the width and height as hard-coded values like in the code below?
config.enableStream(StreamType.DEPTH, 640, 480,StreamFormat.Z16);
config.enableStream(StreamType.COLOR, 640, 480, StreamFormat.BGR8);
config.enableStream(StreamType.INFRARED, 640, 480,StreamFormat.Y8, 30); -
I do use 640x480 and it does not work.
I think the reason is the file access. If I use config.enableRecordToFile("a.bag"), the default location is the public share folder and it only supports URI access. So I change the code to String path = contex.getFileDir() + "/" + "a.bag"; config.enableRecordToFile(path) and it works now. The contex.getFileDir() return the private File folder and it supports access by a String path.
One more question is I notice you ignore the index in config.enableStream(StreamType.INFRARED, 640, 480,StreamFormat.Y8, 30); I want to record the first infrared stream. Is its index 0 or 1?
Thanks.Yixun
Please sign in to leave a comment.
Comments
3 comments