Skip to end of metadata
Go to start of metadata

Video devices

In order to let several clients use the same video device, Reeti has a "virtual video devices" for each real video device.  More information is available on this site : https://github.com/umlaeute/v4l2loopback

  • /dev/video_left_lo which is a virtual loopback device of /dev/video_left
  • /dev/video_right_lo which is a virtual loopback device of /dev/video_right

So :

  • /dev/video_left and /dev/video_right should not be used
  • /dev/video_left_lo is accessible by several clients : default configuration is set to 30 fps, 640x480 resolution, MJPEG compression
  • /dev/video_right_lo is accessible by several clients : default configuration is set to 30 fps, 640x480 resolution, MJPEG compression


You can also access the loopback devices by its ID  (useful for OpenCV) :

  • /dev/video_left_lo is a symbolic link to /dev/video6
  • /dev/video_right_lo is a symbolic link to /dev/video7


How to customize camera settings

Resolution and fps

On boot, the script /reetiPrograms/scripts/cameraInit.sh starts the upstart script /etc/init/cameraloopback.conf for each camera.
For example to change both camera's resolution to 720p, you can modify the line

sudo start cameraloopback CAMERA=right >> /dev/null 2>&1
sudo start cameraloopback CAMERA=left >> /dev/null 2>&1

to :

sudo start cameraloopback CAMERA=right RESX=1280 RESY=720 FPS=30/1 >> /dev/null 2>&1
sudo start cameraloopback CAMERA=left RESX=1280 RESY=720 FPS=30/1 >> /dev/null 2>&1

After a reboot /dev/video_left_lo and /dev/video_right_lo will be in 720p.

Remark : using both camera's in 720p will increase the CPU usage.

Exposure, white balance, power line frequency ...

The configuration files /home/reeti/reetiPrograms/data/camera_left.ini and /home/reeti/reetiPrograms/data/camera_right.ini are loaded on boot.

The utility "guvcview" (sudo apt-get install guvcview) can be used to visually change the camera parameters.

The utility "uvcdynctrl" can be used to load/save the camera settings from/to a .ini file.

How to watch the video (in VLC)

  1. Open VLC
  2. Go to Media -> Open Capture Device
  3. Choose /dev/video_left_lo or /dev/video_right_lo as input device
  4. Play


You can also install and use your favourite linux application or library. Refer to this page to be able to install an application from ubuntu repository : Update Ubuntu

Video Streaming (with VLC) 

Reeti :

  1. Open VLC
  2. Go to Media -> Stream
  3. Choose /dev/video_left_lo or /dev/video_right_lo as input device
  4. Click on "Stream"
  5. Add RTSP destination, for example on port "8554" and path "/"
  6. Activate transcoding and choose the profile "Video - MPEG-2"
  7. Steam

Client :


  1. Open VLC
  2. Go to Media -> Open network stream
  3. Choose rtsp://ip-of-reeti:8554/
  4. Play

 

Remarks :

  • Reducing the "Caching" duration on both host and client can reduce the latency

How to record video and audio

You can use your favourite linux application or library.

Here is the example with avconv :

avconv -f pulse -i default -f video4linux2 -itsoffset 0.5 -i /dev/video_right_lo -c:a mp3 -b:a 128k -c:v libx264 -b:v 2000k -preset ultrafast test.mp4


You can change the default audio source "default" to a specific audio device, like "alsa_input.usb-Microsoft_Microsoft___LifeCam_HD-3000-02-HD3000.analog-mono" for the webcam.

Reeti API to record video

If you want to develop your own recorder you can also refer to UCamera source code (Umodule based upon Urbi and Qt) : UCamera repo

This is the UModule which is preinstalled in Reeti and documented in the API
 

How to use the camera's for image processing

You can, for example, use the OpenCV library. Here is an example that reads the video stream and detects movements : UExhibitor

Also refer to this page : Urbi C++ Module

Common problems

  • A reboot can sometimes make the usb webcam driver crash. After a power-off then power-on, the problem doesn't occur.

 

 

 

 

  • No labels