Webcam - motion not working - but video ok on mplayer


26 posts   Page 1 of 2   1, 2
by piglet » Thu Sep 13, 2012 9:15 pm
I read about "motion" being used by someone else on the forum and thought I'd have a try connecting my Logitech Clicksmart 510 webcam.

sudo apt-get update
sudo apt-get install mplayer
mplayer tv:// driver=412:width=640:height=480:device=/dev/video0 -fps 10

Success - video across the screen.

However when I did:

sudo apt-get motion

(edited motion.conf for same resolution as worked above, and format JPEG)

sudo motion -n

couldn't drive the camera (full details of output below).

[1] v4l2_next: VIDIOC_QBUF: Invalid argument
[1] Video device fatal error - Closing video device
[1] Closing video device /dev/video0

Do you have any idea how to get it working? I don't see any error that I understand.

Thanks in advance




Output from successful mplayer:

Code: Select all
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski <olschewski@zpr.uni-koeln.de>
 comment: first try, more to come ;-)
v4l2: your device driver does not support VIDIOC_G_STD ioctl, VIDIOC_G_PARM was used instead.
Selected device: USB Camera (046d:0901)
 Capabilities:  video capture  read/write  streaming
 supported norms:
 inputs: 0 = spca500;
 Current input: 0
 Current format: unknown (0x4745504a)
tv.c: norm_from_string(pal): Bogus norm parameter, setting default.
v4l2: ioctl enum norm failed: Inappropriate ioctl for device
Error: Cannot set norm!
Selected input hasn't got a tuner!
v4l2: ioctl set mute failed: Invalid argument
v4l2: ioctl query control failed: Invalid argument
vo: couldn't open the X11 display ()!
vo: couldn't open the X11 display ()!
vo: couldn't open the X11 display ()!vailable
VO XOverlay need a subdriver
[VO_SDL] Using driver: fbcon.
vo: couldn't open the X11 display ()!
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 53.35.0 (external)
Mismatching header version 53.32.2
Selected video codec: [ffmjpeg] vfm: ffmpeg (FFmpeg MJPEG)
==========================================================================
Audio: no sound
Starting playback...
Movie-Aspect is undefined - no prescaling applied.
VO: [sdl] 640x480 => 640x480 Planar YV12
v4l2: 701 frames successfully processed, 3 frames dropped.


Output from unsuccessful motion:

Code: Select all
[0] Processing thread 0 - config file /etc/motion/motion.conf
[0] Motion 3.2.12 Started
[0] ffmpeg LIBAVCODEC_BUILD 3482368 LIBAVFORMAT_BUILD 3478784
[0] Thread 1 is from /etc/motion/motion.conf
[0] motion-httpd/3.2.12 running, accepting connections
[1] Thread 1 started
[0] motion-httpd: waiting for data on port TCP 8080
[1] cap.driver: "spca500"
[1] cap.card: "USB Camera (046d:0901)"
[1] cap.bus_info: "usb-bcm2708_usb-1.3.1.1"
[1] cap.capabilities=0x05000001
[1] - VIDEO_CAPTURE
[1] - READWRITE
[1] - STREAMING
[1] Test palette JPEG (640x480)
[1] Using palette JPEG (640x480) bytesperlines 640 sizeimage 115790 colorspace 00000007
[1] found control 0x00980900, "Brightness", range 0,255
[1]     "Brightness", default 127, current 127
[1] found control 0x00980901, "Contrast", range 0,63
[1]     "Contrast", default 31, current 31
[1] found control 0x00980902, "Color", range 0,63
[1]     "Color", default 31, current 31
[1] mmap information:
[1] frames=4
[1] 0 length=118784
[1] 1 length=118784
[1] 2 length=118784
[1] 3 length=118784
[1] Using V4L2
[1] Resizing pre_capture buffer to 1 items
[1] v4l2_next: VIDIOC_DQBUF: EIO (s->pframe 0): Input/output error
[1] v4l2_next: VIDIOC_QBUF: Invalid argument
[1] v4l2_next: VIDIOC_QBUF: Invalid argument
[1] v4l2_next: VIDIOC_QBUF: Invalid argument
[1] v4l2_next: VIDIOC_QBUF: Invalid argument
[1] Error capturing first image
[1] Started stream webcam server in port 8081
[1] v4l2_next: VIDIOC_QBUF: Invalid argument
[1] Video device fatal error - Closing video device
[1] Closing video device /dev/video0
[1] Retrying until successful connection with camera
[1] cap.driver: "spca500"
[1] cap.card: "USB Camera (046d:0901)"
[1] cap.bus_info: "usb-bcm2708_usb-1.3.1.1"
[1] cap.capabilities=0x05000001
[1] - VIDEO_CAPTURE
[1] - READWRITE
[1] - STREAMING
[1] Test palette JPEG (640x480)
[1] Using palette JPEG (640x480) bytesperlines 640 sizeimage 115790 colorspace 00000007
[1] found control 0x00980900, "Brightness", range 0,255
[1]     "Brightness", default 127, current 127
[1] found control 0x00980901, "Contrast", range 0,63
[1]     "Contrast", default 31, current 31
[1] found control 0x00980902, "Color", range 0,63
[1]     "Color", default 31, current 31
[1] mmap information:
[1] frames=4
[1] 0 length=118784
[1] 1 length=118784
[1] 2 length=118784
[1] 3 length=118784
[1] Using V4L2

...

[1] v4l2_next: VIDIOC_DQBUF: EIO (s->pframe 0): Input/output error
[1] v4l2_next: VIDIOC_QBUF: Invalid argument
[1] Video device fatal error - Closing video device
[1] Closing video device /dev/video0
[1] Video signal lost - Adding grey image
[1] Retrying until successful connection with camera
[1] cap.driver: "spca500"
[1] cap.card: "USB Camera (046d:0901)"
[1] cap.bus_info: "usb-bcm2708_usb-1.3.1.1"
[1] cap.capabilities=0x05000001
[1] - VIDEO_CAPTURE
[1] - READWRITE
[1] - STREAMING
[1] Test palette JPEG (640x480)
[1] Using palette JPEG (640x480) bytesperlines 640 sizeimage 115790 colorspace 00000007
[1] found control 0x00980900, "Brightness", range 0,255
[1]     "Brightness", default 127, current 127
[1] found control 0x00980901, "Contrast", range 0,63
[1]     "Contrast", default 31, current 31
[1] found control 0x00980902, "Color", range 0,63
[1]     "Color", default 31, current 31
[1] mmap information:
[1] frames=4
[1] 0 length=118784
[1] 1 length=118784
[1] 2 length=118784
[1] 3 length=118784
[1] Using V4L2
[1] v4l2_next: VIDIOC_DQBUF: EIO (s->pframe 0): Input/output error
[1] v4l2_next: VIDIOC_QBUF: Invalid argument
[1] Video device fatal error - Closing video device
[1] Closing video device /dev/video0
[1] Retrying until successful connection with camera
[1] cap.driver: "spca500"
[1] cap.card: "USB Camera (046d:0901)"
[1] cap.bus_info: "usb-bcm2708_usb-1.3.1.1"
[1] cap.capabilities=0x05000001
[1] - VIDEO_CAPTURE
[1] - READWRITE
[1] - STREAMING
[1] Test palette JPEG (640x480)
[1] Using palette JPEG (640x480) bytesperlines 640 sizeimage 115790 colorspace 00000007
[1] found control 0x00980900, "Brightness", range 0,255
[1]     "Brightness", default 127, current 127
[1] found control 0x00980901, "Contrast", range 0,63
[1]     "Contrast", default 31, current 31
[1] found control 0x00980902, "Color", range 0,63
[1]     "Color", default 31, current 31
[1] mmap information:
[1] frames=4
[1] 0 length=118784
[1] 1 length=118784
[1] 2 length=118784
[1] 3 length=118784
[1] Using V4L2
pi@raspberrypi ~/bin $
User avatar
Posts: 724
Joined: Sat Aug 27, 2011 1:16 pm
by piglet » Sun Sep 16, 2012 10:03 pm
I guess nobody knows :(
User avatar
Posts: 724
Joined: Sat Aug 27, 2011 1:16 pm
by Bencom » Tue Sep 18, 2012 12:32 am
I do not know but...

I have a similar issue. Give me some time and I will post more.
My camera was working for a week or so and then a bug was introduced.
This bug is in the kernel or a module.
My camera works for a period until the first error happens.
Eventually it causes motion to time out.

We can not resolve this. We need to get the issue in front of those with an understanding of the kernel drivers.

My camera Genius FaceCam 1020 which uses the uvcvideo driver. Running fully up to date Raspberrian Wheezy.
User avatar
Posts: 56
Joined: Wed Mar 07, 2012 10:40 pm
Location: New Zealand
by Bencom » Tue Sep 18, 2012 1:38 am
I think under load something is falling over.
As well as streaming video I want to stream audio.
I can do this with avconv via rtp and play vid and aud in a vlc session.
When I run avconv the errors consistently appear although the error still occurs sooner or later if I do not run avconv as well. Eventually motion crashes then more errors are noted.

My log.

Code: Select all
Sep 18 13:17:21 raspberrypi motion: [0] Processing thread 0 - config file /etc/motion/motion.conf
Sep 18 13:17:21 raspberrypi motion: [0] Motion 3.2.12 Started
Sep 18 13:17:21 raspberrypi motion: [0] Created process id file /var/run/motion/motion.pid. Process ID is 3569
Sep 18 13:17:21 raspberrypi motion: [0] Motion running as daemon process
Sep 18 13:17:21 raspberrypi motion: [0] ffmpeg LIBAVCODEC_BUILD 3482368 LIBAVFORMAT_BUILD 3478784
Sep 18 13:17:21 raspberrypi motion: [0] Thread 1 is from /etc/motion/motion.conf
Sep 18 13:17:21 raspberrypi motion: [0] motion-httpd/3.2.12 running, accepting connections
Sep 18 13:17:21 raspberrypi motion: [0] motion-httpd: waiting for data on port TCP 8080
Sep 18 13:17:21 raspberrypi motion: [1] Thread 1 started
Sep 18 13:17:21 raspberrypi motion: [1] cap.driver: "uvcvideo"
Sep 18 13:17:21 raspberrypi motion: [1] cap.card: "FaceCam 1020"
Sep 18 13:17:21 raspberrypi motion: [1] cap.bus_info: "usb-bcm2708_usb-1.2.4.4"
Sep 18 13:17:21 raspberrypi motion: [1] cap.capabilities=0x04000001
Sep 18 13:17:21 raspberrypi motion: [1] - VIDEO_CAPTURE
Sep 18 13:17:21 raspberrypi motion: [1] - STREAMING
Sep 18 13:17:21 raspberrypi motion: [1] Test palette YUYV (320x240)
Sep 18 13:17:21 raspberrypi motion: [1] Using palette YUYV (320x240) bytesperlines 640 sizeimage 153600 colorspace 00000008
Sep 18 13:17:21 raspberrypi motion: [1] found control 0x00980900, "Brightness", range -128,127
Sep 18 13:17:21 raspberrypi motion: [1] #011"Brightness", default -8193, current -128
Sep 18 13:17:21 raspberrypi motion: [1] found control 0x00980901, "Contrast", range 60,255
Sep 18 13:17:21 raspberrypi motion: [1] #011"Contrast", default 57343, current 255
Sep 18 13:17:21 raspberrypi motion: [1] found control 0x00980902, "Saturation", range 0,200
Sep 18 13:17:21 raspberrypi motion: [1] #011"Saturation", default 57343, current 200
Sep 18 13:17:21 raspberrypi motion: [1] found control 0x00980903, "Hue", range -128,127
Sep 18 13:17:21 raspberrypi motion: [1] #011"Hue", default -8193, current -128
Sep 18 13:17:21 raspberrypi motion: [1] found control 0x00980910, "Gamma", range 0,10
Sep 18 13:17:21 raspberrypi motion: [1] #011"Gamma", default 57343, current 5
Sep 18 13:17:21 raspberrypi motion: [1] mmap information:
Sep 18 13:17:21 raspberrypi motion: [1] frames=4
Sep 18 13:17:21 raspberrypi motion: [1] 0 length=153600
Sep 18 13:17:21 raspberrypi motion: [1] 1 length=153600
Sep 18 13:17:21 raspberrypi motion: [1] 2 length=153600
Sep 18 13:17:21 raspberrypi motion: [1] 3 length=153600
Sep 18 13:17:21 raspberrypi motion: [1] Resizing pre_capture buffer to 1 items
Sep 18 13:17:22 raspberrypi motion: [1] Started stream webcam server in port 8081
Sep 18 13:23:11 raspberrypi kernel: [69301.343990] retire_capture_urb: 3 callbacks suppressed
Sep 18 13:23:16 raspberrypi kernel: [69307.262726] retire_capture_urb: 2 callbacks suppressed
Sep 18 13:23:18 raspberrypi kernel: [69308.554498] uvcvideo: Non-zero status (-5) in video completion handler.
Sep 18 13:23:19 raspberrypi motion: [1] v4l2_next: VIDIOC_DQBUF: EIO (s->pframe 3): Input/output error
Sep 18 13:23:36 raspberrypi kernel: [69326.582226] retire_capture_urb: 2 callbacks suppressed
Sep 18 13:23:47 raspberrypi kernel: [69338.043640] uvcvideo: Non-zero status (-5) in video completion handler.
Sep 18 13:23:48 raspberrypi kernel: [69339.048635] retire_capture_urb: 7 callbacks suppressed
Sep 18 13:23:49 raspberrypi motion: [1] v4l2_next: VIDIOC_DQBUF: EIO (s->pframe 2): Input/output error
Sep 18 13:23:54 raspberrypi kernel: [69345.139389] retire_capture_urb: 1 callbacks suppressed
Sep 18 13:24:08 raspberrypi kernel: [69359.052099] retire_capture_urb: 4 callbacks suppressed
Sep 18 13:24:13 raspberrypi kernel: [69363.550280] uvcvideo: Non-zero status (-5) in video completion handler.
Sep 18 13:24:14 raspberrypi motion: [1] v4l2_next: VIDIOC_DQBUF: EIO (s->pframe 1): Input/output error
Sep 18 13:24:19 raspberrypi kernel: [69369.731562] retire_capture_urb: 1 callbacks suppressed
Sep 18 13:24:24 raspberrypi kernel: [69375.052070] retire_capture_urb: 3 callbacks suppressed
Sep 18 13:24:50 raspberrypi kernel: [69400.544342] retire_capture_urb: 2 callbacks suppressed
Sep 18 13:24:52 raspberrypi kernel: [69402.601832] uvcvideo: Non-zero status (-5) in video completion handler.
Sep 18 13:24:53 raspberrypi motion: [1] v4l2_next: VIDIOC_DQBUF: EIO (s->pframe 3): Input/output error
Sep 18 13:24:55 raspberrypi kernel: [69405.546695] uvcvideo: Non-zero status (-5) in video completion handler.
Sep 18 13:24:56 raspberrypi motion: [1] v4l2_next: VIDIOC_DQBUF: EIO (s->pframe 1): Input/output error
Sep 18 13:25:26 raspberrypi motion: [0] Thread 1 - Watchdog timeout, trying to do a graceful restart
Sep 18 13:25:26 raspberrypi motion: [0] httpd Closing
Sep 18 13:25:26 raspberrypi motion: [0] httpd thread exit
Sep 18 13:26:26 raspberrypi motion: [0] Thread 1 - Watchdog timeout, did NOT restart graceful,killing it!
Sep 18 13:26:26 raspberrypi motion: [0] Calling vid_close() from motion_cleanup
Sep 18 13:26:26 raspberrypi motion: [0] Closing video device /dev/video0

Code: Select all
Sep 17 18:32:11 raspberrypi kernel: [ 1441.358956] INFO: task motion:1866 blocked for more than 120 seconds.
Sep 17 18:32:11 raspberrypi kernel: [ 1441.358980] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
Sep 17 18:32:11 raspberrypi kernel: [ 1441.358997] motion          D c037a6dc     0  1866      1 0x00000000
Sep 17 18:32:11 raspberrypi kernel: [ 1441.359065] [<c037a6dc>] (__schedule+0x2bc/0x568) from [<c037bbf8>] (__mutex_lock_slowpath+0xb8/0x154)
Sep 17 18:32:11 raspberrypi kernel: [ 1441.359158] [<c037bbf8>] (__mutex_lock_slowpath+0xb8/0x154) from [<bf04c21c>] (uvc_queue_enable+0x1c/0xb8 [uvcvideo])
Sep 17 18:32:11 raspberrypi kernel: [ 1441.359277] [<bf04c21c>] (uvc_queue_enable+0x1c/0xb8 [uvcvideo]) from [<bf04fac8>] (uvc_video_enable+0x74/0x8c [uvcvideo])
Sep 17 18:32:11 raspberrypi kernel: [ 1441.359354] [<bf04fac8>] (uvc_video_enable+0x74/0x8c [uvcvideo]) from [<bf04d2ec>] (uvc_v4l2_do_ioctl+0x2f8/0xf78 [uvcvideo])
Sep 17 18:32:11 raspberrypi kernel: [ 1441.359539] [<bf04d2ec>] (uvc_v4l2_do_ioctl+0x2f8/0xf78 [uvcvideo]) from [<bf014f70>] (video_usercopy+0x130/0x564 [videodev])
Sep 17 18:32:11 raspberrypi kernel: [ 1441.359676] [<bf014f70>] (video_usercopy+0x130/0x564 [videodev]) from [<bf014338>] (v4l2_ioctl+0x94/0x134 [videodev])
Sep 17 18:32:11 raspberrypi kernel: [ 1441.359755] [<bf014338>] (v4l2_ioctl+0x94/0x134 [videodev]) from [<c00c88b0>] (do_vfs_ioctl+0x7c/0x578)
Sep 17 18:32:11 raspberrypi kernel: [ 1441.359790] [<c00c88b0>] (do_vfs_ioctl+0x7c/0x578) from [<c00c8de0>] (sys_ioctl+0x34/0x60)
Sep 17 18:32:11 raspberrypi kernel: [ 1441.359831] [<c00c8de0>] (sys_ioctl+0x34/0x60) from [<c000d980>] (ret_fast_syscall+0x0/0x30)
User avatar
Posts: 56
Joined: Wed Mar 07, 2012 10:40 pm
Location: New Zealand
by Bencom » Tue Sep 18, 2012 2:30 am
mplayer log

command mplayer tv://

The odd frame makes it through however image is split (not right size with broken up into about 4 different bits)

Code: Select all
mplayer tv://
MPlayer svn r34540 (Debian), built with gcc-4.6 (C) 2000-2012 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing tv://.
TV file format detected.
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski <olschewski@zpr.uni-koeln.de>
 comment: first try, more to come ;-)
v4l2: your device driver does not support VIDIOC_G_STD ioctl, VIDIOC_G_PARM was used instead.
Selected device: FaceCam 1020
 Capabilities:  video capture  streaming
 supported norms:
 inputs: 0 = Camera 1;
 Current input: 0
 Current format: YUYV
v4l2: ioctl set format failed: Invalid argument
v4l2: ioctl set format failed: Invalid argument
v4l2: ioctl set format failed: Invalid argument
tv.c: norm_from_string(pal): Bogus norm parameter, setting default.
v4l2: ioctl enum norm failed: Invalid argument
Error: Cannot set norm!
Selected input hasn't got a tuner!
v4l2: ioctl set mute failed: Invalid argument
[VO_XV] It seems there is no Xvideo support for your video card available.
[VO_XV] Run 'xvinfo' to verify its Xv support and read
[VO_XV] DOCS/HTML/en/video.html#xv!
[VO_XV] See 'mplayer -vo help' for other (non-xv) video out drivers.
[VO_XV] Try -vo x11.
[gl] no GLX support present
==========================================================================
Opening video decoder: [raw] RAW Uncompressed Video
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Movie-Aspect is undefined - no prescaling applied.
[swscaler @ 0x11de380] BICUBIC scaler, from yuyv422 to rgb565le using C
VO: [x11] 640x480 => 640x480 BGR 16-bit
v4l2: select timeout
Selected video codec: [rawyuy2] vfm: raw (RAW YUY2)
==========================================================================
Audio: no sound
Starting playback...
v4l2: select timeout
V:   0.0   2/  2 ??% ??% ??,?% 0 0
v4l2: select timeout
V:   0.0   4/  4 ??% ??% ??,?% 0 0
v4l2: select timeout
V:   0.0   5/  5 ??% ??% ??,?% 0 0
v4l2: select timeout
V:   0.0   6/  6 ??% ??% ??,?% 0 0
v4l2: select timeout
V:   0.0   9/  9 ??% ??% ??,?% 0 0
v4l2: select timeout
V:   0.0  10/ 10 ??% ??% ??,?% 0 0
v4l2: select timeout
v4l2: ioctl set mute failed: Invalid argument
v4l2: 3 frames successfully processed, 173 frames dropped.
User avatar
Posts: 56
Joined: Wed Mar 07, 2012 10:40 pm
Location: New Zealand
by Bencom » Tue Sep 18, 2012 2:35 am
My Logitech camera is worse not displaying an image at all.

Code: Select all
mplayer tv://
MPlayer svn r34540 (Debian), built with gcc-4.6 (C) 2000-2012 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing tv://.
TV file format detected.
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski <olschewski@zpr.uni-koeln.de>
 comment: first try, more to come ;-)
v4l2: ioctl get standard failed: Inappropriate ioctl for device
Selected device: Logitech QuickCam Pro 4000
 Capabilities:  video capture  read/write  streaming
 supported norms:
 inputs: 0 = usb;
 Current input: 0
 Current format: YUV420
v4l2: ioctl set format failed: Invalid argument
tv.c: norm_from_string(pal): Bogus norm parameter, setting default.
v4l2: ioctl enum norm failed: Inappropriate ioctl for device
Error: Cannot set norm!
Selected input hasn't got a tuner!
v4l2: ioctl set mute failed: Invalid argument
v4l2: ioctl query control failed: Invalid argument
[VO_XV] It seems there is no Xvideo support for your video card available.
[VO_XV] Run 'xvinfo' to verify its Xv support and read
[VO_XV] DOCS/HTML/en/video.html#xv!
[VO_XV] See 'mplayer -vo help' for other (non-xv) video out drivers.
[VO_XV] Try -vo x11.
[gl] no GLX support present
==========================================================================
Opening video decoder: [raw] RAW Uncompressed Video
Movie-Aspect is undefined - no prescaling applied.
VO: [x11] 640x480 => 640x480 Planar I420
[swscaler @ 0x50bba0] No accelerated colorspace conversion found from yuv420p to rgb565le.
[swscaler @ 0x50bba0] using unscaled yuv420p -> rgb565le special converter
Selected video codec: [rawi420] vfm: raw (RAW I420)
==========================================================================
Audio: no sound
Starting playback...
v4l2: select timeout
V:   0.0   1/  1 ??% ??% ??,?% 0 0
v4l2: select timeout
V:   0.0   3/  3 ??% ??% ??,?% 0 0
v4l2: select timeout
V:   0.0   4/  4 ??% ??% ??,?% 0 0
v4l2: select timeout
V:   0.0   6/  6 ??% ??% ??,?% 0 0
v4l2: select timeout
v4l2: ioctl set mute failed: Invalid argument
v4l2: 0 frames successfully processed, 1 frames dropped.

