Cant set up webcam

Forum for questions and support relating to the 1.24.x releases only.
Londoner
Posts: 9
Joined: Sun Sep 11, 2011 3:47 am

Cant set up webcam

Post by Londoner »

Hi there folks,
I am wondering if you can help me. I did try following the instructions on the troubleshooting page but I seem to be at a dead end.
I have managed to set up zoneminder on xubuntu 11.04 and installed zoneminder version v1.24.2 from launchpad.
I am not quite sure how to set up my camera on zoneminder. Running zmu -q -d /dev/video0 -v shows the following.

Code: Select all

root@ubuntu:/# zmu -q -d /dev/video0 -v
Video Device: /dev/video0
General Capabilities
  Driver: uvcvideo
  Card: UVC Camera (046d:08c1)
  Bus: usb-0000:00:11.3-1
  Version: 1.0.0
  Type: 0x4000001
    Supports video capture (X)
    Does not support video output
    Does not support frame buffer overlay
    Does not support VBI capture
    Does not support VBI output
    Does not support sliced VBI capture
    Does not support sliced VBI output
    Does not support video output overlay
    Does not have tuner
    Does not have audio in and/or out
    Does not have radio
    Does not support read/write i/o (X)
    Does not support async i/o
    Supports streaming i/o (X)
    Standards:
  Formats:
    MJPEG (MJPG)
Crop Capabilities
  Bounds: 864 x 480
  Default: 864 x 480
  Current: Cropping is not supported
Inputs: 1
  Input 0
    Name: Camera 1
    Type: Camera
    Audioset: 00000000
    Standards: 0x0
    Power on  (X)
    Signal detected  (X)
    Colour Signal detected
    Horizontal Lock detected
bb99
Posts: 943
Joined: Wed Apr 02, 2008 12:04 am

Re: Cant set up webcam

Post by bb99 »

What source tab settings are you using?
Londoner
Posts: 9
Joined: Sun Sep 11, 2011 3:47 am

Re: Cant set up webcam

Post by Londoner »

I was wondering if you could help me with that actually

Device path: /dev/video0
Method V4L2 (cant get it to work on V4L1 either)
Channel 0
Format: Pal
Palette:YUYV, did also try jpeg
Width:864, Height:480
(also tried 640 x480)

The camera seems to work ok on xawtv and cheese on both usb 1.1 and the usb 2.0 ports (usb pci expansion card, supports higher res on 2.0) on this ancient 1ghz AMD athlon.
bb99
Posts: 943
Joined: Wed Apr 02, 2008 12:04 am

Re: Cant set up webcam

Post by bb99 »

First thing is to check your shared memory settings in /etc/sysctl.conf. The default value will not support the resolution you're trying. I generally recommend doubling shmmax. Post back...
Londoner
Posts: 9
Joined: Sun Sep 11, 2011 3:47 am

Re: Cant set up webcam

Post by Londoner »

/etc/sysctl.conf seems to be all commented out. I'll paste it anyway (as im rather new to linux)

pastebin(dot)com/ vELtTQPF
bb99
Posts: 943
Joined: Wed Apr 02, 2008 12:04 am

Re: Cant set up webcam

Post by bb99 »

