Capturing a video using USB camera on iMX6 SL

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

Capturing a video using USB camera on iMX6 SL

12,233 Views
tejasshah
Contributor III

Hello,

I have a iMX6 Sololite board. This board doesn't have any embedded camera

as dual and quad core board has it. I am using Logitech camera.

And, the version of LTIB I am using is L3.0.35_12.10.02.

I am trying to capture the video using USB webcam from the board.

To do this, I have selected all these packages imx_test, util_linux, gstreamer, ffmpeg,

screen and have compiled them using LTIB. I went to the source code

of imx_test to see all the examples that are given and found mxc_v4l2_capture.c, but

this file is not compiled, so wasn't able to run it for capturing a video.

Can anyone please tell me how can I capture the video using USB webcam?

Any help is appreciated.

Thanks.

Labels (1)
0 Kudos
18 Replies

2,813 Views
tejasshah
Contributor III

Hi Leo,

I got caught up in getting my board to boot from the last past week. It kept on giving me a kernel

panic error. So currently I am using a demo images from Freescale website which has mfw_v4l2sink element already in it.

So, after I logged in as a root on the board, I checked if it has a already created video device by typing "ll /dev/video*". This command showed me this two lines on the terminal

lrwxrwxrwx    1 root     root             6 Jan  1 00:27 video -> video0
crw-rw----    1 root     root       81,   0 Jan  1 00:27 video0

I plugged my Logitech Camera to the board and again checked the /dev directory. Camera I plugged in to the board didn't create any new video device. It kept on showing video. And, this kept on giving me this error. If instead of "device=/dev/video1", if I use "device=/dev/video0" I get an error that video0 is not a capturing device.

root@freescale ~$ gst-launch v4l2src device=/dev/video1 ! mfw_v4lsink
MFW_GST_V4LSINK_PLUGIN 3.0.3 build on May  7 2013 15:16:07.
Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Cannot identify device '/dev/video1'.
Additional debug info:
v4l2_calls.c(493): gst_v4l2_open (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
system error: No such file or directory
Setting pipeline to NULL ...
Total rendered:0
Freeing pipeline ...
[--->FINALIZE v4l_sink
root@freescale ~$

Can you please help me? It is very urgent.

Thank you,

Tejas

0 Kudos

2,813 Views
LeonardoSandova
Specialist I

perhaps the camera is not recognized correctly. In case you can, can you try other cameras? the pipeline is fine but use /dev/video0.

Leo

0 Kudos

2,813 Views
tejasshah
Contributor III

This is the basic procedure which I am fully aware of, but need help resolving the issues.

I cannot find gnome profile as you suggested.

Did you select "gnome profile" option from "Chose the package profile" or do you get different option

from which you choose "gnome profile"?

Can you please check if your board name changes when you select gnome profile because with my option it does changes?

0 Kudos

2,813 Views
LeonardoSandova
Specialist I

To choose the gnome profile, you need to execute ./ltib --selectype

Leo

0 Kudos

2,813 Views
tejasshah
Contributor III

I did try what you said, but it is giving me new errors. But here is what I did.

So as you mentioned I did "./ltib --selectype", and here I have got two options :

"Chose the platform type" and "Chose the package profile".

Initially in "Choose the package profile" the default option selected is "use packages in preconfig (Min Profile)" and instead of that I chose " FSL gnome release package". This selection changes the board from "mx6s_evk" to "mx6s_arm2" which will make my configuration wrong, but still I complied it and new errors came in. So I had to again go back to my initial changes because mx6s_arm2 is not the correct board.

Can you tell me if your board selection also changes from mx6s_evk to mx6s_arm2 or does it remain same? Due to this change, I had to go to the selections I had before. Could please help me with this? And one more this, are you also connecting the USB camera to the single core board as I have or are you using the dual core which already has a camera?

In the error above it states that "mxcfb.h" is not present, but it is there in the directory.

0 Kudos

2,813 Views
LeonardoSandova
Specialist I

From the user guide

3. Build LTIB:

cd

7. Close the configuration screen saving the changes.

8. Run the following command:

./ltib

When this procedure is completed, the kernel image and the U-Boot images are

located at: rootfs/boot/

0 Kudos

2,813 Views
tejasshah
Contributor III

Hello Dongjun,

So you are saying that it would be nearly impossible to make camera work on imx6 sololite board?

I am getting errors while trying to build gst-fsl-plugins and haven't been able to get solution to that problems. I have posted that error before and pasting it here for you to see them.

In file included from vss/mfw_gst_video_surface.c:59:0:
vss/mfw_gst_vss_common.h:41:25: fatal error: linux/mxcfb.h: No such file or directory
compilation terminated.
make[1]: *** [libgstfsl_0.10_la-mfw_gst_video_surface.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
In file included from vss/mfw_gst_vss_common.c:54:0:
vss/mfw_gst_vss_common.h:41:25: fatal error: linux/mxcfb.h: No such file or directory
compilation terminated.
make[1]: *** [libgstfsl_0.10_la-mfw_gst_vss_common.lo] Error 1
hbuf_alloc/hwbuffer_allocator.c:47:23: fatal error: linux/ipu.h: No such file or directory
compilation terminated.
make[1]: *** [libgstfsl_0.10_la-hwbuffer_allocator.lo] Error 1
make[1]: Leaving directory `/home/pshah9/Documents/imx6install/ltib/rpm/BUILD/gst-fsl-plugins-3.0.3/libs'
make: *** [all-recursive] Error 1
error: Bad exit status from /home/pshah9/Documents/imx6install/ltib/tmp/rpm-tmp.90586 (%build)


RPM build errors:
    Bad exit status from /home/pshah9/Documents/imx6install/ltib/tmp/rpm-tmp.90586 (%build)
Build time for gst-fsl-plugins: 28 seconds

Failed building gst-fsl-plugins


f_buildrpms() returned an error, exiting
traceback:
main:572


Started: Mon May 27 17:16:05 2013
Ended:   Mon May 27 17:16:35 2013
Elapsed: 30 seconds

These packages failed to build:
gst-fsl-plugins

Build Failed

Exiting on error or interrupt

0 Kudos

2,813 Views
LeonardoSandova
Specialist I

Hi.

Do you observe the same error log even if you select the gnome profile? I tried a gnome profile + gst-fsl-plugins and built went fine on a Ubuntu 12.04.

Leo

0 Kudos

2,813 Views
tejasshah
Contributor III

Hi Leo,

So I have selected gst-fsl-plugins for complilation but it fails saying libfslcodec failed. It gives me this errror.

Try libfslcodec-3.0.3.tar.gz.md5 from the GPP

http://bitshrine.org/gpp/libfslcodec-3.0.3.tar.gz.md5:

15:03:36 ERROR 404: Not Found.

Try libfslcodec-3.0.3.tar.gz from the GPP

http://bitshrine.org/gpp/libfslcodec-3.0.3.tar.gz:

15:03:36 ERROR 404: Not Found.

Can't get: libfslcodec-3.0.3.tar.gz at ./ltib line 802.

f_buildrpms() returned an error, exiting

traceback:

main:572

Started: Mon May 27 15:02:37 2013

Ended:   Mon May 27 15:03:36 2013

Elapsed: 59 seconds

These packages failed to build:

libfslcodec

Build Failed

Exiting on error or interrupt


I was trying to download MM codecs, but everywhere it says that the source code for MM Codecs are not available. So, how would I download?

0 Kudos

2,813 Views
robby
NXP Employee
NXP Employee

several comments:
- mxc_v4l2_capture.c and csi_v4l2_capture.c is for freescale's csi modules. while USB camera is fairly independent on freescale's video IP. In other words, it's unlikely you can directly use these two unit test program.

- for the two packages (libfslcodec-3.0.3.tar.gz*) I think it would be in the LTIB package. However, even that's true, it's still not easy to make gstreamer work with LTIB building. Because it's not claimed to support this feature officially. As I know there's no property "preview" in element "v4l2src0" and no software encoder on mx6sl (and no hardware codec on it).

0 Kudos

2,813 Views
tejasshah
Contributor III

Hi Leo,

So I booted the board and did (ls /dev/video*) to make sure that video0 is not created before connecting the USB camera to the board. But it was already created before plugging the camera. Then also I plugged in my camera to the board and again I did (ls /dev/video*) and this time it showed video1 also being created besides video0.

And, then I tried the new command you mentioned in the above reply (gst-launch v4l2src ! mfw_v2lsink).

This is giving me the following error:

root@freescale ~$ gst-launch v4l2src ! mfw_v2lsink                             
WARNING: erroneous pipeline: no element "mfw_v2lsink"                          
root@freescale ~$

0 Kudos

2,813 Views
LeonardoSandova
Specialist I

Sorry, use mfw_v4lsink. Have you installed the FSL gst plugins? If yes, do a gst-inspect | grep mfw. You should observed this:

beep.imx:  beepdec: beep audio decoder

aiur.imx:  aiurdemux: aiur universal demuxer

aacdec.imx:  mfw_aacdecoder: aac audio decoder

mp3dec.imx:  mfw_mp3decoder: mp3 audio decoder

amrdec.imx:  mfw_amrdecoder: amr audio decoder

mp3enc.imx:  mfw_mp3encoder: mp3 audio encoder

vorbisdec.imx:  mfw_vorbisdecoder: vorbis audio decoder

v4lsrc.imx:  mfw_v4lsrc: v4l2 based camera src

v4lsink.imx:  mfw_v4lsink: v4l2 video sink

The last element on the list is the one you should use.


0 Kudos

2,813 Views
tejasshah
Contributor III

In package selection list, I selected " gstreamer-plugins-good", "gstreamer-plugins-bad",

"gstreamer-plugins-ugly" and "gstreamer FFmpeg plugins".

Am I missing any packages?

And, could you tell me which package has mfw or do I have to install it from website?

0 Kudos

2,813 Views
LeonardoSandova
Specialist I

What you have selected so far is good, but you need the plugins Freescale provides, tuned for the imx platforms. Go to the ltib's config menu, and select Package list-->Freescale Multimedia plugins/codes -->gst-fsl-plugins. Make sure you have downloaded the MM codecs and placed them on /var/tmp/pkgs (or place them in other place but you need to change %ldirs on .ltibrc file).

Leo

0 Kudos

2,813 Views
artyeffem
Contributor II

I'm having a similar issue finding the Freescale mfw plugins.  I've configured them in the Buildroot menu, and the libmfw_* shared libraries are built, as well as the libraries installed under /usr/lib/imx-mm.  gst-inspect finds all the other plugins, but the Freescale ones.

0 Kudos

2,813 Views
tejasshah
Contributor III

Hello,

I have already looked at that document.

But, whenever I use the following command, I am getting an error.

gst-launch v4l2src ! autovideosink

Initially I was getting a error that there is no element as v4l2src, but after I compiled

gst-plugins good, that error has gone as this contains v4l2src.

Here is the error.

root@freescale ~$  gst-launch v4l2src ! autovideosink                          
Setting pipeline to PAUSED ...                                                 
ERROR: Pipeline doesn't want to pause.                                         
WARNING: from element /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0: R.
Additional debug info:                                                         
gstautovideosink.c(314): gst_auto_video_sink_find_best (): /GstPipeline:pipelin:
Failed to find a usable video sink                                             
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Device '/dev/vi.
Additional debug info:                                                         
v4l2_calls.c(515): gst_v4l2_open (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Capabilities: 0x4000202                                                        
Setting pipeline to NULL ...                                                   
Freeing pipeline ...                                                           
root@freescale ~$

0 Kudos

2,813 Views
LeonardoSandova
Specialist I

Hi Shah,

My bad, please test it with this pipeline

gst-launch v4l2src ! mfw_v2lsink

so do not use autovideosink. When connecting the USB camera, check the kernel log (dmesg | tail) to check any errors and make sure the device node was created (ls /dev/video?).

Let me know the result.

Leo

0 Kudos

2,813 Views
Yuri
NXP Employee
NXP Employee

Please look at the following :

https://community.freescale.com/docs/DOC-93688

0 Kudos