Webcam programs working with webcamd in FreeBSD

Having trouble or general questions about porting software to FreeBSD? Ask here.

Webcam programs working with webcamd in FreeBSD

Postby Chuchubi » 18 Jun 2010, 19:45

Some time ago a lot of people where complaining about FreeBSD not having the possibility to use a webcam. Okay, we had a gspca driver and some other drivers but only for v4l1 and most of them don't work anymore. Now we have webcamd and v4l2 and we (The FreeBSD people) can take advantage of that. Webcamd have a lot of drivers and also the important UVC driver. There are a lot of programs that are working with a webcam on linux and now these programs can work on FreeBSD. I have succesfully compiled and run the following programs on FreeBSD:

wxcam
guvcview
effectv
luvcview
uvcview
mplayer
mencoder
mjpg_streamer
uvc_streamer
camorama
camserv
motion
xawtv
zoneminder

I have screenshots of this programs running on FreeBSD 8.0 release. For more information, go to http://www.rockafunk.org/

Making ports of all of this programs can easy be done. I already have the patches. Any help is welcome.
Chuchubi
Junior Member
 
Posts: 30
Joined: 24 May 2010, 03:56

Postby zeiz » 18 Jun 2010, 22:43

Tried to get my Logitech webcam working with [FILE]webcamd[/FILE] and [FILE]cuse4bsd[/FILE] but no luck :(
User avatar
zeiz
Member
 
Posts: 691
Joined: 19 Nov 2008, 18:36
Location: Canada

Postby Chuchubi » 18 Jun 2010, 23:24

zeiz wrote:Tried to get my Logitech webcam working with [FILE]webcamd[/FILE] and [FILE]cuse4bsd[/FILE] but no luck :(


Can you be more specific what is not working? Can you post some error messages. How did you install webcamd? There is a port of webcamd and you also need to install v4l_compat and libv4l. Do /dev/video0 exist?
Chuchubi
Junior Member
 
Posts: 30
Joined: 24 May 2010, 03:56

Postby adamk » 19 Jun 2010, 01:43

mplayer and vlc work here. Skype and flash are still non-functioning (just gives green static). At least when I last tried about 2 weeks ago.

Adam
adamk
Senior Member
 
Posts: 1624
Joined: 21 Nov 2008, 11:00

Postby Chuchubi » 19 Jun 2010, 11:29

adamk wrote:mplayer and vlc work here. Skype and flash are still non-functioning (just gives green static). At least when I last tried about 2 weeks ago.

Adam


I have tried skype but no luck yet. For the video in skype to work, some patching need to be done in the kernel source. Skype on FreeBSD work under linux emulation and I think the patches only work only the pwc driver. The patches can be found at http://opal.com/freebsd/sys/compat/linux/.
Chuchubi
Junior Member
 
Posts: 30
Joined: 24 May 2010, 03:56

Postby sk8harddiefast » 19 Jun 2010, 15:16

Me too. Same problem with Zeiz. If i remember right it was refused to see camera on usb port or something like that.
====================================
| -------> [color="Blue"]UNIX[/color]. Live Free Or Die! <-------- |
====================================
[color="RoyalBlue"]You can say:[/color] I can't do something because is difficult.
[color="RoyalBlue"]You must say:[/color] I tried a lot before say that I can't.
Never Give up.
[color="Green"]http://unixsystems.dyndns.org/[/color]
[color="Sienna"]I am not an BSD expert. But I really want to help.
Don't afraid to ask me anything. If I can I will help!
[/color]
Nice wallpapers to make your desktop more hardcore :) ---> [color="DarkOliveGreen"]http://forums.freebsd.org/showthread.php?t=13416[/color]
User avatar
sk8harddiefast
Senior Member
 
Posts: 1977
Joined: 01 Mar 2010, 00:47
Location: Athens, Greece

Postby Chuchubi » 19 Jun 2010, 15:44

sk8harddiefast wrote:Me too. Same problem with Zeiz. If i remember right it was refused to see camera on usb port or something like that.


Do [FILE]/dev/video0[/FILE] exists? How do you start webcamd? First you need to load cuse4bsd by doing [CMD=" "]kldload cuse4bsd[/CMD] Then do a [FILE]dmesg[/FILE] in a terminal to find out the ugen number. My logitec camera gives "ugen4.3".

Load webcamd like this:
# As root or use sudo

[CMD=" "]webcamd -d ugen4.3 -i 0 -v 0[/CMD]

Also change the permissions of your video device.
# As root or use sudo

[CMD=" "]chmod 666 /dev/video0[/CMD]

Test with pwcview:

[CMD=" "]pwcview[/CMD]
Chuchubi
Junior Member
 
Posts: 30
Joined: 24 May 2010, 03:56

Install webcamd instructions

Postby Chuchubi » 19 Jun 2010, 16:30

I see that some people have problems installing webcamd. I like to help so I have written here how I have done it.

Get the latest port tarballs for v4l_compat, libv4l, pwcview and webcamd.
Also get the cuse4bsd source.
Just follow the instructions to do that.
######################################################################

http://www.freebsd.org/cgi/cvsweb.cgi/ports/multimedia/v4l_compat/

Code: Select all
tar xvzf v4l_compat.tar.gz

cd v4l_compat

sudo make install

----------------------------------------------------------------------

http://www.freebsd.org/cgi/cvsweb.cgi/ports/multimedia/libv4l/

Code: Select all
tar xvzf libv4l.tar.gz

cd libv4l

sudo make install

----------------------------------------------------------------------

http://www.freebsd.org/cgi/cvsweb.cgi/ports/multimedia/pwcview/

Code: Select all
tar xvzf pwcview.tar.gz

cd pwcview

sudo make install

----------------------------------------------------------------------

Get cuse4bsd and install it

Code: Select all
svn --username anonsvn --password anonsvn checkout svn://svn.turbocat.net/i4b/trunk/usbcam/cuse4bsd

cd cuse4bsd

sudo make all install

----------------------------------------------------------------------

http://www.freebsd.org/cgi/cvsweb.cgi/ports/multimedia/webcamd/

Code: Select all
tar xvzf webcamd.tar.gz

cd webcamd

sudo make install

----------------------------------------------------------------------
# restart devd

Code: Select all
sudo /etc/rc.d/devd restart

----------------------------------------------------------------------
Code: Select all
sudo kldload cuse4bsd

----------------------------------------------------------------------
# Plugin your webcam and find out the ugen it is using.

Code: Select all
dmesg


# If it is ugen4.2

Code: Select all
webcamd -d ugen4.2 -i 0 -v 0


# If it is ugen2.2

Code: Select all
webcamd -d ugen2.2 -i 0 -v 0


# change permission of device
# You can also do that with /etc/devfs.rules
# add path 'video*' mode 0666

Code: Select all
sudo chmod 666 /dev/video


# Test

Code: Select all
pwcview


I hope this helps.
Chuchubi
Junior Member
 
Posts: 30
Joined: 24 May 2010, 03:56

Postby sk8harddiefast » 19 Jun 2010, 20:59

I give a try again :)
====================================
| -------> [color="Blue"]UNIX[/color]. Live Free Or Die! <-------- |
====================================
[color="RoyalBlue"]You can say:[/color] I can't do something because is difficult.
[color="RoyalBlue"]You must say:[/color] I tried a lot before say that I can't.
Never Give up.
[color="Green"]http://unixsystems.dyndns.org/[/color]
[color="Sienna"]I am not an BSD expert. But I really want to help.
Don't afraid to ask me anything. If I can I will help!
[/color]
Nice wallpapers to make your desktop more hardcore :) ---> [color="DarkOliveGreen"]http://forums.freebsd.org/showthread.php?t=13416[/color]
User avatar
sk8harddiefast
Senior Member
 
Posts: 1977
Joined: 01 Mar 2010, 00:47
Location: Athens, Greece

Postby zeiz » 20 Jun 2010, 02:54

Actually tried Skype :)
Anyway:
Code: Select all
$ pwcview
Warning short read, got only 6174 of 115200 bytes
.................................................

"Green box" and multiple warnings like above.

Code: Select all
$ ls -l /dev/video0
crw-rw-rw-  1 root  operator    0, 138 Jun 19 21:54 /dev/video0


[FILE]/etc/rc.conf[/FILE]
Code: Select all
webcamd_enable="YES"

[FILE]/boot/loader.conf[/FILE]
Code: Select all
cuse4bsd_load="YES"
pwc_load="YES"

Code: Select all
$ ls /var/db/pkg | grep v4l
libv4l-0.6.4
v4l_compat-1.0.20100403_1

[FILE]/etc/devfs.conf[/FILE]
Code: Select all
perm   video0   0666

Code: Select all
# webcamd -d ugen2.2 -i 0 -v 0
Webcamd is already running for ugen2.2.0

Ports were up-to-date
User avatar
zeiz
Member
 
Posts: 691
Joined: 19 Nov 2008, 18:36
Location: Canada

Postby Chuchubi » 20 Jun 2010, 04:49

Hi zeiz, if your webcam supports the pwc driver you should only load that driver. If you put
Code: Select all
webcamd_enable="YES"
in your [FILE]rc.conf[/FILE] the webcamd driver will load on boot. And when you then do
Code: Select all
webcamd -d ugen2.2 -i 0 -v 0
you load the driver for the second time. Do not load the pwc driver and webcamd together.
Chuchubi
Junior Member
 
Posts: 30
Joined: 24 May 2010, 03:56

Postby zeiz » 22 Jun 2010, 15:19

Understandable. I just shown that webcamd is loaded.
However
Do not load the pwc driver and webcamd together

Did you mean that webcamd will be loaded by pwc driver and thus no need in webcamd_enable="YES" in [FILE]/etc/rc.conf[/FILE]?
User avatar
zeiz
Member
 
Posts: 691
Joined: 19 Nov 2008, 18:36
Location: Canada

Postby adamk » 22 Jun 2010, 15:23

pwc is a driver for specific webcams.. webcamd + cuse4bsd should be used for webcams *not* supported by pwc.

Adam
adamk
Senior Member
 
Posts: 1624
Joined: 21 Nov 2008, 11:00

Postby zeiz » 22 Jun 2010, 15:47

Thanks but how could you comment this:
Chuchubi wrote:Do [FILE]/dev/video0[/FILE] exists? How do you start webcamd? First you need to load cuse4bsd by doing [CMD=" "]kldload cuse4bsd[/CMD] Then do a [FILE]dmesg[/FILE] in a terminal to find out the ugen number. My logitec camera gives "ugen4.3".

Load webcamd like this:
# As root or use sudo

[CMD=" "]webcamd -d ugen4.3 -i 0 -v 0[/CMD]

Also change the permissions of your video device.
# As root or use sudo

[CMD=" "]chmod 666 /dev/video0[/CMD]

Test with pwcview:

[CMD=" "]pwcview[/CMD]

? cuse4bsd loaded, webcam loaded and then pwcview started. But you said that pwc is only for some webcams. Did you mean that for other webcams cuse4bsd+webcamd must be loaded to make pwcview working? And for those supported by pwc no need in both cuse4bsd and webcamd?
Sorry if I'm really dumb today :)
User avatar
zeiz
Member
 
Posts: 691
Joined: 19 Nov 2008, 18:36
Location: Canada

Postby adamk » 22 Jun 2010, 15:54

There is the pwc driver (for specific webcams) and then there is the pwcview program, which is not specific to the pwc driver.

Adam
adamk
Senior Member
 
Posts: 1624
Joined: 21 Nov 2008, 11:00

pwcview

Postby Chuchubi » 22 Jun 2010, 16:59

adamk wrote:There is the pwc driver (for specific webcams) and then there is the pwcview program, which is not specific to the pwc driver.

Adam


You are right. The program pwcview is just a program to view [FILE]/dev/video0[/FILE]. The driver does not matter for pwcview. The pwc driver however is just for webcams supporting this driver. If you dont have such a webcam you dont have to load the pwc driver. So you are right!
Chuchubi
Junior Member
 
Posts: 30
Joined: 24 May 2010, 03:56

Postby zeiz » 22 Jun 2010, 17:01

So, assuming that pwcview works for both following cases, should I use webcamd + pwc if my webcam supported and webcamd + cuse4bsd othewise?
User avatar
zeiz
Member
 
Posts: 691
Joined: 19 Nov 2008, 18:36
Location: Canada

Postby adamk » 22 Jun 2010, 17:16

Wow, you really are having a hard time with this:

Do not load the pwc driver and webcamd together


If your card is supported by the pwc driver, use it (do not use webcamd). If it's not supported by the pwc driver use cuse4bsd+webcamd.

Adam
adamk
Senior Member
 
Posts: 1624
Joined: 21 Nov 2008, 11:00

Postby zeiz » 22 Jun 2010, 17:28

I left the wedding right after 4 a.m but they finished at 7:30 :)
User avatar
zeiz
Member
 
Posts: 691
Joined: 19 Nov 2008, 18:36
Location: Canada

Postby lme@ » 23 Jun 2010, 09:06

Chuchubi: Do you plan to create some PRs with the patches, so they get into the ports collection?
User avatar
lme@
 
Posts: 611
Joined: 08 Oct 2007, 19:42
Location: Düsseldorf, Germany

Postby zeiz » 23 Jun 2010, 14:02

Got it working. Thanks, Chuchubi!
A couple of problems are here.
First [FILE]video0[/FILE] looks always being created under root credentials and editing of [FILE]/etc/defaults/devfs.rules[/FILE] or [FILE]/etc/devfs.rules[/FILE] or [FILE]/etc/devfs.conf[/FILE] doesn't work here. Only chmod works for given session.

Second: during boot webcam first fails to start:
Code: Select all
Starting webcamd
/libexec/libexc/ld-elf.so.1: Shared object libcuse4bsd.so.1 not found required by "webcamd"
/usr/local/etc/rc.d/webcamd: WARNING: failed to start webcamd
ELF ldconfig path: ..... /usr/local/lib ....

However
Code: Select all
find / -name libcuse4bsd.so.1
/usr/local/lib/libcuse4bsd.so.1

Nevertheless webcamd starts later. I am on 9-current, it could be the -current problem.

Skype (tarball: [FILE]skype_static-2.0.0.72-oss.tar.bz2[/FILE]) doesn't work yet: both video and audio.
On Linux same webcam works fine.
User avatar
zeiz
Member
 
Posts: 691
Joined: 19 Nov 2008, 18:36
Location: Canada

Postby Chuchubi » 23 Jun 2010, 16:29

lme@ wrote:Chuchubi: Do you plan to create some PRs with the patches, so they get into the ports collection?


I would like to create the ports but I have to do a lot of reading and that may take some time. My experience with writing a port from scratch is very little at the moment. I have edited and upgraded some existing ports that were left alone by the maintainers. That is why any help is welcome. If you want to help I will send you the patches. Just let me know.
Chuchubi
Junior Member
 
Posts: 30
Joined: 24 May 2010, 03:56

Postby lme@ » 25 Jun 2010, 12:38

Chuchubi wrote:I would like to create the ports but I have to do a lot of reading and that may take some time. My experience with writing a port from scratch is very little at the moment. I have edited and upgraded some existing ports that were left alone by the maintainers. That is why any help is welcome. If you want to help I will send you the patches. Just let me know.


Great, just send me your patches and I'll take a look at it.
User avatar
lme@
 
Posts: 611
Joined: 08 Oct 2007, 19:42
Location: Düsseldorf, Germany

patches

Postby Chuchubi » 25 Jun 2010, 16:53

lme@ wrote:Great, just send me your patches and I'll take a look at it.


I will send you the patches this weekend. Thanks!
Chuchubi
Junior Member
 
Posts: 30
Joined: 24 May 2010, 03:56

Postby lme@ » 30 Jun 2010, 06:54

Sorry, I haven't found the time to take a look at it... :(
You can also send them to multimedia@freebsd.org so a lot of people can see it.
User avatar
lme@
 
Posts: 611
Joined: 08 Oct 2007, 19:42
Location: Düsseldorf, Germany

Next

Return to Porting New Software

Who is online

Users browsing this forum: No registered users and 0 guests