Exiting... (Quit)
User avatar
Posts: 56
Joined: Wed Mar 07, 2012 10:40 pm
Location: New Zealand
by whatshisname » Fri Sep 21, 2012 3:20 am
Just chiming in with a "me, too" on this problem.

Just got my RPi up and running. Using Arch. Installed motion. Webcam loads and runs fine for a minute or 2. Then it appears it freezes. Which is to say, it shows an image but it doesn't show any change in the video frame. Then it conks out with these messages in /var/log/errors/log:

Code: Select all
Sep 20 23:15:08 alarmpi motion: [1] v4l2_next: VIDIOC_DQBUF: EIO (s->pframe 2): Input/output error
Sep 20 23:15:38 alarmpi motion: [0] Thread 1 - Watchdog timeout, trying to do a graceful restart
Sep 20 23:16:38 alarmpi motion: [0] Thread 1 - Watchdog timeout, did NOT restart graceful,killing it!

So close. Yet so far away!
Posts: 10
Joined: Fri Sep 21, 2012 3:13 am
by Bencom » Fri Sep 21, 2012 7:31 am
whatshisname wrote:Just chiming in with a "me, too" on this problem.

Just got my RPi up and running. Using Arch. Installed motion. Webcam loads and runs fine for a minute or 2. Then it appears it freezes. Which is to say, it shows an image but it doesn't show any change in the video frame. Then it conks out with these messages in /var/log/errors/log:

Code: Select all
Sep 20 23:15:08 alarmpi motion: [1] v4l2_next: VIDIOC_DQBUF: EIO (s->pframe 2): Input/output error
Sep 20 23:15:38 alarmpi motion: [0] Thread 1 - Watchdog timeout, trying to do a graceful restart
Sep 20 23:16:38 alarmpi motion: [0] Thread 1 - Watchdog timeout, did NOT restart graceful,killing it!

So close. Yet so far away!

Are you able to establish what driver your camera uses? UVC?

I am reading kernal code tonight :geek:
User avatar
Posts: 56
Joined: Wed Mar 07, 2012 10:40 pm
Location: New Zealand
by whatshisname » Fri Sep 21, 2012 1:16 pm
Yes. uvcvideo is the driver I'm using.

Thanks.
Posts: 10
Joined: Fri Sep 21, 2012 3:13 am
by bblood » Sat Sep 29, 2012 12:41 pm
I can verify the instability of uvcvideo...my rpi is headless I am running motion and get the watchdog timeout....graceful restart every couple minutes. This is something that seems to have cropped up recently...

Camera is logitech quick cam pro 9000. Distro is wheezy...very frustrating...I can't provide logs...i am on an iPad and can't figure out how to cut and paste from vSSH app....also very frustrating....

Bill
Posts: 42
Joined: Sat Sep 22, 2012 1:54 am
by bblood » Sat Sep 29, 2012 12:57 pm
Here is a sample of the syslog regarding the frequency


ep 29 08:36:52 raspberrypi motion: [0] Thread 1 - Watchdog timeout, trying to do a graceful resta
rt
Sep 29 08:37:59 raspberrypi motion: [0] Thread 1 - Watchdog timeout, trying to do a graceful resta
rt
Sep 29 08:38:31 raspberrypi motion: [0] Thread 1 - Watchdog timeout, trying to do a graceful resta
rt
Sep 29 08:39:21 raspberrypi motion: [0] Thread 1 - Watchdog timeout, trying to do a graceful resta
rt
Sep 29 08:40:58 raspberrypi motion: [0] Thread 1 - Watchdog timeout, trying to do a graceful resta
rt
Sep 29 08:41:35 raspberrypi motion: [0] Thread 1 - Watchdog timeout, trying to do a graceful resta
rt
Sep 29 08:42:54 raspberrypi motion: [0] Thread 1 - Watchdog timeout, trying to do a graceful resta
rt
Sep 29 08:43:51 raspberrypi motion: [0] Thread 1 - Watchdog timeout, trying to do a graceful resta
rt
Sep 29 08:45:41 raspberrypi motion: [0] Thread 1 - Watchdog timeout, trying to do a graceful resta
rt
Sep 29 08:46:57 raspberrypi motion: [0] Thread 1 - Watchdog timeout, trying to do a graceful resta
rt
Sep 29 08:47:57 raspberrypi motion: [0] Thread 1 - Watchdog timeout, did NOT restart graceful,kill
ing it!
Sep 29 08:48:27 raspberrypi motion: [0] Thread 1 - Watchdog timeout, trying to do a graceful resta
rt
Sep 29 08:49:22 raspberrypi motion: [0] Thread 1 - Watchdog timeout, trying to do a graceful resta
rt
Posts: 42
Joined: Sat Sep 22, 2012 1:54 am
by bblood » Sat Sep 29, 2012 1:06 pm
Here is lsusb
Code: Select all
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 2341:0043 Arduino SA Uno R3 (CDC ACM)
Bus 001 Device 005: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 006: ID 0bda:8189 Realtek Semiconductor Corp. RTL8187B Wireless 802.11g 54Mbps Netw
ork Adapter
Bus 001 Device 007: ID 046d:0990 Logitech, Inc. QuickCam Pro 9000
pi@raspberrypi ~ $


lsmod:
Code: Select all
pi@raspberrypi ~ $ lsmod |grep video
uvcvideo               59742  1
videodev               88790  2 uvcvideo


Dmesg from where it registers video....note the last line???

