Webcam horizontal lines problem


31 posts   Page 1 of 2   1, 2
by kermitas » Tue Jul 24, 2012 9:53 am
I am using Microsoft LifeCam cinema with motion.

Does anybody knows what are those horizontal lines that are on attached image?
Those lines are jumping from place to place.

I am using 'motion' (3.2 or compiled latest daily snapshot) and fswebcam. I also replaced libjpeg from 62 to 7 and to 8. I tryed Debain Wheezy and Fedora 17. I also changed cabel, chagned RasbperryPi, changed powered usb hub.

Nothing helps :(.

The only thing that can reduce a little bit those artefacts is to lower 'sharpness' to minimal value (to chagne webcam parameters I'm using v2l2-ctl).

Webcam (LifeCam cinema) works fine on my Fedora 17 laptop.
I have a second camera (Logitech C270) and it works fine on R-Pi. If I disconnect Logitech and plug LifeCam lines are back again :(.

I searched a lot on google but I cannot find anything about those horizontal lines :(.

Thank you,
Arthur.
Attachments
2012_07_24_10_24_07-00-motion (kopia).jpg
Snaphsot with unknown horizontal lines.
2012_07_24_10_24_07-00-motion (kopia).jpg (57.79 KiB) Viewed 6668 times
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am
by kermitas » Tue Jul 24, 2012 10:50 am
PS: I wrote a question to Microsoft about what they know about those lines
PS2: I am attaching next snapshopt (oryginally it is 1280x720)
Attachments
2012_07_19_17_06_50-time (kopia).jpg
2012_07_19_17_06_50-time (kopia).jpg (62.69 KiB) Viewed 6658 times
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am
by alexeames » Tue Jul 24, 2012 7:36 pm
I'm sorry I can't answer your question Artur, but how does motion perform on the Pi? (Is it OK or rather sluggish?) Are these just snapshots or frames grabbed from video? (I suppose the filename of the first one answers that?)

If the pi is being pushed to its limits, is it possible that these lines are artefacts (errors) because of that? (Instead of dropped frame, a dropped part-frame?) If the camera works on another computer, it's probably not the camera. What about the drivers?

Your street scene absolutely screamed out "Polska" to me. (I've spent a lot of time there - in fact I'm there now :lol: )
Alex Eames RasPi.TV HDMIPi.com RasP.iO
User avatar
Posts: 2065
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
by ajb » Fri Jul 27, 2012 6:19 am
I had the same horizontal stripes with 1280x720 and lowered the resolution one small step to 960x544.
Posts: 12
Joined: Fri Jul 27, 2012 6:14 am
Location: Berlin, Germany
by AndrewS » Fri Jul 27, 2012 9:15 am
alexeames wrote:If the pi is being pushed to its limits, is it possible that these lines are artefacts (errors) because of that? (Instead of dropped frame, a dropped part-frame?) If the camera works on another computer, it's probably not the camera.

Yeah, might be because of the less-than-fantastic USB driver on the Raspi? :(
Possibly a similar problem to this one? :? viewtopic.php?p=89966#p89966
User avatar
Posts: 3590
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by kermitas » Mon Jul 30, 2012 4:26 pm
Dear alexeames, ajb and AndrewS,

I just wrote my final thoughts about rpi + microsoft webcam http://www.raspberrypi.org/phpBB3/viewtopic.php?p=136818#p136818. I am giving up! :cry:

I confirm that ethernet + usb on a one chip is very weak point of rpi. If I acquire a lot of data trough USB then ethernet starts to hiccup.
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am
by kermitas » Mon Jul 30, 2012 4:51 pm
alexeames wrote:I'm sorry I can't answer your question Artur, but how does motion perform on the Pi? (Is it OK or rather sluggish?)


I would say that it is sluggish.
I am working with 1280x720 and if 'motion' will detect motion then it can catch about 0.5 ~ 0.4 fps. Also many times it hangs so I had to write big watchdog shell script to monitor this situation.

So I leaved motion detection and changed to get snapshot every 1s. I will produce a lot of data 17.3 GB per day (24h) but now it works even better.

Using my next rpi I am creating simple NAS (debian wheezy and ftp, ssh, maybe nfs, photo in attachment).

alexeames wrote:Are these just snapshots or frames grabbed from video? (I suppose the filename of the first one answers that?)


Exactly ;)

alexeames wrote:If the pi is being pushed to its limits, is it possible that these lines are artefacts (errors) because of that? (Instead of dropped frame, a dropped part-frame?) If the camera works on another computer, it's probably not the camera.


Hmmm. Maybe.
I studied those lines. They looks like part of the same picture but moved few pixels to the left. So if you move it to the right it would be complete and nice frame.

I don't have so much experience nad knowledge (I searched google a lot but don't found any info about lines like that) to say what causes those lines.
Yes, camera works well on laptop, there are no lines, no "disconnected by hub (EMI?)". But my other webcams (Logotech C270 and Creative Socialize HD 1080) works very good with rpi (no lines, no disconnections, no problems).

alexeames wrote:What about the drivers?


For video it is: videodev and uvcvideo. For USB hub I think it is smsc95xx.

alexeames wrote:Your street scene absolutely screamed out "Polska" to me. (I've spent a lot of time there - in fact I'm there now :lol: )


THANK YOU!!! :)) :D :D
Wow! Where are you in Poland? Whay are you doing here?? :)

PS: Screen was took in Warsaw :).
Attachments
rpi_nas_1.jpg
rpi_nas_1.jpg (60.13 KiB) Viewed 6445 times
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am
by alexeames » Mon Jul 30, 2012 5:26 pm
kermitas wrote:
alexeames wrote:Your street scene absolutely screamed out "Polska" to me. (I've spent a lot of time there - in fact I'm there now :lol: )


THANK YOU!!! :)) :D :D
Wow! Where are you in Poland? Whay are you doing here?? :)


Moja zona jest Polka a ja Anglikiem. Mamy dom w Zgierzu ale mieszkamy w Anglii. Spedzamy lato tutaj bo po co trzymac dom jak nie korzystamy?

We're here for the summer. :) And yes I brought a Raspberry Pi with me :twisted:

kermitas wrote:PS: Screen was took in Warsaw :).

Looks like a nice (reasonably modern) neighbourhood. :D
Alex Eames RasPi.TV HDMIPi.com RasP.iO
User avatar
Posts: 2065
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
by ajb » Tue Jul 31, 2012 9:51 pm
dear kermitas,

I use the arch Linux distro - feel that it runs better, at least for me ... Please check again with the MS Lifecam and motion running, what is the your voltage between TP1 and TP2?
see http://elinux.org/R-Pi_Troubleshooting# ... r_problems

My power supply was slightly below 4,75 V, actually 4,68 V, tomorrow I will get a stronger one with 2000mA, so I will look at it whether my system will run more stable.
Posts: 12
Joined: Fri Jul 27, 2012 6:14 am
Location: Berlin, Germany
by kermitas » Wed Aug 01, 2012 10:06 am
alexeames wrote:Moja zona jest Polka a ja Anglikiem. Mamy dom w Zgierzu ale mieszkamy w Anglii. Spedzamy lato tutaj bo po co trzymac dom jak nie korzystamy?

We're here for the summer. :) And yes I brought a Raspberry Pi with me :twisted:


Great:) So you already know that we have here (in Poland) the most beautiful girls in the world ;)).

What are you planning to build with your rpi?
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am
by kermitas » Wed Aug 01, 2012 10:33 am
ajb wrote:dear kermitas,

I use the arch Linux distro - feel that it runs better, at least for me ...


Good suggestion. I already checked Debian (Squeeze, Wheezy) and F17. Debian just hangs randomly so I for first days couldn't even see message "disconnected by hub (EMI?), re-enabling..." in /var/log/messages.

ajb wrote:Please check again with the MS Lifecam and motion running, what is the your voltage between TP1 and TP2?
see http://elinux.org/R-Pi_Troubleshooting# ... r_problems

My power supply was slightly below 4,75 V, actually 4,68 V, tomorrow I will get a stronger one with 2000mA, so I will look at it whether my system will run more stable.


I have used three diffrent power supplies... yesterday I bought three more (for my RPI NAS and monitoring points pri+webcam+wifi).

OK, I did some measurements. Test kit: rpi + creative socialize hd 1080 + 'motion' that takes snapshot every 1s + wifi usb dongle that sends every 20 snapshots to my NAS.
(I don't use usb hub to eliminate weak points - I am injecting power for webcam and wifi dongle directly to their usb cables).

Using 5V 1.5A power supply:
- power supply with no load: 5V
- power supply under rpi load: 4.5V
- TP1 TP2: 4.0V - 4.1V

Using 5V 2A power supply:
- power supply with no load: 5.5V
- power supply under rpi load: 4.4V
- TP1 TP2: 4.3V

Ajb, what do you think about that??
Can it cause those horrible horizontal lines or disconnections by hub (http://www.raspberrypi.org/phpBB3/viewtopic.php?f=63&t=12247)?

Should I use two power suplies for rpi and webcam (or even three, one for rpi, one for webcam and one for wifi dongle)???

Thank you :),
Arthur.
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am
by kermitas » Wed Aug 01, 2012 11:46 am
I have received response from Microsoft.

They wrote that I have to pass my PID (Windows key) and if I will not send it they will not pass my email to their technicians.

I think that they don't care that this camera (Microsoft LifeCam Cinema) is UVC and should work with any uvc-compatible software. They want me to use Windows and only Windows.

So it looks like that I can't get any tip what causes those lines and how to fight with them.
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am
by kermitas » Wed Aug 01, 2012 11:54 am
I attached Ms LifeCam Cinema again.

Now my rpi (Fedora 17) is powered by the 5V 2A power supply, wifidongle and webcam is powered by second one 5V 2A.

TP1 - TP2 power is: 5.05V.

I get a lot of jumping lines (see attachments) and loosing connection with rpi in about 2 - 5 minutes (maybe rpi still works but I don't have wifi connection to it).

Again: rpi + MS webcam = big mistake :cry:
Attachments
2012-08-01_13-40-51-snapshot.jpg
2012-08-01_13-40-51-snapshot.jpg (63.69 KiB) Viewed 6327 times
2012-08-01_13-40-45-snapshot.jpg
2012-08-01_13-40-45-snapshot.jpg (63.5 KiB) Viewed 6327 times
2012-08-01_13-40-44-snapshot.jpg
2012-08-01_13-40-44-snapshot.jpg (63.66 KiB) Viewed 6327 times
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am
by ajb » Wed Aug 01, 2012 11:57 am
> Using 5V 1.5A power supply:
> - power supply with no load: 5V
> - power supply under rpi load: 4.5V
> - TP1 TP2: 4.0V - 4.1V

> Using 5V 2A power supply:
> - power supply with no load: 5.5V
> - power supply under rpi load: 4.4V
> - TP1 TP2: 4.3V

that's definitely not good - my new power supply (see http://www.amazon.de/gp/product/B006SU9 ... 00_s00_i00 ), with raspi running at 800 MHz, has now a perfect 4,83 V under load (motion running, lifecam directly attached with a good 5m USB-cable, HDMI). Without load and no connections I can measure 4,96 V

as stated above (see http://elinux.org/R-Pi_Troubleshooting# ... r_problems ) and in the German computer journal c't (see http://www.heise.de/hardware-hacks/arti ... 73973.html ), they wrote:

>>Zu wenig Strom führte auch zum Versagen der Netzwerk-Verbindung. Sollten solche Phänomene auftreten, ist der Einsatz eines stärkeren Netzteils angeraten. Typische Handy-Netzteile sind in der Regel zu schwach. Einen Überblick über leistungsfähige USB-Netzteile bietet der c't-Artikel "Stromstöpsel".<<

my raspi runs quite stable with little picture formats (like 800x448 with ffmpeg), but 1280x720 will still draw the ethernet device down ;( with or without "options uvcvideo quirks=0x80") - although Arch Linux still uses softfp (but this is only a question of time ;) I feel that it runs smoother than debian with hardfp ...

the stripes are still there, I guess it's some timing problem ... but we will see, Lifecam works better for me than the logitech c270 e.g.

take care
Andreas
Posts: 12
Joined: Fri Jul 27, 2012 6:14 am
Location: Berlin, Germany
by ajb » Wed Aug 01, 2012 12:04 pm
for completness: firmware version is 328038 (release), and kernel Linux raspi 3.1.9+ #202 PREEMPT Wed Jul 25 22:11:06 BST 2012 armv6l GNU/Linux
Posts: 12
Joined: Fri Jul 27, 2012 6:14 am
Location: Berlin, Germany
by kermitas » Wed Aug 01, 2012 12:21 pm
ajb wrote:
that's definitely not good - my new power supply (see http://www.amazon.de/gp/product/B006SU9 ... 00_s00_i00 ), with raspi running at 800 MHz, has now a perfect 4,83 V under load (motion running, lifecam directly attached with a good 5m USB-cable, HDMI). Without load and no connections I can measure 4,96 V



Wery good :).

ajb wrote:my raspi runs quite stable with little picture formats (like 800x448 with ffmpeg), but 1280x720 will still draw the ethernet device down ;( with or without "options uvcvideo quirks=0x80")


Do you get lines when in 800x448?

Does you rpi works stable for many hours when in 80x448?

Do you use powered usb hub or plug webcam directly to rpi? (do you inject somehow power to camera's usb cable?)

ajb wrote:
although Arch Linux still uses softfp (but this is only a question of time ;) I feel that it runs smoother than debian with hardfp ...



Form where can I get Arch Linux or Debian that will use hardfp? (Or how I can change distribution from softpf to hardfp?)

Do I understand correctly that hardfp distribution may have problems with programs in repositories?
Will we compile motion to work on hardfp with no problems?

ajb wrote:
the stripes are still there, I guess it's some timing problem ... but we will see, Lifecam works better for me than the logitech c270 e.g.



Logitech C270 does not have focus. It is typical "skype webcam" so it works well in small distances (1m - 2m). I like it and it works stable with rpi (Debian Wheezy and F17) for many many days. I am thinking to buy C525 but first I should sell M$ LifeCam.

I will not buy Creative webcam any more. It works stable with rpi but when setting exposure_auto to 'aperture priority' it works fine when looking inside room. When looking outside the window images are totally overexposed!! So I use wrote script and use ImageMagick ('identify') to measure greyscale and if too high then I swich exposure_auto to 'manual mode' and expousre_absolute to 7.

ajb wrote:
take care
Andreas


Thank you,
take care u2.
Arthur
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am
by ajb » Wed Aug 01, 2012 12:22 pm
kermitas, could you try Lifecam with motion on following configuration please?

# use MJPEG, not YUYV
v4l2_palette 2
# input web cam
input 8
# VGA resolution (quite small)
width 640
height 480
# max framerate 30 fps
framerate 30
[...]
ffmpeg_cap_new off
[...]
webcam_quality 50
webcam_motion off
webcam_maxrate 5

please tell whether this is stable with your system ...
Posts: 12
Joined: Fri Jul 27, 2012 6:14 am
Location: Berlin, Germany
by ajb » Wed Aug 01, 2012 12:32 pm
Do you get lines when in 800x448?


Only a very few when I zoom with "v4l2-ctl --set-ctrl=zoom_absolute=10", with 0 I can't see any.

Does you rpi works stable for many hours when in 80x448?


Yes, I watched once a whole night my own sleeping :mrgreen:

Do you use powered usb hub or plug webcam directly to rpi? (do you inject somehow power to camera's usb cable?)


without, directly connected ... no power injection

BTW, M$ Lifecam Cinema has the following resolutions:

# Image resolutions:

# width 320 height 240 - ok, 2,6
# width 352 height 288 - ok
# width 640 height 352 -> 640x352 to 640x360, modulo-16-bug, but ok
# width 640 height 480 - ok
# width 800 height 448 - ok
# width 800 height 592 -> 800x592 to 800x600, modulo-16-bug, but ok
# width 960 height 544 - ok
# width 1280 height 720 - works, but slowly, so decrease fps to 10
Posts: 12
Joined: Fri Jul 27, 2012 6:14 am
Location: Berlin, Germany
by kermitas » Wed Aug 01, 2012 12:58 pm
ajb wrote:kermitas, could you try Lifecam with motion on following configuration please?

# use MJPEG, not YUYV
v4l2_palette 2
# input web cam
input 8
# VGA resolution (quite small)
width 640
height 480
# max framerate 30 fps
framerate 30
[...]
ffmpeg_cap_new off
[...]
webcam_quality 50
webcam_motion off
webcam_maxrate 5

please tell whether this is stable with your system ...


I am using motion trunk 557 so paramters are different (for example input = -1 for webcams).

Linux RPI_F17_CAM1 3.1.9+ #202 PREEMPT Wed Jul 25 22:11:06 BST 2012 armv6l armv6l armv6l GNU/Linux

Test started.

960x544 @ 15 fps snapshot every 1s, motion detection disabled
Wifi dongle went down after 1 minute (captured 58 frames) but it looks that rpi still works. I unplugged and plugged again wifi dongle (I have a script that will restart wpa_supplicant if no ping to gateway). WiFi dongle blikns but there is no ping and I can't ssh to rpi (so again probably USB / usb hub reset issue).
There were no lines!!

Next test.

960x544 @ 15 fps with quirks=128, snapshot every 1s, motion detection disabled
Works for 12 minutes, no lines.
TP1 TP2: 4.78V (rpi has it's own powerr supply 5V 2A, wifi + webcam another one 5V 2A)
Two times motion captured 5-8 grey frames with "unable to open video device".
Test still goes...
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am
by kermitas » Wed Aug 01, 2012 1:16 pm
ajb wrote:Yes, I watched once a whole night my own sleeping :mrgreen:



Watch carefully. Maybe you will catch your out of body experience (OOBE), orbs or just ufo outside your sleeping room window ;) ;).

ajb wrote:
without, directly connected ... no power injection



Check /sys/bus/usb/devices/1-1.3/bMaxPower !
In mine there is: 500mA.
Rpi can give you just 100mA!!

ajb wrote:
BTW, M$ Lifecam Cinema has the following resolutions:

# Image resolutions:

# width 320 height 240 - ok, 2,6
# width 352 height 288 - ok
# width 640 height 352 -> 640x352 to 640x360, modulo-16-bug, but ok
# width 640 height 480 - ok
# width 800 height 448 - ok
# width 800 height 592 -> 800x592 to 800x600, modulo-16-bug, but ok
# width 960 height 544 - ok
# width 1280 height 720 - works, but slowly, so decrease fps to 10


Ok, my test finished after 25 minutes - no connection with rpi.
In 1000 frames there are 10 that have very very little stripes.

In /var/log/messages I see:
Corrupt JPEG data: premature end of data segment
Invalid JPEG structure: two SOI markers.


Those messages are once every 1-2 minutes.

I wonder what more quirks we can use with M$ LifeCam?
Once I tryed NO_FID but it was worst - I couldn't get any image from cam.

Do you know how to use two or three quirks (is it a logic OR or what?)
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am
by ajb » Wed Aug 01, 2012 1:17 pm
do you start motion with "LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so /usr/bin/motion" ?
Posts: 12
Joined: Fri Jul 27, 2012 6:14 am
Location: Berlin, Germany
by kermitas » Wed Aug 01, 2012 1:47 pm
ajb wrote:do you start motion with "LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so /usr/bin/motion" ?


No, I have never use LD_PRELOAD.

What this line can do for us?
Did you used it? Did it help?
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am
by ajb » Wed Aug 01, 2012 2:12 pm
kermitas wrote:
ajb wrote:do you start motion with "LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so /usr/bin/motion" ?


No, I have never use LD_PRELOAD.

What this line can do for us?
Did you used it? Did it help?


Yes, you need it, I get "Video device fatal error - Closing video device" without it - just google to find some information about it - maybe this is one reason of your problem?
Posts: 12
Joined: Fri Jul 27, 2012 6:14 am
Location: Berlin, Germany
by kermitas » Wed Aug 01, 2012 2:28 pm
ajb wrote:
kermitas wrote:
ajb wrote:do you start motion with "LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so /usr/bin/motion" ?


No, I have never use LD_PRELOAD.

What this line can do for us?
Did you used it? Did it help?


Yes, you need it, I get "Video device fatal error - Closing video device" without it - just google to find some information about it - maybe this is one reason of your problem?


Wow, ok. I never used that but got sometimes "Video device fatal error - Closing video device" (I've just checked in /var/log/messages).
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am
by dom » Wed Aug 01, 2012 11:30 pm
There is a firmware update that can reduce the interrupt latency, which may help with packet loss.
You should udpate firmware (rpi-update or use bleeding-edge repository), and add
sdhci-bcm2708.missing_status=0 sdhci-bcm2708.sync_after_dma=0
to cmdline.txt.

(backing up first is recommended, just in case sdcard change cause any problems)
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4013
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge