You are not logged in.

#1 2013-04-28 23:44:10

permitivity
Member
Registered: 2013-02-18
Posts: 11

USB webcam - why I need to run "fswebcam" before "motion"

Hello,
I'm having a curious issue with "motion", the webcam program.  I have both "fswebcam" and "motion" installed on my pogoplug running ArchLinux Arm.  There is a USB webcam (Logitech 310).

After bootup, I can't run the "motion" command without errors.  I need to run "fswebcam" first, then ctrl-C to stop fswebcam, then run "motion".  If I do that, motion works like it should.

My goal to to use motion.  Fswebcam was installed when I was playing around initially.  I was scratching my head on why Motion sometimes works and sometimes doesn't, until I realized that it only works during the sessions where I run fswebcam sometime before I try motion.  If I reboot the system, I need to run fswebcam again before Motion would work works.

I post my output below.  The error that throws up seems to have something to do with trying to find the pallet?  But motion is using the same conf file, and I don't know why pallet YUYV doesn't work until after fswebcam is run.

Eventually, I'd like to put motion into daemon mode and run it on startup automatically, but have to figure this out first.  Thanks for any help!

Here's the output of motion if I don't run fswebcam first:

[root@alarm ~]# motion
[0] Processing thread 0 - config file /etc/motion/motion.conf
[0] Motion 3.2.12 Started
[0] ffmpeg LIBAVCODEC_BUILD 3489124 LIBAVFORMAT_BUILD 3481700
[0] Thread 1 is from /etc/motion/motion.conf
[0] motion-httpd/3.2.12 running, accepting connections
[0] motion-httpd: waiting for data on port TCP 8080
[1] Thread 1 started
[1] cap.driver: "uvcvideo"
[1] cap.card: "UVC Camera (046d:081b)"
[1] cap.bus_info: "usb-orion-ehci.0-1.3"
[1] cap.capabilities=0x04000001
[1] - VIDEO_CAPTURE
[1] - STREAMING
[1] Config palette index 6 (YUYV) doesn't work.
[1] Supported palettes:
[1] 0: YUYV (YUV 4:2:2 (YUYV))
[1] 1: MJPG (MJPEG)
[1] Selected palette YUYV
[1] VIDIOC_TRY_FMT failed for format YUYV: Input/output error
[1] Unable to find a compatible palette format.
[1] ioctl (VIDIOCGCAP): Invalid argument
[1] Could not fetch initial image from camera

[1] Motion continues using width and height from config file(s)
[1] Resizing pre_capture buffer to 1 items
[1] Started stream webcam server in port 7081
[1] Retrying until successful connection with camera
[1] cap.driver: "uvcvideo"
[1] cap.card: "UVC Camera (046d:081b)"
[1] cap.bus_info: "usb-orion-ehci.0-1.3"
[1] cap.capabilities=0x04000001
[1] - VIDEO_CAPTURE
[1] - STREAMING
[1] Config palette index 6 (YUYV) doesn't work.
[1] Supported palettes:
[1] 0: YUYV (YUV 4:2:2 (YUYV))
[1] 1: MJPG (MJPEG)
[1] Selected palette YUYV
[1] VIDIOC_TRY_FMT failed for format YUYV: Input/output error
[1] Unable to find a compatible palette format.
[1] ioctl (VIDIOCGCAP): Invalid argument


If I run fswebcam first using this command, then I ctrl-C to cancel out.

fswebcam -r 1280X720 -S 15 --flip h --jpeg 95 --shadow --title "eric webcam" --subtitle "Home" --info "Monitor: Active @ 1 fpm" --save /media/FLASHDRIVE/webcam.jpg -l 20 --device  /dev/video0


This is the output of Motion (non-daemon mode), showing everything is running correctly.  I only get this result if I run the above fswebcam command first:

[root@alarm ~]# motion
[0] Processing thread 0 - config file /etc/motion/motion.conf
[0] Motion 3.2.12 Started
[0] ffmpeg LIBAVCODEC_BUILD 3489124 LIBAVFORMAT_BUILD 3481700
[0] Thread 1 is from /etc/motion/motion.conf
[0] motion-httpd/3.2.12 running, accepting connections
[0] motion-httpd: waiting for data on port TCP 8080
[1] Thread 1 started
[1] cap.driver: "uvcvideo"
[1] cap.card: "UVC Camera (046d:081b)"
[1] cap.bus_info: "usb-orion-ehci.0-1.3"
[1] cap.capabilities=0x04000001
[1] - VIDEO_CAPTURE
[1] - STREAMING
[1] Test palette YUYV (1280x720)
[1] Using palette YUYV (1280x720) bytesperlines 2560 sizeimage 1843200 colorspace 00000008
[1] found control 0x00980900, "Brightness", range 0,255
[1]     "Brightness", default 128, current 128
[1] found control 0x00980901, "Contrast", range 0,255
[1]     "Contrast", default 32, current 32
[1] found control 0x00980902, "Saturation", range 0,255
[1]     "Saturation", default 32, current 32
[1] found control 0x00980913, "Gain", range 0,255
[1]     "Gain", default 0, current 16
[1] mmap information:
[1] frames=4
[1] 0 length=1843200
[1] 1 length=1843200
[1] 2 length=1843200
[1] 3 length=1843200
[1] Using V4L2
[1] Resizing pre_capture buffer to 1 items
[1] Started stream webcam server in port 7081

Last edited by permitivity (2013-04-28 23:53:24)

Offline

#2 2013-05-01 19:29:36

permitivity
Member
Registered: 2013-02-18
Posts: 11

Re: USB webcam - why I need to run "fswebcam" before "motion"

Bump?  Still haven't figured out why Motion can't work right after reboot.  Still running fswebcam prior to running Motion.

Offline

#3 2013-05-07 16:52:30

permitivity
Member
Registered: 2013-02-18
Posts: 11

Re: USB webcam - why I need to run "fswebcam" before "motion"

I made a bit of progress with this.

I found out that this issue happens 3 out of about 5 restarts.  Still not sure why.  If I restart the system, the problem has about a 40 percent chance of going away.

However, running fswebcam first, then terminating it, seems to guarantee that motion will work.

This problem also only exists with my Logitech C310.  It doesn't happen with my Microsoft Lifecam or Logitech C920.

Interesting...but confusing.

Offline

#4 2013-05-07 20:47:08

pilotkeller
Member
From: Canada
Registered: 2011-12-22
Posts: 513
Website

Re: USB webcam - why I need to run "fswebcam" before "motion"

Offline

#5 2013-05-10 02:16:11

permitivity
Member
Registered: 2013-02-18
Posts: 11

Re: USB webcam - why I need to run "fswebcam" before "motion"

Thanks.  Yeah, on the Arm forum, someone pointed me to the same exact post.

It's weird that I ran in to this exact issue.

Offline

#6 2013-06-11 02:52:50

permitivity
Member
Registered: 2013-02-18
Posts: 11

Re: USB webcam - why I need to run "fswebcam" before "motion"

I just tried version  3.2.12-9 of motion.  It seems to have solved the issue.  I don't have to run fswebcam before running motion for the Logitech C310.

EDIT:  Nope, I was wrong.  New version of motion still has not resolved the issue.  Still boots up with a disabled webcam sometimes.

Last edited by permitivity (2013-06-21 03:12:12)

Offline

Board footer

Powered by FluxBB