Camera and video surveillance

Camera and video surveillance

Postby mdi » Sat Sep 01, 2012 9:08 am

Hi Guys,
could it be possible to have a video-surveillance server as part of the firmware, so that attaching a cheap camera on the front USB port you could create a home-surveillance system with the NWSP2?

With a smartphone and dynamic-DNS systems, you could control your home from a remote place!! :evilwink
Thanks,
MDI
mdi
Donator VIP
Donator VIP
 
Posts: 193
Joined: Tue Oct 11, 2011 1:20 pm

Re: Camera and video surveillance

Postby fvdw » Sat Sep 01, 2012 10:25 am

yes this is possible and it was one of my wishes too, in fact I did some trials in the past with a program called "motion". This program is still present in the firmware (/usr/bin/motion) including basic config files (see /usr/etc folder). But it never came to implementing it in the webinterface. One of the things was the variety of usb camera's and drivers needed. I compiled a lot as modules. but in that time the firmware only run on the spd8020 and nwsp1 with limited resources and the video processing was too much for the small system memory. On the nwsp2 it should work ok.
I just checked it and it works on the nwsp2. I enabled the basic drivers for usb video in the kernel and I guess pwc based and uvc based webcam drivers should be recognized, but they also might need a specific driver dependnent on the brand used.
Anyhow the kernel I am running it recognized my webcam without a problem (uvc based)
Code: Select all
root@fvdwsl-nwsp2:/ # lsusb -t
1-1:1.2: No such file or directory
1-1:1.3: No such file or directory
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=orion-ehci/1p, 480M
    |__ Port 1: Dev 2, If 0, Class='bInterfaceClass 0x0e not yet handled', Drive                                  r=uvcvideo, 480M
    |__ Port 1: Dev 2, If 1, Class='bInterfaceClass 0x0e not yet handled', Drive                                  r=uvcvideo, 480M
    |__ Port 1: Dev 2, If 2, Class=audio, Driver=, 480M
    |__ Port 1: Dev 2, If 3, Class=audio, Driver=, 480M

And then fired up motion by just using the command
Code: Select all
motion
on the command line after accessing it via ssh.
It gave some remarks about unknown options but the daemon loaded
Code: Select all
root@fvdwsl-nwsp2:/ # motion
[0] Processing thread 0 - config file /usr/etc/motion.conf
[0] Unknown config option "ffmpeg_cap_new"
[0] Unknown config option "ffmpeg_cap_motion"
[0] Unknown config option "ffmpeg_timelapse"
[0] Unknown config option "ffmpeg_timelapse_mode"
[0] Unknown config option "ffmpeg_bps"
[0] Unknown config option "ffmpeg_variable_bitrate"
[0] Unknown config option "ffmpeg_video_codec"
[0] Unknown config option "ffmpeg_deinterlace"
[0] Unknown config option "movie_filename"
[0] Unknown config option "timelapse_filename"
[0] Unknown config option "sql_log_image"
[0] Unknown config option "sql_log_snapshot"
[0] Unknown config option "sql_log_mpeg"
[0] Unknown config option "sql_log_timelapse"
[0] Unknown config option "sql_query"
[0] Motion 3.2.11 Started
[0] Motion going to daemon mode
root@fvdwsl-nwsp2:/ #

and I could connect to it using my browser and the address http://ip-nas:8081 and got a picture
motion.JPG


so if your usb camera is detected by the system nothing can stop you to develop the video surveillance :whistle
Ps if you are going to store pictures or video, be sure not to do that in the system partition as that is limited in space , create use a shared folder for that (/share/1000/name-of-shared-folder). That makes it also easier to access and view the pictures

ps I am using the kernel to be used in fvdw-sl-13-0, this kernel is more sophisticated then the one currently used by 12-1 but the usb video settings at compile them were the same.
Code: Select all
CONFIG_V4L_USB_DRIVERS=y
CONFIG_USB_VIDEO_CLASS=y
CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y
CONFIG_USB_GSPCA=m
CONFIG_USB_M5602=m
CONFIG_USB_STV06XX=m
CONFIG_USB_GL860=m
CONFIG_USB_GSPCA_BENQ=m
CONFIG_USB_GSPCA_CONEX=m
CONFIG_USB_GSPCA_CPIA1=m
CONFIG_USB_GSPCA_ETOMS=m
CONFIG_USB_GSPCA_FINEPIX=m
CONFIG_USB_GSPCA_JEILINJ=m
CONFIG_USB_GSPCA_KONICA=m
CONFIG_USB_GSPCA_MARS=m
CONFIG_USB_GSPCA_MR97310A=m
CONFIG_USB_GSPCA_NW80X=m
CONFIG_USB_GSPCA_OV519=m
CONFIG_USB_GSPCA_OV534=m
CONFIG_USB_GSPCA_OV534_9=m
CONFIG_USB_GSPCA_PAC207=m
CONFIG_USB_GSPCA_PAC7302=m
CONFIG_USB_GSPCA_PAC7311=m
CONFIG_USB_GSPCA_SN9C2028=m
CONFIG_USB_GSPCA_SN9C20X=m
CONFIG_USB_GSPCA_SONIXB=m
CONFIG_USB_GSPCA_SONIXJ=m
CONFIG_USB_GSPCA_SPCA500=m
CONFIG_USB_GSPCA_SPCA501=m
CONFIG_USB_GSPCA_SPCA505=m
CONFIG_USB_GSPCA_SPCA506=m
CONFIG_USB_GSPCA_SPCA508=m
CONFIG_USB_GSPCA_SPCA561=m
CONFIG_USB_GSPCA_SPCA1528=m
CONFIG_USB_GSPCA_SQ905=m
CONFIG_USB_GSPCA_SQ905C=m
CONFIG_USB_GSPCA_SQ930X=m
CONFIG_USB_GSPCA_STK014=m
CONFIG_USB_GSPCA_STV0680=m
CONFIG_USB_GSPCA_SUNPLUS=m
CONFIG_USB_GSPCA_T613=m
CONFIG_USB_GSPCA_TV8532=m
CONFIG_USB_GSPCA_VC032X=m
CONFIG_USB_GSPCA_VICAM=m
CONFIG_USB_GSPCA_XIRLINK_CIT=m
CONFIG_USB_GSPCA_ZC3XX=m
...more
<snip>

"m" means the driver is compiled as module and need to be loaded.
"y" means it is included in the kernel
With the test above I did not load any usb-video module, the V4L_USB drivers apparently support my usb camera
You do not have the required permissions to view the files attached to this post.
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: Camera and video surveillance

Postby fvdw » Sat Sep 01, 2012 5:13 pm

attached an newe version of the program "motion"
This version 3.2.12 while the one currently in the firmware is version 3.2.11
Also this one has ffmeg support while the old one did not has and causing the ffmeg error messages

unzip the archive and put the file in /usr/bin replacing the one present (be sure that permission are set executable (755)

I testd it on my nwsp2 and also this one works
You do not have the required permissions to view the files attached to this post.
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: Camera and video surveillance

Postby mdi » Sun Sep 09, 2012 3:59 pm

Hi, is there a specific preference of motion over ZoneMinder?
This one also has a web interface.

Thanks,
MDI
mdi
Donator VIP
Donator VIP
 
Posts: 193
Joined: Tue Oct 11, 2011 1:20 pm

Re: Camera and video surveillance

Postby fvdw » Sun Sep 09, 2012 4:39 pm

no, I just tried motion in the past as it is well supported by Linux

When I find some time I will look if zoneMinder can be compiled, but I do not promise anything :mrgreen:
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: Camera and video surveillance

Postby fvdw » Sun Sep 09, 2012 6:32 pm

just had a look at the download page,...zoneminder needs MySql.
So for spd8020, nwsp1 this is a no go. On nwsp2 Mysql should be installed. This is possible as add-on but this makes it more complicated and will take more time

...many dependencies required to get it compiled also in Mysql modules. not likely to get it done quickly
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: Camera and video surveillance

Postby mdi » Sun Sep 09, 2012 7:00 pm

Hi, I tried motion.
I saw from the config file that you can operate via web on the config params.
I allowed the image to be seen on the default port 8081, but I changed the controlling port to 8082. From port 8082 I can change the config params in realtime; there's also online help which redirects to the online Wiki for the motion project :)

BUT:
I cannot see my camera working. It's a cheap one from Trust and the lsusb seems to detect no driver:

Code: Select all
root@nas:/usr/etc # lsusb -t
1-1:1.0: No such file or directory
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=orion-ehci/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=vend., Driver=, 480M


How can I deal with that?

Please notice that my cam works on Mint Linux....:
Code: Select all
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 003: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 003 Device 002: ID 04a9:105c Canon, Inc. S400
Bus 001 Device 009: ID 192f:0416 Avago Technologies, Pte.
[color=#BF0000]Bus 001 Device 010: ID 0c45:624e Microdia PC Camera (SN9C201 + SOI968)[/color]

Code: Select all
lsusb -t
3-1:1.0: No such file or directory
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/8p, 480M


Running V4L2 Test Bench, I can see that my camera works with input sn9c20x (!) and can work with capture image YV12-YV12, among other formats.

Wew! I just found I don't have any /dev/video0 device...!! Stuck.

Thanks,
MDI
mdi
Donator VIP
Donator VIP
 
Posts: 193
Joined: Tue Oct 11, 2011 1:20 pm

Re: Camera and video surveillance

Postby fvdw » Mon Sep 10, 2012 1:13 pm

seems this one needs a driver as it is not an uvc device

after googling I found on this page http://cateee.net/lkddb/web-lkddb/USB_G ... 9C20X.html that your webcam is supported by gspca_sn9c20x kernel module

I attached this driver (kernel module) that you need for this webcam (gspca_sn9c20x)
Unpack the kernel module and put it in /lib/modules/2.6.39.4
In this directory already some modules are present.
be sure to give it executable permissions (755)
To load the driver type at the command line
Code: Select all
depmod
modprobe gspca_sn9c20x

with the command
Code: Select all
lsmod

You can see if it is loaded
Now try again to connect your webcam and see if a driver is loaded

ps /dev/video0 will be created automatically when you attach the usb camera and the driver is loaded
You do not have the required permissions to view the files attached to this post.
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: Camera and video surveillance

Postby mdi » Mon Sep 10, 2012 3:36 pm

There should be something wrong, I've done the following:

Code: Select all
root@nas:/lib/modules/2.6.39.4 # ls -l
total 252
-rwxr-xr-x  1 root root 44700 2011-11-12 00:14 ehci-hcd.ko
-rwxr-xr-x  1 root root 19339 2011-11-12 00:14 fsl_usb2_udc.ko
-rwxr-xr-x  1 root root 33431 2011-11-12 00:14 g_file_storage.ko
-rwxr-xr-x  1 root root 30415 2012-09-10 16:23 gspca_sn9c20x.ko
-rw-r--r--  1 root root 15884 2012-09-10 16:29 modules.dep.bb
-rwxr-xr-x  1 root root 16387 2011-11-12 00:14 usblp.ko
-rwxr-xr-x  1 root root 78169 2011-11-12 00:14 usb-storage.ko
root@nas:/lib/modules/2.6.39.4 # depmod
root@nas:/lib/modules/2.6.39.4 # modprobe gspca_sn9c20x   
modprobe: module 'gspca_main' not found
modprobe: 'gspca_sn9c20x.ko': unknown symbol in module or invalid parameter


Is there anything still missing?

Additional question: would motion and the camera driver be loaded automatically at reboot?

Thanks,
MDI
mdi
Donator VIP
Donator VIP
 
Posts: 193
Joined: Tue Oct 11, 2011 1:20 pm

Re: Camera and video surveillance

Postby fvdw » Mon Sep 10, 2012 4:16 pm

seems you need an additional module, gspca_main.ko

I attached it for you

these modules and motion will not be loaded automatically at boot. For that the boot scripts must be adapted
You do not have the required permissions to view the files attached to this post.
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Next

Return to Lacie Network Space vs2 and max version

Who is online

Users browsing this forum: No registered users and 5 guests