[EDIT] You can now find a major upgrade to the current 3.2.8 version of Motion Video Surveillance as a dotpet at my main thread for that application at http://www.murga-linux.com/puppy/viewtopic.php?t=21518

[ Please also refer to the new Puppy Linux Wiki page on the Motion Video Surveillance project at:
http://puppylinux.org/wikka/Motion ]

Also, I've just discovered a nice article on setting up Motion and webcams in general by Mark Alexander Bain entitled "CLI Magic: Getting into Motion" at http://www.linux.com/articles/114118
Well worth a look.
--------------------------------------------------------------------------

Okay, here was my problem:

I have a couple of cheap webcams that I wanted to get working in the latest Puppy Linux (version 2.17r1). The one I've now managed to get working on puppy linux is described on its package as a "Matrix PC Camera: with magic bar flexible [usb] cable". The "windows" driver disc contains a file Topro53.inf which provided further details: CompanyName=Topro; VendorID=04fc; ProductID=0561. With this info in hand, I searched the forums and came across NickBiker's camwizard utility and Puppy webcam Guide at:
http://www.moyo.me.uk/pupplinux. However, his camwizard currently, it seems, only works with some earlier Puppy Linux distributions because the webcam driver modules it provides haven't yet been recompiled for use with the Linux kernel used in the latest Puppy distribution. ... Nevertheless, much of the information NickBiker and others provide in their earlier forum posts remain very useful in manually getting webcams to work. However, these posts are scattered all over the place on the forum, so I found it very difficult and timeconsuming to piece it all together. What I've simply done here, therefore, is to collect together the most pertinent parts of these posts, which provided all the information I needed to get my own webcam going!

For simplicity, I am concentrating on the webcam driver module called gspca.ko, because that turned out to be the module I needed for my Matrix webcam (I am still to determine the module I require for my other webcam!). Fortunately, the gspca module is used by quite a large number of webcams, so you may be lucky! Much of the following info is relevant in any case.

Once I located a copy of gspca.ko compiled for the kernel used in Puppy Linux 2.17r1 (from forum member vabene06 in this case), I downloaded xawtv (from NickBiker's site) for viewing the webcam's output. It turns out that mplayer can be used as an alternative webcam viewer if you wish.

You can download vabene06's gspca compilation in his pet package gspcav1-20070508-i586.pet from: http://www.murga-linux.com/puppy/viewtopic.php?mode=attach&id=5467

As vabene06 says, all you actually need is the one file called gspca.ko which should be copied into /lib/modules/2.6.21.5/kernel/drivers/usb/media. The pet package above, supplied by vabene06, creates that directory, if it doesn't exist, and automatically now puts gspca.ko into it.

Before proceeding, it is probably a good idea to check after installing vabene06's pet package for gpsca that you now have a copy of gspca.ko in
/lib/modules/2.6.21.5/kernel/drivers/usb/media

[thanks, vabene06 for that]

It then needs to be loaded up with the commands:

depmod -a
modprobe videodev
modprobe gspca

All going well, you should now be able to see the output of your webcam by starting the xawtv application using the commandline:

xawtv -noxv -nodga

[also thanks, NickBiker for that][right-click on xawtv window to get controls for adjusting contrast and brilliance etc].

[in practice, I actually just needed to enter: xawtv -noxv]

Alternatively, you should be able to view the webcam output using mplayer by entering the command:

mplayer tv:// -tv driver=v4l:width=352:height=288:device=/dev/video0

[thanks, MU for that]

You can alternatively call up the gui version of mplayer by entering:
gmplayer tv:// -tv driver=v4l:width=352:height=288:device=/dev/video0

Though the above mplayer commands worked for me, the image displayed was too bright with not enough contrast; I originally obtained a much better picture with xawtv. However, I since found tons of options (commandline and interactive) for mplayer at its man page: http://www.mplayerhq.hu/DOCS/man/en/mplayer.1.html

In fact, the man page information below allowed me to get an even better image than I have so far achieved with xawtv:

(The following keys are valid only when using a hardware accelerated video output (xv, (x)vidix, (x)mga, etc), the software equalizer (−vf eq or −vf eq2) or hue filter (−vf hue).)

Using the above keys I obtained a good webcam picture by gradually reducing the contrast (i.e. pressing key 1) until the onscreen bar indicated a contrast of around 20 percent. Then I adjusted the brightness (keys 3 and 4) and saturation (keys 7 and 8 ). Unfortunately contrast key 2 didn't do anything so it was tricky getting the contrast right (do it slowly... and restart if necessary. I found that the webcam image suddently got much better when I reduced the contrast even lower than what appeared at first to be the optimum). The above man page also details many other commandline options such as -brightness and -contrast, but they didn't seem to do anything on my system. If you find how to set up all these setting permanently in mplayer please let me know.

Note: if your webcam needs a different driver module than the gspca one then you'll have to "somewhere or other" find a version of the module you require which has been compiled for use with whatever kernel version is in your Puppy linux distribution. Try searching the forum, or google... Perhaps NickBiker is working on producing webcam driver modules for the latest puppy kernel? Alternatively, though far from trivial, get the source code for whatever webcam driver module you discover you need and compile it yourself like vabene06 has done for the gspca one. For webcam driver xxxxx.ko you would then replace the above line modprobe gspca with modprobe xxxxx. Sorry I can't help you more with this.

For more detail and further help with your webcam please refer to the forum thread extracts below, which include the link to the relevant post threads. Though I'm not commenting further on the matter here, I've also included extracts from some excellent threads, including an excellent howto by doopdoop, relating to getting TV cards working under Puppy Linux because they explain a great deal about mplayer usage and multimedia configuration in general. [thanks doopdoop, and also GuestToo for all the excellent details regarding mplayer]. I really hope someone will find time to write this kind of stuff up more coherently and put it in the Wiki for more permanence.

VIDEO SURVEILLANCE USING MOTION DETECTION SOFTWARE
-----
Note well: I've now created a .pet package for the following "motion video surveillance application", so you no longer need to install it manually in the way described below. However, I've left the information below for your interest. The new .pet installs motion into the appropriate directories mentioned, registers the application with the pet package management system so you can uninstall it later if you wish, and adds an icon and menu item, in Multimedia, to the JWM desktop Menu. All going well, you can download the file, motion-3.1.19.pet, and read more about it from forum thread: http://www.murga-linux.com/puppy/viewtopic.php?p=139242#139242
Update: file now also available from:
http://dotpups.de/dotpups/Multimedia/MotionVideoSurveillance/
-----

Once you have verified using xawtv or mplayer that your webcam is working okay you might like to try out a nice video surveillance piece of software called "Motion". You can download a pre-compiled version of motion, that works fine with Puppy 2.17, as a tar.gz package from the Damn Small Linux archive:

You can decompress this archive anywhere. Doing so creates two subdirectories: home and opt. The easiest way to get this version of motion working correctly is simply to copy the contents of these folders into /home and /opt respectively [in fact, if you don't currently have a /home or /opt directory on your system simply decompress motion.tar.gz in / and that will cause /home and /opt to be created under there]. So that the motion program can find its configuration file (motion.conf) you should start the program whilst in the directory where motion.conf is stored (i.e. home/dsl). Since that configuration file tells motion where to store its jpeg image captures, be careful with this or you might find lots of jpegs being stored where you don't want them to be! Hence, to start motion running open an rxvt console window and enter the commands:

cd /home/dsl
/opt/motion/motion

[the above assumes that motion.conf is stored in /home/dsl]

You won't actually see anything being displayed (indeed you don't even need the X Windows system running...) because motion simply works in the background storing jpeg images of any motion it detects in front of your webcam or video source. When I tried it, the jpegs were stored in the folder /home/dsl/motion/pics; You can change that location by editing motion.conf so that the line starting with target_dir points to whatever directory you want to store the captured jpegs in. Note that motion stores a new date-stamped jpeg every time it is triggered by something changing in front of the webcam, so watch you don't fill up your disc!!! You can stop the motion program by pressing Ctrl-C when in the rxvt console window you ran it from. Alternatively, enter the command: top
Then you should see that motion is running, and "top" will show its process id. You can then stop motion running by entering the command: kill <whatever its process id is>. For much more information about "motion", and how to understand and alter its setup configuration file (motion.conf) refer to its homepage wiki at: http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome
For example, edit motion.conf and change minimum_gap 5 to minimum_gap 0 [this is in seconds] and motion will react more rapidly to movements (and thus create more jpegs!).

Summary for getting motion working:
-----------
1. make sure your webcam is working okay already (with xawtv or whatever webcam app you test it with)
2. download the tar.gz of motion from DSL at:
http://distro.ibiblio.org/pub/linux/distributions/damnsmall/mydsl/multimedia/motion.tar.gz
3. decompress that tar.gz archive into your system root directory / (which will automatically create the directories /opt and /home if they don't already exist).
4. Finally, run motion by opening an rxvt console window and entering the following two commands:
cd /home/dsl
/opt/motion/motion
5. Ctrl-C to stop motion running (or kill the process id discovered with top or ps).
After doing the above you should find the captured jpeg images in directory /home/dsl/motion/pics
-----------------------------------------------------------------
A sophisticated example of "motion" being used can be viewed at: http://www.lavrsen.dk/webcam/
Note that the above DSL compilation of motion does not use or require any mysql database; a more sophisticated compilation would. Once you've whetted your appetite with this simple version of motion, however, you might want to try compiling a more complete version yourself. Alternatively, you might like to try "Zoneminder" (http://www.zoneminder.com/). Though zoneminder is otherwise notoriously difficult to setup, thanks to hushpuppy you can find a specially made iso distribution of Puppy nicknamed "Watchdog" which comes with an all-singing, all-dancing configuration of zoneminder ready to go out of the box! You can find it via the Watchdog Wika page: http://puppylinux.org/wikka/WatchDog
I haven't tried it myself yet, but I imagine it will be great!

That's all I have to say really...

Thread extracts follow:
-------------

In forum thread http://www.murga-linux.com/puppy/viewtopic.php?t=20268
vabene06 (PostPosted: Sun Jul 29, 2007 7:11 am Post subject: gspca-driver) wrote: Hey, i compiled the gspca-driver for puppy 2.17. I have problems with installing it (insmod), but at least the driver works for my webcam. Try it.

In forum thread http://www.murga-linux.com/puppy/viewtopic.php?t=20268
MU (Posted: Mon Sept 3, at 1:48 am) wrote:
if you have mplayer installed, you also can use that to watch the webcam:
mplayer tv:// -tv driver=v4l:width=352:height=288:device=/dev/video0
----------

In forum post http://www.murga-linux.com/puppy/viewtopic.php?t=7543
>NickBiker (Posted: Wed Apr 26, 2006 5:38 am) said:
You can run xawtv as
Code:
xawtv -nodga
. . . I found on my pc I had to use the -noxv option to get it to work - as I do not think xawtv probes the video hardware properly! <
----------

In forum post http://www.murga-linux.com/puppy/viewtopic.php?t=7543
>>NickBiker (Posted: Fri Apr 21, 2006 4:07 pm) said:
[So does it now work with the gqcam application?]
What is the output from:
Code:
cat /proc/bus/usb/devices
. . .
Did you check,
cat /var/log/messages
and find if there were any messages from the qcam driver? <<
-----
In forum post http://www.murga-linux.com/puppy/viewtopic.php?t=7543
>>>NickBiker (Posted: Fri Apr 21, 2006 4:14 pm) said:
re: ilia_kv comment: Image quality is not as good as under Windows XP. A lot of control settings are missing.
. . .
I have added a section on changing the quality settings at on my guide.
There is now a small utility called 'qset' included in the downloads - hope that helps?<<<
----

In forum thread http://www.murga-linux.com/puppy/viewtopic.php?t=7543&start=30&sid=4bde314d5772f054b2e2eb32a3f579b0
NickBiker wrote (Posted: Tue May 16, 2006 11:30 am)
I will put the utility "lsusb" on my site to download later, you can then use:

>>>>On forum http://www.murga-linux.com/puppy/viewtopic.php?p=7394#7394
doopdoop wrote:
PostPosted: Mon Jul 25, 2005 3:38 pm Post subject: HOWTO: watch TV with mplayer
[extract only; use the link above to doopdoop's howto for more detail]
This is a quick and dirty way to watch TV on an analog TV Card based on the Brooktree chipset (like Hauppauge Win TV or else).
[steps] . . . copy the modules in the right location and register them
. . .
depmod -a
. . .
Load the driver for the TV card and the tuner

Code:
modprobe tuner
modprobe bttv
. . .
This needs to be repeated every time you boot. So, put these commands into /etc/rc.d/rc.local
. . .
Check your sucess by looking at the kernel messages
Code:

Adapt the settings to your local conditions, e.g. norm=ntsc or chanlist=us-cable. See Mplayer docs (http://www.mplayerhq.hu) for more on this.
. . .
Use the keys h and k to switch channels, f for fullscreen and q for quit. If you are lucky, you can control the volume with the keys 0 and 9. . . .
Actually, you do need only a small portion of the drivers, namely the ones in media/video and i2c, and you dont even need all of them. It should be about 200k or even less. <<<<
----------

is all on one line ... there is a space between chanlist=japan-bcast and tv:// ... note: it is tv:// not tv//

keys:
h, k - change channels
f - full screen
q - quit
. . .
you can plug the audio out jack on your tv card into the line in jack on your audio card ... adjust the volume of the line in jack with the mixer ... some tv cards work this way

i think your card can send audio directly over the pci bus ... you need to add mplayer options something like this:

for the oss driver:
immediatemode=0:adevice=/dev/dsp1:amode=1

for the alsa driver:
immediatemode=0:alsa:adevice=hw.1,0:audiorate=32000:amode=1

Also, I went to the mplayer homepage to try to understand the command line better. My understanding from that page was that I could manipulate/override keybindings through a configuration file "-input.conf" At the path: /root/.mplayer I found the files. The exact wording from mplayerhq is:

MPlayer allows you bind any key/button to any Mplayer command using a simple config file. The syntax consist of a key name followed by a command. The default config file location is $HOME/.mplayer/input.conf but it can be overridden using the -input conf option (relative path are relative to $HOME/.mplayer).
-----------

because i didn't want to interfere with using the mouse wheel to seek in a movie, i created a file called /root/.mplayer/inputtv.conf with that configuration, and another file configured for movies called /root/.mplayer/input00.conf, and i start mplayer to watch tv something like this:

i don't know why, but each movement of my mouse wheel is like 2 clicks of a mouse button, so it changes 2 channels at a time ... i worked around the problem by duplicating the channel numbers ... single channel numbers might look like this:

vabene06 has now posted a new version of his pet package which, as indicated in my redrafted howto above, now automatically installs gspca.o into the driver modules directory /lib/modules/2.6.21.5/kernel/drivers/usb/media
The package no longer creates any unnecessary extra files or directories. As indicated in the above howto you can download vabene06's pet package of gspca from: You can download vabene06's gspca compilation in his pet package gspcav1-20070508-i586.pet from: http://www.murga-linux.com/puppy/viewtopic.php?mode=attach&id=5467

I've now edited the above howto to include some information on how to adjust the brightness, contrast and saturation in mplayer. I now get a better webcam image under mplayer than xawtv!

Unfortunately every time I restart mplayer I currently need to re-adjust these settings. If anyone knows how to keep them between restarts (or how to apply them on the commandline) please let me know.

Using the command gmplayer (plus the various commandlien options) rather than mplayer allows one to bring up a video equaliser display by right clicking on the mplayer window. However, the contrast control of that didn't work for me. In practice I prefer using the command mplayer (without the g) since then the number keys produce an onscreen progress bar when adjusting contrast and brightness and so on.

I've also added some additional information to show how to get the video surveillance package motion working with Puppy 2.17.

Just one tiny point: About the 11th paragraph you've inadvertantly added an "e" to the command "depmod". Editing that out might save some people some time consuming head scratching._________________A life! Cool! Where can I download one of those from?

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum