Blurry Webcam

Hi All,

I'm trying to fix another major issue in my BB project (I've sped up
boot time a ton, thanks). I'm using a Logitech Pro cam 9000 in a
console image of Angstrom and I'm trying to record video with ffmpeg
and I'm able to record all the way up to 1024 x 768 in mpeg4 format,
but it is very blurry/choppy when there is motion. I've set the frame
rate to about 30 frames per second, but I suspect the camera is not
actually recording at this rate. I'm pretty sure the beagle board is
capable (hardware wise) to do so and the camera is when running under
another OS (Windows XP). Are there some libraries or other recording
programs or something I'm missing that can help enhance my video
capture? Perhaps some ffmpeg trick I'm missing. I'm currently using a
standard demo angstrom image.

Thanks!

I'm trying to fix another major issue in my BB project (I've sped up
boot time a ton, thanks). I'm using a Logitech Pro cam 9000 in a
console image of Angstrom and I'm trying to record video with ffmpeg
and I'm able to record all the way up to 1024 x 768 in mpeg4 format,
but it is very blurry/choppy when there is motion. I've set the frame
rate to about 30 frames per second, but I suspect the camera is not
actually recording at this rate. I'm pretty sure the beagle board is
capable (hardware wise) to do so and the camera is when running under
another OS (Windows XP). Are there some libraries or other recording
programs or something I'm missing that can help enhance my video
capture? Perhaps some ffmpeg trick I'm missing. I'm currently using a
standard demo angstrom image.

Recording 1024 x 768 MPEG4 video might not be the best thing you can do.
The be honest, I know very little about the complete video-chain on
BeagleBoard using ffmpeg, but looking at the topic as such the following is
pretty clear. :slight_smile:

According to
http://www.logitech.com/index.cfm/webcam_communications/webcams/devices/3056
&cl=GB,EN the camera maximum specs for video are:
960x720 pixel 24 bit color at 30fps, which doesn't scale nice and easily to
1024x768...

In case all encoding is done on the beagle board (I assume the camera
doesn't do any HW encoding since it isn't mentioned on the homepage) you
need to transfer and encode
960x720x3x30 bytes/s = 62MB/s, which is higher than the absolute maximum
theoretical bandwidth (~59MB/s for bulk transfers) of USB2.0 => Problem...

Secondly it's a tough (read: impossible) task for the ARM-A8-core to encode
(and scale to 1024x768?) all this data and at the same time handling a
maximum loaded USB2.0 connection => Problem...

Therefore try to record data in a lower resolution better suited for the
camera (i.e. 480x360 have a scaling factor of 2:1)...

Best regards - I hope this helped although it might not be the answer you
hoped for :slight_smile:
  Søren

PS: Are you showing video on the DVI output (although running a console
image) as well? - This as well grabs some of the available memory
bandwidth...
I.e. 1280x720@60Hz-16bit grabs around 111MB/s of the theoretical total
memory bandwidth of 4 bytes x 166MHz = 664MB/s (in practice it's lower due
to DDR refresh, addr-line setups and so on...)
=> ~20% of the total memory bandwidth goes to supporting the display
"without doing anything update other normal refresh" - Think about this :slight_smile:

Soren,

The camera is capable of the following recording:

# Color depth: 24-bit true color
# Video capture: Up to 1600 x 1200 pixels (HD quality) (HD Video 960 x
720 pixels)
# Frame rate: Up to 30 frames per second

Would it be possible to record the video first and then record so the
BB isn't trying to do two "big" tasks at once?
Even if I record at a very low video resolution (320 x 240 or even
lower) it is still blurry when there is motion. I have a feeling this
related to something in software I'm missing.

Does anyone else have any incite into Webcam use on the BB? Have you
been able to record quality video at a decent resolution?

# Color depth: 24-bit true color
# Video capture: Up to 1600 x 1200 pixels (HD quality) (HD Video 960 x
720 pixels)
# Frame rate: Up to 30 frames per second

Would it be possible to record the video first and then record so the
BB isn't trying to do two "big" tasks at once?

Even if I record at a very low video resolution (320 x 240 or even
lower) it is still blurry when there is motion. I have a feeling this
related to something in software I'm missing.

Are you sure it can do it all at the same time? - Normal marketing trick to
put max-max specs :slight_smile:
According to the USB spec this is impossible unless the camera does the
compression?
I bet it doesn't but I don't know for sure. In case it does, you might be
able to tweak something here...

With respect to storing for later processing this would require an insane
amount of memory - Again referring to my previous calculations...

320x240@30pfs should work as far as I can imagine. Agree - This seems to be
related to some kind of SW setting, but I bet you will as well hit the other
limits when fixing the SW issue at the low resolution.
As said previously I unfortunately know very little about ffmpeg and
therefore can't help you out here...

Best regards - Good luck
  Søren

Alright sounds good. Ill do some more research into ffmpeg.

Can anyone else help shed any light on this? Any recommendations on encoding software or other webcams to shoot some quality video on the BB (if possible)?

Alex Behrens
Next Generation Consulting
Owner
WWW: www.ng-cc.com
Phone: 651.329.4187

I don't know if you are using your camera indoors our under sunlight,
but I suspect indoors. I've heard that these kinds of cameras tend to
be blurry in lower level light conditions and that they tend to
automatically reduce the framerate to extend the exposure time. You
might experiment with more light (eg: a view out the window in
daytime, as compared to indoor lighting) and see if the image quality
improves.

-Chris

Chris,

Great suggestion! I didn't think of this before and will give it a try.

Alex Behrens
Next Generation Consulting
Owner
WWW: www.ng-cc.com
Phone: 651.329.4187

So I was able to install the program:
V4l2ucp
http://sourceforge.net/projects/v4l2ucp/

and adjust the Exposure rate for my Logitech Quickcam and it reduces
blurness (basically eliminates if set high enough).

However, this program runs in a Window, would it be possible to run
this from a Command prompt on my Beagle board?
I already configured and ran make to install the program.

Or, I was trying to use the following small c script:
http://launchpadlibrarian.net/19781801/set_cam_exp.c.gz

but I get the following error:
remotevs@remotevs-desktop:~/Desktop$ ./set_cam_exp /dev/video0 350
V4L2_CID_EXPOSURE is not supported

Has anyone ever seen this or have any idea how I change it? Many
others in the following forum post:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/287336
were able to use this program sucessfully, but I haven't heard back
from them yet.

Thanks and sorry for being such a newbie!

I tried running the same command on my BB and I get the following:

root@beagleboard:~/v4l2ucp# ./v4l2ucp /dev/
video0
./v4l2ucp: line 1: syntax error: "(" unexpected (expecting
")")
root@beagleboard:~/v4l2ucp#
make
-sh: make: not found

I'm assuming this is because I didn't make it on the BB, but rather on
my Ubuntu desktop.
I'm such a newbie with this, but how do I get make on the BB so I
could compile either of the two following programs mentioned in the
last post?

Thanks!

While it is certainly possible to compile stuff on the Beagleboard (especially if you use the Angstrom distribution), if you aren't already using Angstrom, you probably will have an easier time cross-compiling things. To do that you'll need to learn a little bit about makefiles.
Basically, you want to make sure the C compiler it is using is the cross-compiler "arm-none-linux-gnueabi-gcc" (runs on x86, compiles to produce arm code), instead of plain "gcc" (runs and produces x86 code). Depending on how the makefile is set up, you can do a make with the "CROSS_COMPILE=arm-none-linux-gnueabi-" argument which will use that as a prefix for the gcc command, or you can set CC=arm-none-linux-gnueabi-gcc, either in the shell or in the makefile itself. There may be additional complexities, depending on the makefile.
Take a shot at sorting it out, and if you want additional help you can send me the makefile directly and I'll take a look and see if I can help.

Brett

Ok cool thanks.

My only concern is I installed arm-non-linux-gnuabi on my desktop (for
compiling a kernel) with a full blown installer. Is it possible to
install it on the BB in console-only mode. I'm limited to the console
only image for my project so I hope that doesn't make this impossible.
Sorry for being such a newbie, I've learn a ton over the past two
weeks and it's starting to come together but a lot of the compiler
issues, makes, gcc, etc I'm still trying to wrap my head around. I'm
trying to get the Windows mentality on how programs install, compile,
etc :slight_smile:

Thanks so much for your help!

Ok cool thanks.

My only concern is I installed arm-non-linux-gnuabi on my desktop (for
compiling a kernel) with a full blown installer. Is it possible to
install it on the BB in console-only mode. I'm limited to the console
only image for my project so I hope that doesn't make this impossible.
Sorry for being such a newbie, I've learn a ton over the past two
weeks and it's starting to come together but a lot of the compiler
issues, makes, gcc, etc I'm still trying to wrap my head around. I'm
trying to get the Windows mentality on how programs install, compile,
etc :slight_smile:

Thanks so much for your help!

You don't need the arm-...-gcc on your beagleboard. You should
compile your beagle apps on your desktop, producing ARM executables
that you then copy to the beagle and run there. Given your current
dev environment, I suspect that would be the easiest thing.
Otherwise, you'll need a bunch of dev tools on your beagle that you
probably don't have.
Don't worry about taking time to learn stuff. I have a solid (if
dated) Unix background and it is still quite a struggle to absorb all
of the informtion needed to build kernels, write code for embedded
systems, etc., all while trying to get a project done as well.

Brett

How do I compile the apps on my desktop and create ARM executables?
Isn't this what arm-non-linux-gnuabi is supposed to do or am I not
compiling them correctly?

I've been trying to install packages on my BB to try to compile on
there (I just saw this message now) and I'm running into trouble there
because I don't think I have all the packages installed. I installed:
gcc and g++ but still get the following error:

configure: error: C++ compiler cannot create executables

when trying to compile on the BB.

I'd prefer to create them on the desktop and transfer them over.
Please help. Thanks!

How do I compile the apps on my desktop and create ARM executables?
Isn't this what arm-non-linux-gnuabi is supposed to do or am I not
compiling them correctly?

Forgive me if you already understand some of this, I'm just trying to
make sure it is all clear:
If you installed CodeSourcery tools, you now have (at least) two
different compilers on your desktop:
One is called "gcc", and compiles .c files into x86 code
One is called "arm-none-linux-gnuabi-gcc" and compiles .c files into ARM code
You need to make sure you run the ARM version when you compile stuff
for the beagle. Just because you have installed CodeSourcery doesn't
mean all compilation automatically uses the ARM code generation.

There are common conventions used by *some* makefiles that mean if
you set the "CROSS_COMPILE" shell variable to a prefix (like
"arm-none-linux-gnuabi-"), it will make sure to prepend that to all
the compilation tool names. However, not all makefiles use that
convention. So for any given application that you want to compile,
you need to examine the makefile and see what needs to be done to
make it use your desired compiler.

If you are compiling C++ code, all of the above applies, just with
"g++" in place of "gcc".

If you send me the makefile directly (not on the list, so as not to
clutter it), I can give advice on how to make it use the ARM cross-compiler.

Brett

Angstrom does *not* use the codesourcery toolchain, so if you wan't to run your binary in angstrom, use the same toolchain as angstrom does.

regards,

Koen

...And because Angstrom doesn't use CodeSourcery, building userland
apps on a Windows host (customer requirement) is a lot harder...

No, I'm using a Ubuntu desktop.

So to get things straight... If I want to cross-compile on my Ubuntu desktop for the BB what tool chain do I use? I know why I'm so confused now but just sure what compiler to use. OE on my desktop then copy over? Thanks!

Alex Behrens
Next Generation Consulting
Owner
WWW: www.ng-cc.com
Phone: 651.329.4187

OE on your desktop or task-native-sdk on your beagle.

regards,

Koen

Thanks!

Now I just need to figure out how the hell to do it with OE, it looks very involved.

Alex Behrens
Next Generation Consulting
Owner
WWW: www.ng-cc.com
Phone: 651.329.4187

...And because Angstrom doesn't use CodeSourcery, building userland
apps on a Windows host (customer requirement) is a lot harder...

There are people working on Canadian cross toolchains in OE. This
should address this specific issue.

Philip