Is there any way to force raspivid or any other tool to display preview from camera (on hdmi display) side by side cloned, so it could be used in VR glasses?
I've never seen this done myself, but there was some discussion a while back on the RPi camera forum about either trying to use the MMAL video splitter component with the camera's preview output, or attaching a renderer to both the video and preview ports.
Quick high level overview of both raspivid and picamera:
- both use the MMAL API
- the MMAL API's camera component provides three virtual "ports": still, video, and preview (still is for doing still captures and involves lots of extra processing when it's used so we'll ignore it here)
- when raspivid or picamera initialize they immediately connect something to the preview port; in the case of picamera this is always a null sink just to keep the preview port active; in the case of raspivid it's a null sink if the preview is disabled or a preview renderer otherwise (the null sink is necessary to work around issues that occur when the preview port is ignored)
- here's where things start to get different: picamera then sticks a video splitter component on the video port to support things like recording at multiple resolutions, recording to H.264 while analyzing YUV, etc. etc. while raspivid sticks an H264 encoder on the video port and gets recording
So you could take apart raspivid and try initializing a second preview renderer then sticking it on the video port, or you could have a look at picamera's splitter usage and try sticking one of those on the preview port (then a second preview renderer on its outputs). Resizing a preview renderer to only cover part of the screen is pretty trivial (both raspivid and picamera provide this capability).
I'm not sure if either of these will work or if one is better than the other. My understanding is that MMAL is a pretty high level abstraction of what goes on in the firmware so there's probably all sorts of stuff going on under the covers that will make a difference in terms of performance or capability but it's definitely where I'd start.