Code: Select all
6.660799] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[    7.060939] Linux video capture interface: v2.00
[    7.114330] uvcvideo: Found UVC 1.00 device <unnamed> (046d:0990)
[    7.301814] udevd[182]: renamed network interface wlan0 to wlan1
[    7.812647] input: UVC Camera (046d:0990) as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3
.4/1-1.3.4:1.0/input/input0
[    7.870258] usbcore: registered new interface driver uvcvideo
[    7.878774] USB Video Class driver (1.1.1)
[    8.147057] usbcore: registered new interface driver snd-usb-audio
[   12.691015] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[   13.265775] bcm2835 ALSA card created!
[   13.279663] bcm2835 ALSA chip created!
[   13.285854] bcm2835 ALSA chip created!
[   13.302190] bcm2835 ALSA chip created!
[   13.310384] bcm2835 ALSA chip created!
[   13.318376] bcm2835 ALSA chip created!
[   13.326412] bcm2835 ALSA chip created!
[   13.334327] bcm2835 ALSA chip created!
[   19.181923] smsc95xx 1-1.1:1.0: eth0: unregister 'smsc95xx' usb-bcm2708_usb-1.1, smsc95xx USB 2
.0 Ethernet
[   27.570512] wlan1: authenticate with 00:12:17:bf:ce:8a (try 1)
[   27.572880] wlan1: authenticated
[   27.970572] wlan1: associate with 00:12:17:bf:ce:8a (try 1)
[   27.973327] wlan1: RX AssocResp from 00:12:17:bf:ce:8a (capab=0x411 status=0 aid=1)
[   27.973358] wlan1: associated
[   30.652703] Adding 102396k swap on /var/swap.  Priority:-1 extents:1 across:102396k SS
[  854.737549] uvcvideo: Non-zero status (-5) in status completion handler.
[ 4913.881634] ieee80211 phy0: wlan1: No probe response from AP 00:12:17:bf:ce:8a after 500ms, dis
connecting.
[ 4913.997095] cfg80211: Calling CRDA to update world regulatory domain
[ 4916.982897] wlan1: authenticate with 00:12:17:bf:ce:8a (try 1)
[ 4916.993997] wlan1: authenticated
[ 4917.192920] wlan1: associate with 00:12:17:bf:ce:8a (try 1)
[ 4917.200888] wlan1: RX ReassocResp from 00:12:17:bf:ce:8a (capab=0x411 status=0 aid=1)
[ 4917.200950] wlan1: associated
[ 5393.881295] ieee80211 phy0: wlan1: No probe response from AP 00:12:17:bf:ce:8a after 500ms, dis
connecting.
[ 5393.987835] cfg80211: Calling CRDA to update world regulatory domain
[ 5396.962910] wlan1: authenticate with 00:12:17:bf:ce:8a (try 1)
[ 5396.965212] wlan1: authenticated
[ 5397.163004] wlan1: associate with 00:12:17:bf:ce:8a (try 1)
[ 5397.165707] wlan1: RX ReassocResp from 00:12:17:bf:ce:8a (capab=0x411 status=0 aid=1)
[ 5397.165737] wlan1: associated
[ 8873.886749] ieee80211 phy0: wlan1: No probe response from AP 00:12:17:bf:ce:8a after 500ms, dis
connecting.
[ 8874.005028] cfg80211: Calling CRDA to update world regulatory domain
[ 8876.948172] wlan1: authenticate with 00:12:17:bf:ce:8a (try 1)
[ 8876.960626] wlan1: authenticated
[ 8877.158201] wlan1: associate with 00:12:17:bf:ce:8a (try 1)
[ 8877.195805] wlan1: RX ReassocResp from 00:12:17:bf:ce:8a (capab=0x411 status=0 aid=1)
[ 8877.196349] wlan1: associated
[27738.095090] uvcvideo: Non-zero status (-5) in status completion handler.
pi@raspberrypi ~ $
Posts: 42
Joined: Sat Sep 22, 2012 1:54 am
by troombatzia » Sat Sep 29, 2012 5:43 pm
Hello, just a suggestion. For webcams using uvcvideo module, there's an intersting program to test your webcam. The name is luvcview. It's on Raspian repo: sudo apt-get install luvcview. Run luvcview -h to know its options. It helped me to setup motion with my super cheap chinese webcam. Today tested 5 hours motion run, with no issues. luvcview helps to determine the best ratio between /fps/size/ and motion usability. For example my cheap webcam should support 640x480 x 30 fps. On raspy I have to limit the size to 352x288 and the fps is limited automatically to 5 fps. Warning: if you launch luvcview and for some reason you get a black screen, then the program window *can't* be closed by window manager. CTRL+c in terminal you used or xkill. But before anything else : luvcview -h.
English isn’t my first language, so please excuse any mistakes.
Posts: 501
Joined: Fri Jun 29, 2012 4:27 pm
by bblood » Sun Sep 30, 2012 11:39 am
Thanks for the suggestion....my rpi is headless....but, my webcam is on the confirmed list, and, it was working perfectly up until recently....not sure which firmware update killed it. I have had to shut down motion until the fix comes out. I have another webcam I will try when I get home...it is also uvcvideo, but much, much older.
Posts: 42
Joined: Sat Sep 22, 2012 1:54 am
by relnext » Mon Oct 01, 2012 11:33 am
Having the same problems here also. Motion seems to time out after 3 or 4 minutes. Have a Logitech C270 plugged into a powered hub. Camera works continuously with other software. Be nice to hear of a resolve to this issue.
User avatar
Posts: 27
Joined: Wed Sep 26, 2012 5:23 pm
Location: Florida, USA
by ahagadgets » Fri Oct 05, 2012 11:07 am
For us it worked (for the time being) at a low frame rate and resolution.

Effectively: luvcview -s 320x240 -i 1

(oh btw, our webcam is a super cheap chinese "snake" brand cam, which uses uvcvideo driver. We've been swapping kernel/fs images like crazy all through last week till we realized its a driver problem :P )
Posts: 1
Joined: Fri Oct 05, 2012 11:02 am
by relnext » Sat Oct 06, 2012 1:19 pm
i've currently switched to mjpg-streamer and it keeps the connection for longer periods. still not 24/7 by any means. i'm interested to see what will happen when the camera module is released. the kids want to stream our rat-cam for the world to see.
User avatar
Posts: 27
Joined: Wed Sep 26, 2012 5:23 pm
Location: Florida, USA
by whatshisname » Sun Oct 07, 2012 6:33 pm
relnext,

Here's what one guy did to get your webcam working with motion:

Code: Select all
I have it running on an Arch install (soft float) with a Logitech C270 webcam. However, it did take a bit of fiddling with quite a bit of trawling the web (mostly archlinux wiki). The steps below worked for me but I haven't fully got to all of the reasons why quite yet:
1) installed via standard $ pacman -S motion
2) changed a few settings in the ~/.motion/motion.conf file
   - v412-palette 6
   - ffmpeg_video_codec swf   (mpeg4 didn't work)
   - framerate 10      (probably could be better, haven't got around to tweaking more)
   - other local changes like target directory
3) had to make /dev/video0 visible via a udev rule /etc/udev/rules.d/10.local.rules containing
   KERNEL=="video[0-9]*", MODE=="0666"
4) prior to running motion each time had to reload the uvcvideo module with
   - $ sudo rmmod uvcvideo
   - $ sudo modprobe uvcvideo
5) then run motion with $ LD_PRELOAD=/usr/lib/libv4l//v4l2convert.so motion -s
6) these 3 commands were then added to a bash script for simplicity
cheers
Rob


I tried what Rob did with my Logitech C260 but I still couldn't get motion to stay up longer than 5 minutes before it crashed and burned.

I decided to throw in the towel on the C260 and bought a HP HD-2200 which is supposed to be compatible with the ARM chip.

