Using a USB Camera with GStreamer

Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using a USB Camera with GStreamer

No ratings

Using a USB Camera with GStreamer

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'.

Labels (2)

Thanks for sharing but this doesn't work with my 2 UVC 1.1 compliant cameras when encoding "Could not negotiate format".

vpuenc requires raw uyv in either TNVP, NV12 or I420, I can force raw output but my camera is not supporting those (a test to a file gave YUY2). Can make this work using color conversion in software (at least in vga 30 fps) :

gst-launch v4l2src num-buffers=100 ! video/x-raw-yuv ! queue ! ffmpegcolorspace ! queue ! vpuenc codec=6 ! avimux ! filesink location=outputh264.avi sync=false

On iMX53, there was mfw_ipucsc but all I found on 12.09 BSP is ipucsc.imx which is not working, probably only CSC in the DP path, this should be possible in Image Converter but I didn't find any plugin for that. Does anyone have a better pipeline ?

Sorry for the long long delay on answering your question. Do you still have the problem? what is the error log when using mfw_ipucsc?


Hi Leo,

I have a problem connecting my UVC compliant Camera to i.MX6 board. I've started a new discussion here: UVC camera not detected on i.MX6 SABRE board. Could you take a look and see what's wrong?

Thank you so much.


You can fix link please! i can't see it

Best regard!

Version history
Last update:
‎10-23-2012 08:19 AM
Updated by: