It is possible indeed but not easy.
I've actually made it and I'm working now on the code to be able to record/save the video.
Putting it simple you'd need to use a USB capture device.
The hard part is that you need to root/unlock the Nexus 7, compile the required kernel modules for the particular device and make
an application that later will talk and use the capture device.
Soon I'll be sharing some more detailed information in my page.