So far success. Motion has been up for an hour with no problems. I'll report back later on how long this lasts.
Posts: 10
Joined: Fri Sep 21, 2012 3:13 am
by shuckle » Sun Oct 07, 2012 7:10 pm
I am interested if you get good quality picture from your cam?
Posts: 547
Joined: Sun Aug 26, 2012 11:49 am
Location: Finland
by cupcake » Wed Oct 10, 2012 11:41 pm
I was sent to this thread from my issue described here (link).

Is the general consensus that webcams are problematic with latest Wheezy?
Posts: 59
Joined: Sat Jan 21, 2012 9:00 pm
by rivalcomp » Thu Nov 22, 2012 5:38 pm
Just for feedback my Logitech QuickCam for Notebook Deluxe doesn't work with motion.
Code: Select all
[1] cap.driver: "zc3xx"
[1] cap.card: "USB Camera (046d:08d8)"
[1] cap.bus_info: "usb-bcm2708_usb-1.3.1"
[1] cap.capabilities=0x05000001
[1] - VIDEO_CAPTURE
[1] - READWRITE
[1] - STREAMING
[1] Config palette index 8 (YU12) doesn't work.
[1] Supported palettes:
[1] 0: JPEG (JPEG)
[1] Selected palette JPEG
[1] Test palette JPEG (640x480)
[1] Using palette JPEG (640x480) bytesperlines 640 sizeimage 115790 colorspace 0                                                                                        0000007
[1] found control 0x00980900, "Brightness", range 0,255
[1]     "Brightness", default 128, current 218
[1] found control 0x00980901, "Contrast", range 0,255
[1]     "Contrast", default 128, current 128
[1] found control 0x00980910, "Gamma", range 1,6
[1]     "Gamma", default 4, current 4
[1] found control 0x00980911, "Exposure", range 781,18750
[1]     "Exposure", default 2343, current 2343
[1] found control 0x00980912, "Auto Gain", range 0,1
[1]     "Auto Gain", default 1, current 1
[1] mmap information:
[1] frames=4
[1] 0 length=118784
[1] 1 length=118784
[1] 2 length=118784
[1] 3 length=118784

And after this a lot of "Corrupt JPEG data: premature end of data segment" messages. After a variable interval motion restarts /dev/video0. Some frames comes through (1-2 frames/sec) but they are corrupted: the whole frame is visible but it is black and white with a lot of smudged colors in it. Tried with different resolutions, framerates, no luck. Someone on the internet suggested recompilig motion source with the error message commented out. I don't think this should be the ultimate solution, because camera can't provide useable video.

Is there any way to force an other driver (if there is)?
Raspberry Pi 512MB
User avatar
Posts: 3
Joined: Thu Nov 22, 2012 4:40 pm
Location: Budapest
by rivalcomp » Thu Nov 22, 2012 6:38 pm
Forgot to mention I'd like to use this camera on a self powered USB HUB (5V 1A). RasPi has it's own 5V 1A power supply.
Raspberry Pi 512MB
User avatar
Posts: 3
Joined: Thu Nov 22, 2012 4:40 pm
Location: Budapest
by ahynes1 » Sat Jan 05, 2013 8:01 pm
I'm running a headless RPi with a Logitech 9000. I had similar problems.

Looking through my messages, I found:

[1] Config palette index 8 (YU12) doesn't work.
[1] Supported palettes:
[1] 0: MJPG (MJPEG)
[1] 1: YUYV (YUV 4:2:2 (YUYV))
[1] Selected palette YUYV

So, I tried changing the palet to be MJPEG
>>> v4l2_palette 2

All of a sudden it started working. I could even run higher resolution. I pushed it up to 1024x768. I still got a few errors, but mostly it worked even at this level.
Posts: 1
Joined: Sat Jan 05, 2013 7:55 pm
by johnsonfamily38 » Mon Feb 04, 2013 10:14 pm
Im running wheezy with motion 3.2.12 and a logitech Webcam C100 and had similar setup problems.
I had to change to "v412_pallette_6" to match the camera output, but it still occassionally losses the thread to the /dev/video device. The http server then stops.

One workaround was to re-start the motion process by adding the following line to the susers cron table:

30 * * * * sudo pkill -9 motion; sleep 5; sudo motion;

This works fine, restarting every 30 mins.
Posts: 4
Joined: Mon Feb 04, 2013 10:04 pm
by wheezer » Sun Jul 21, 2013 11:02 pm
SOLVED:

I am running a Logitech C525.

I was running motion as a daemon with: sudo service motion start

I could load a webpage and the image was fine but after a few minutes OR if I "moved" in front of the camera the camera would turn off immediately and I would get in "/var/log/messages": Closing video device /dev/video0

Here is the reason why. I had modified a thread1.conf file to write all captured .jpg/.swf files to a directory of my choosing, not the default /tmp. When the camera attempted to write the "motion capture" files the directory which I had created had the wrong ownership. The capture directory needs to be owned by "motion: motion". So if your "target_dir" attribute is "/motion_capture_directory" then "chown motion:motion motion_capture_directory" - no quotes. Now
motion is working fine for me and I am looking at it in 640x480.

Maybe this is the cause of your problems. If your have your config files under different users then the base install then you need to be careful with permissions and ownership. The best thing is to run it in its default configuration. That way if you start changing target directories, etc. and it fails you will know why.
Posts: 2
Joined: Tue Jul 09, 2013 11:10 pm