You can do it on Nexus9 with camera2 api. (Nexus5 can't open 2 cameras at the same time)
- Create 2 Gl contexts(Shared) and 2 texture buffers.
- Create a TextureView for previewing.
- Create a MediaRecoder for recording.
- Open front and back camera.
- Make repeating request that output target is texture buffer.
- Render scene with 2 textures to TextureView's surface for each frame.
- Render scene with 2 textures to MediaRecoder's surface for each frame.
You can switch to each camera by changing render object. You can also render both images in same video using alpha-blend, transform, scaling, etc. by 30fps