Dual Cameras

Compute Module: use Dual Cameras separately

Instead of having the two camera images packed side by side or one above the other to form the final frame – as in a typical stereoscopic scenario (see this tutorial) – you may want to access, configure and stream from each camera separately, yet at the same time eventually. This can be simply done by running two instances of uv4l with the –camera-number command line option correctly specified (and no –stereoscopic-mode specified), thus one process per camera.

For example, we can create the first device node for the camera connected to the CAM1 port. Let’s configure it as 1280×768, H264:

raspberrypi ~ $ uv4l --driver raspicam --auto-video_nr --encoding=h264 --width=1280 --height=768 --camera-number=0
 [driver] Dual Raspicam Video4Linux2 Driver v1.9.24 built Dec 13 2014
 [driver] Selected format: 1280x768, encoding: h264, H264 Video Compression
 [core] Device detected!
 [core] Registering device node /dev/video0

If the uv4l-server plugin has been already installed, the above command will also make the camera accessible from the network at the default HTTP port 8080.

Now let’s create the second device node for the other camera connected to the CAM0 port, configured as 640×480, MJPEG this time, and have an associated HTTP Server listening to port 9000:

raspberrypi ~ $ uv4l --driver raspicam --auto-video_nr --encoding=mjpeg --width=640 --height=480 --camera-number=1 --server-option='--port=9000'
 [driver] Dual Raspicam Video4Linux2 Driver v1.9.24 built Dec 13 2014
 [driver] Selected format: 640x480, encoding: mjpeg, JPEG Video Capture
 [core] Device detected!
 [core] Registering device node /dev/video1

Okay. Now we have the two cameras registered as different device nodes. This means we can access them individually through /dev/video0 and /dev/video1 with any Video4Linux2-complaint application. Or, if you prefer, we can get the streams directly from the two embedded HTTP Streaming Servers:

client ~ $ cvlc http://raspberrypi:8080/stream/video.h264 --demux h264
 client ~ $ cvlc http://raspberrypi:9000/stream/video.mjpeg