Using a USB Camera with GStreamer

Document created by Leonardo Sandoval Gonzalez Employee on Oct 23, 2012Last modified by Leonardo Sandoval Gonzalez Employee on May 27, 2013
Version 6Show Document
  • View in full screen mode

If you want to use a USB camera (these types of cameras are also called 'Web Cameras') with GStreamer on i.MX6 devices (Linux Kernel version >= 3.035), you need to either load the module dynamically or compile and link statically selecting (Y) the following config on the Kernel configuration


     Device Drivers -> Multimedia support -> Video capture adapters -> V4L USB devices -> <*> USB Video Class (UVC)


After the Kernel image has been built, flash it into the target, plug the web cam, then on a (target) terminal run


     gst-launch v4l2src ! mfw_v4lsink


You should see what the camera is capturing on the display. In case you need to encode the camera src data, you need to place the encoder into the pipeline


     gst-launch v4l2src num-buffers=100  ! queue ! vpuenc codec=0 ! matroskamux ! filesink location=output.mkv sync=false


We are using a certain codec (codec=0 means mpeg4), check options using 'gst-inspect vpuenc'.

2 people found this helpful