sccn / lsl_archived

Multi-modal time-synched data transmission over local network
242 stars 134 forks source link

Use LSL for VR streaming data #296

Open Brownybrown opened 6 years ago

Brownybrown commented 6 years ago

Hello together, WE are currently setting up a VR-lab that we would like to use for psychotherapeutic purposes. To cut things short, during our VR-stimulation sessions we would like to also collect electrophysiological data. I am therefore wondering whether there is a possibility to somehow record the VR-stream (what is presented over the HTC vive) via LSL? Moreover, I am wondering whether collecting such streaming data would cause any recoding problems for LSL?

I would be very thankful for your help. Cheers Niclas

cboulay commented 6 years ago

Are you using Unity? If you have control over the VR app, then you should have your VR app stream out events over LSL. Include as many events as are necessary to completely reconstruct what happened in your app. You should do this whether or not you save the video of what's presented on the monitor.

As for saving the video of what's presented, that's possible, but it's not very efficient and it might miss things (audio, any other info if the user isn't looking at what they're supposed to). If you do go that route, the easiest thing to do would be to use Open Broadcaster Software to capture the computer monitor to a video file and then later do post hoc synchronization. You can even do this with a plugin specifically for openvr here. You'll need some in-video events that are also timestamped in the LSL stream to be able to synchronize them properly.

A more difficult solution is the one you are hinting at. I think the simplest way to get video frames onto a stream would be to write a plugin for OBS to stream video to LSL. This would be pretty useful in many contexts, actually. However, that being said, if you wanted full framerate full resolution VR video, that's 233 MB/s, minimum, and I don't think your network could handle that.

tstenner commented 6 years ago

A more difficult solution is the one you are hinting at. I think the simplest way to get video frames onto a stream would be to write a plugin for OBS to stream video to LSL. This would be pretty useful in many contexts, actually. However, that being said, if you wanted full framerate full resolution VR video, that's 233 MB/s, minimum, and I don't think your network could handle that.

I'm writing the encoded frames to disc and send the frame indices to analyze them together later. You might also send the encoded frames, but it's quite heavy on the recording PC.

cboulay commented 6 years ago

@tstenner Is your app that sends frame times to LSL custom for your setup only, or can it generalize? I think it would be useful to have such a frametime plugin for VLC and/or OBS.

tstenner commented 6 years ago

Unfortunately not, I'm using the Psychtoolbox (for regular cameras) and the Flycapture SDK for FLIR cameras to get the capture timestamps and use the PTB video support to encode the frames. It should be quite easy to adopt this for cameras (and screens managed by PTB), but not for regular screen captures.