It's possible you're using mmap and not shared at all. (http://www.zoneminder.com/wiki/index.ph ... esolutions), have a look. From the wiki:
Or if your distribution has the /etc/sysctl.d/ folder you can create a file in this folder without modifying the /etc/sysctl.d so you won't lose the changes during distro upgrades :-

echo kernel.shmmax = 536870912> /etc/sysctl.d/60-kernel-shm.conf

To load these settings in the sysctl.conf file type:

sysctl -p

To check your shared memory settings type:

ipcs -l

Note that with Megapixel cameras like the Axis 207mw becoming cheaper and more attractive, the above memory settings are not adequate. To get Zoneminder working with a full 1280x1024 resolution camera in full color, increase 134217728 (128 MB) to, for example, 268435456 (256 MB) and multiple this value by each camera.

These changes will now also be set the next time your machine is restarted.

Versions 1.24.x of ZoneMinder also allows you to use an alternate method of shared memory allocation, mapped memory. This requires less configuration and can be simpler to use. Mapped memory allows you to use a special type of file as the placeholder for your memory and this file is 'mapped' into memory space for easy and fast access.

To enable mapped memory in ZoneMinder you need add add the --enable--mmap=yes switch to your configure line. By default mapped memory files are created in /dev/shm which on most distributions is a dedicated pseudo-partition containing memory formatted as a filesystem. If your system uses a different path then this can be changed in ZoneMinder in Options->paths->PATH_MAP. It uses a filesystem type called tmpfs. If you type 'df' you should see this area and the size of memory it currently allows. It is important that you do not use a disk based filesystem for your memory mapped files as this will cause memory access to be extremely slow. ZoneMinder creates files called .zm.mmap.<monitor id> in the mapped memory filesystem.

Mapped memory is subject to the same limitations in terms of total memory as using more traditional shared memory but does not require any configuration per allocation or chunk. In future versions of ZoneMinder this will be the default shared memory storage method.
Londoner
Posts: 9
Joined: Sun Sep 11, 2011 3:47 am

Re: Cant set up webcam

Post by Londoner »

Oh ok, will take a look! Will update very soon.
Attachments
Zoneminder.png
Zoneminder.png (61.78 KiB) Viewed 4396 times
Londoner
Posts: 9
Joined: Sun Sep 11, 2011 3:47 am

Re: Cant set up webcam

Post by Londoner »

also.
This message: ERR [Can't shmget, probably not enough shared memory space free: Invalid argument]
in the syslog appears to be related to the shared memory issue.

Anyways I followed the instructions above (your previous post)

root@ubuntu:~# echo kernel.shmmax = 536870912> /etc/sysctl.d/60-kernel-shm.conf
-bash: 536870912: Bad file descriptor
root@ubuntu:~# echo kernel.shmmax = 536870912 > /etc/sysctl.d/60-kernel-shm.conf
root@ubuntu:~# nano /etc/sysctl.d/60-kernel-shm.conf
root@ubuntu:~# sysctl -p
root@ubuntu:~# ipcs -l

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 32768
max total shared memory (kbytes) = 8388608
min seg size (bytes) = 1

------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 32767

------ Messages: Limits --------
max queues system wide = 903
max size of message (bytes) = 8192
default max size of queue (bytes) = 16384

Now rebooting...
Londoner
Posts: 9
Joined: Sun Sep 11, 2011 3:47 am

Re: Cant set up webcam

Post by Londoner »

Ok, quite a few zoneminder related messages in my syslog (rebooted at 21:43) , not sure if it means anything, dumping none the less

Code: Select all

[size=85]Sep 11 21:45:17 ubuntu zmdc[1323]: INF ['zmc -d /dev/video0' starting at 11/09/11 21:45:17, pid = 1445]
Sep 11 21:45:17 ubuntu zmdc[1445]: INF ['zmc -d /dev/video0' started at 11/09/11 21:45:17]
Sep 11 21:45:17 ubuntu zmc_dvideo0[1445]: INF [Debug Level = 0, Debug Log = <none>]
Sep 11 21:45:17 ubuntu zmc_dvideo0[1445]: ERR [Can't shmget, probably not enough shared memory space free: Invalid argument]
Sep 11 21:45:17 ubuntu zmdc[1323]: ERR ['zmc -d /dev/video0' exited abnormally, exit status 255]
Sep 11 21:45:17 ubuntu zmdc[1323]: INF [Starting pending process, zmc -d /dev/video0]
Sep 11 21:45:17 ubuntu zmdc[1323]: INF ['zmc -d /dev/video0' starting at 11/09/11 21:45:17, pid = 1448]
Sep 11 21:45:17 ubuntu zmdc[1448]: INF ['zmc -d /dev/video0' started at 11/09/11 21:45:17]
Sep 11 21:45:17 ubuntu zmc_dvideo0[1448]: INF [Debug Level = 0, Debug Log = <none>]
Sep 11 21:45:17 ubuntu zmc_dvideo0[1448]: ERR [Can't shmget, probably not enough shared memory space free: Invalid argument]
Sep 11 21:45:17 ubuntu zmdc[1323]: ERR ['zmc -d /dev/video0' exited abnormally, exit status 255]
Sep 11 21:45:17 ubuntu gdm-simple-greeter[1330]: WARNING: Unable to load CK history: no seat-id found
Sep 11 21:45:18 ubuntu zmdc[1323]: INF ['zmfilter.pl' starting at 11/09/11 21:45:18, pid = 1454]
Sep 11 21:45:18 ubuntu zmdc[1454]: INF ['zmfilter.pl' started at 11/09/11 21:45:18]
Sep 11 21:45:19 ubuntu zmdc[1323]: INF ['zmaudit.pl -c' starting at 11/09/11 21:45:19, pid = 1458]
Sep 11 21:45:19 ubuntu zmdc[1458]: INF ['zmaudit.pl -c' started at 11/09/11 21:45:19]
Sep 11 21:45:20 ubuntu kernel: [   50.352064] wlan0: no IPv6 routers present
Sep 11 21:45:20 ubuntu zmfilter[1454]: INF [Scanning for events]
Sep 11 21:45:20 ubuntu zmdc[1323]: INF ['zmwatch.pl' starting at 11/09/11 21:45:20, pid = 1461]
Sep 11 21:45:20 ubuntu zmdc[1461]: INF ['zmwatch.pl' started at 11/09/11 21:45:20]
Sep 11 21:45:20 ubuntu init: plymouth-stop pre-start process (1483) terminated with status 1
Sep 11 21:45:21 ubuntu zmwatch[1461]: INF [Watchdog starting]
Sep 11 21:45:21 ubuntu zmwatch[1461]: INF [Watchdog pausing for 30 seconds]
Sep 11 21:45:22 ubuntu zmdc[1323]: INF [Starting pending process, zmc -d /dev/video0]
Sep 11 21:45:22 ubuntu zmdc[1323]: INF ['zmc -d /dev/video0' starting at 11/09/11 21:45:22, pid = 1486]
Sep 11 21:45:22 ubuntu zmdc[1486]: INF ['zmc -d /dev/video0' started at 11/09/11 21:45:22]
Sep 11 21:45:22 ubuntu zmc_dvideo0[1486]: INF [Debug Level = 0, Debug Log = <none>]
Sep 11 21:45:22 ubuntu zmc_dvideo0[1486]: ERR [Can't shmget, probably not enough shared memory space free: Invalid argument]
Sep 11 21:45:22 ubuntu zmdc[1323]: ERR ['zmc -d /dev/video0' exited abnormally, exit status 255]
Sep 11 21:45:32 ubuntu ntpdate[1278]: step time server 91.189.94.4 offset 2.254010 sec
Sep 11 21:45:32 ubuntu zmdc[1323]: INF [Starting pending process, zmc -d /dev/video0]
Sep 11 21:45:32 ubuntu zmdc[1323]: INF ['zmc -d /dev/video0' starting at 11/09/11 21:45:32, pid = 1488]
Sep 11 21:45:32 ubuntu zmdc[1488]: INF ['zmc -d /dev/video0' started at 11/09/11 21:45:32]
Sep 11 21:45:32 ubuntu zmc_dvideo0[1488]: INF [Debug Level = 0, Debug Log = <none>]
Sep 11 21:45:32 ubuntu zmc_dvideo0[1488]: ERR [Can't shmget, probably not enough shared memory space free: Invalid argument]
Sep 11 21:45:32 ubuntu zmdc[1323]: ERR ['zmc -d /dev/video0' exited abnormally, exit status 255]
Sep 11 21:45:52 ubuntu zmdc[1323]: INF [Starting pending process, zmc -d /dev/video0]
Sep 11 21:45:52 ubuntu zmdc[1323]: INF ['zmc -d /dev/video0' starting at 11/09/11 21:45:52, pid = 1489]
Sep 11 21:45:52 ubuntu zmdc[1489]: INF ['zmc -d /dev/video0' started at 11/09/11 21:45:52]
Sep 11 21:45:52 ubuntu zmc_dvideo0[1489]: INF [Debug Level = 0, Debug Log = <none>]
Sep 11 21:45:52 ubuntu zmc_dvideo0[1489]: ERR [Can't shmget, probably not enough shared memory space free: Invalid argument]
Sep 11 21:45:52 ubuntu zmdc[1323]: ERR ['zmc -d /dev/video0' exited abnormally, exit status 255]
Sep 11 21:45:53 ubuntu zmwatch[1461]: ERR [Can't get shared memory id '7a6d0003', 3: No such file or directory]
Sep 11 21:46:29 ubuntu zmwatch[1461]: last message repeated 3 times
Sep 11 21:46:32 ubuntu zmdc[1323]: INF [Starting pending process, zmc -d /dev/video0]
Sep 11 21:46:32 ubuntu zmdc[1323]: INF ['zmc -d /dev/video0' starting at 11/09/11 21:46:32, pid = 1514]
Sep 11 21:46:32 ubuntu zmdc[1514]: INF ['zmc -d /dev/video0' started at 11/09/11 21:46:32]
Sep 11 21:46:32 ubuntu zmc_dvideo0[1514]: INF [Debug Level = 0, Debug Log = <none>]
Sep 11 21:46:32 ubuntu zmc_dvideo0[1514]: ERR [Can't shmget, probably not enough shared memory space free: Invalid argument]
Sep 11 21:46:32 ubuntu zmdc[1323]: ERR ['zmc -d /dev/video0' exited abnormally, exit status 255]
Sep 11 21:46:33 ubuntu zmwatch[1461]: ERR [Can't get shared memory id '7a6d0003', 3: No such file or directory][/size]
bb99
Posts: 943
Joined: Wed Apr 02, 2008 12:04 am

Re: Cant set up webcam

Post by bb99 »

Nope, you have to add the shared memory values to /etc/sysctl.conf (the commented out file). Link above will give examples; the /etc/sysctl.d/ examples won't apply to you. Be sure to reboot after changes.
Londoner
Posts: 9
Joined: Sun Sep 11, 2011 3:47 am

Re: Cant set up webcam

Post by Londoner »

root@ubuntu:~# nano /etc/sysctl.conf
root@ubuntu:~# sysctl -p
kernel.shmmax = 536870912
root@ubuntu:~# ipcs -l

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 524288
max total shared memory (kbytes) = 8388608
min seg size (bytes) = 1

------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 32767

------ Messages: Limits --------
max queues system wide = 903
max size of message (bytes) = 8192
default max size of queue (bytes) = 16384

root@ubuntu:~#
Londoner
Posts: 9
Joined: Sun Sep 11, 2011 3:47 am

Re: Cant set up webcam

Post by Londoner »

Awesome, it works now! thanks (well the camera is recognised, orange font)
But when i try to stream from it all I see is a black screen. and the words State:idle 0 fps
Londoner
Posts: 9
Joined: Sun Sep 11, 2011 3:47 am

Re: Cant set up webcam

Post by Londoner »

Code: Select all

Sep 12 15:46:43 ubuntu zmwatch[1471]: INF [Watchdog starting]
Sep 12 15:46:43 ubuntu zmwatch[1471]: INF [Watchdog pausing for 30 seconds]
Sep 12 15:49:09 ubuntu zms[1660]: INF [Debug Level = 0, Debug Log = <none>]
Sep 12 15:49:10 ubuntu zms[1660]: ERR [Terminating, last frame sent time 1315838949.830513 secs more than maximum of 10.000000]
Sep 12 15:50:18 ubuntu zmu[1666]: WAR [Timed out waiting to get brightness]
Sep 12 15:50:19 ubuntu zmu[1666]: WAR [Timed out waiting to get contrast]
Sep 12 15:50:20 ubuntu zmu[1666]: WAR [Timed out waiting to get hue]
Sep 12 15:50:21 ubuntu zmu[1666]: WAR [Timed out waiting to get colour]
Sep 12 15:50:22 ubuntu zmu[1670]: WAR [Timed out waiting to get brightness]
Sep 12 15:50:23 ubuntu zmu[1670]: WAR [Timed out waiting to get contrast]
Sep 12 15:50:24 ubuntu zmu[1670]: WAR [Timed out waiting to get hue]
Sep 12 15:50:25 ubuntu zmu[1670]: WAR [Timed out waiting to get colour]
Sep 12 15:50:38 ubuntu zms[1686]: INF [Debug Level = 0, Debug Log = <none>]
Sep 12 15:50:39 ubuntu zms[1686]: ERR [Terminating, last frame sent time 1315839038.921492 secs more than maximum of 10.000000]
Sep 12 15:50:55 ubuntu zms[1687]: INF [Debug Level = 0, Debug Log = <none>]
Sep 12 15:50:55 ubuntu zms[1687]: ERR [Terminating, last frame sent time 1315839055.388710 secs more than maximum of 10.000000]
Sep 12 15:51:24 ubuntu zmu[1690]: ERR [Failed to set video input 0: Device or resource busy]
Sep 12 15:51:24 ubuntu zmu[1693]: ERR [Failed to set video input 0: Device or resource busy]
Sep 12 15:52:02 ubuntu zmfix[1696]: ERR [Can't chmod /dev/video0 to 20666: Operation not permitted]
Sep 12 15:52:03 ubuntu zmdc[1407]: INF ['zmc -d /dev/video0' stopping at 11/09/12 15:52:03]
Sep 12 15:52:03 ubuntu zmc_dvideo0[1456]: INF [Got signal 15 (Terminated), exiting]
Sep 12 15:52:09 ubuntu zmdc[1407]: INF ['zmc -d /dev/video0' crashed, signal 8]
Sep 12 15:52:09 ubuntu zmdc[1407]: INF ['zmc -d /dev/video0' starting at 11/09/12 15:52:09, pid = 1703]
Sep 12 15:52:09 ubuntu zmdc[1703]: INF ['zmc -d /dev/video0' started at 11/09/12 15:52:09]
Sep 12 15:52:09 ubuntu zmc_dvideo0[1703]: INF [Debug Level = 0, Debug Log = <none>]
Sep 12 15:52:10 ubuntu zmc_dvideo0[1703]: INF [Starting Capture]
Sep 12 15:52:10 ubuntu zmc_dvideo0[1703]: WAR [Hue control is not supported]
Sep 12 15:52:10 ubuntu zmdc[1407]: WAR [Can't find process with command of 'zma -m 3']
Sep 12 15:52:11 ubuntu kernel: [  383.372840] uvcvideo: Non-zero status (-32) in status completion handler.
Sep 12 15:52:18 ubuntu zmu[1718]: WAR [Timed out waiting to get brightness]
Sep 12 15:52:19 ubuntu zmu[1718]: WAR [Timed out waiting to get contrast]
Sep 12 15:52:20 ubuntu zmu[1718]: WAR [Timed out waiting to get hue]
Sep 12 15:52:21 ubuntu zmu[1718]: WAR [Timed out waiting to get colour]
Sep 12 15:52:22 ubuntu zmu[1720]: WAR [Timed out waiting to get brightness]
Sep 12 15:52:23 ubuntu zmu[1720]: WAR [Timed out waiting to get contrast]
Sep 12 15:52:24 ubuntu zmu[1720]: WAR [Timed out waiting to get hue]
Sep 12 15:52:25 ubuntu zmu[1720]: WAR [Timed out waiting to get colour]
Sep 12 15:54:24 ubuntu zms[1758]: INF [Debug Level = 0, Debug Log = <none>]
Sep 12 15:54:39 ubuntu zms[1764]: INF [Debug Level = 0, Debug Log = <none>]
dacroz
Posts: 2
Joined: Sun Sep 11, 2011 7:36 pm

Re: Cant set up webcam

Post by dacroz »

I've been following this thread with interest, having the same problem as Londoner. I'm also running zoneminder v1.24.2 on Ubuntu 11.04 desktop with the same result: Zoneminder can't see the camera. Zoneminder seems to be installed ok (I can see the console), and uvcvideo and the camera seem to be working ok (other apps, like cheese can see it). I set the resolution to 320 x 288, added the lines

Code: Select all

kernel.shmall = 134217728
kernel.shmmax = 134217728 
to the bottom of /etc/sysctl.conf

But when I enter sudo sysctl -p, I get:

Code: Select all

error: "kernel shmall" is an unknown key
error: "kernel shmmax" is an unknown key
So I thought I'd try the mapped memory version instead.
To enable mapped memory in ZoneMinder you need add add the --enable--mmap=yes switch to your configure line. By default mapped memory files are created in /dev/shm which on most distributions is a dedicated pseudo-partition containing memory formatted as a filesystem. If your system uses a different path then this can be changed in ZoneMinder in Options->paths->PATH_MAP. It uses a filesystem type called tmpfs. If you type 'df' you should see this area and the size of memory it currently allows. It is important that you do not use a disk based filesystem for your memory mapped files as this will cause memory access to be extremely slow. ZoneMinder creates files called .zm.mmap.<monitor id> in the mapped memory filesystem.
Can you please expand on the highlighted line? What configure line would this be? What config file?
bb99
Posts: 943
Joined: Wed Apr 02, 2008 12:04 am

Re: Cant set up webcam

Post by bb99 »

Londoner: Your issue now is to find the correct palette and/or resolution. Be patient as after each change ZM has to burn through the warm up frames again; can take allot of time.
Locked