teerytko / python-video4linux2 Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/python-video4linux2
Automatically exported from code.google.com/p/python-video4linux2
I'm using svn python-v4l2 on Ubuntu on x86_64.
My System76 laptop's built-in video camera doesn't work with python-v4l2.
When I run recordpics (after I fix #11), I get:
Exception: Could not set standard NTSC: 22: Invalid argument
OK, so maybe my camera isn't a NTSC camera. So I tried it with all the
other standards, and none of them work. My camera does support v4l2 --
luvcview works fine, and captures images at 320x240.
I also tried sticking in a GetStandard call (using VIDIOC_G_STD), and that
also said Invalid argument. I did not try VIDIOC_ENUMSTD, because it
looked like a hassle.
I tried commenting out the call to SetStandard, but then I got No such
device in Read() (well, I did once I added error detection -- you should
really catch errors in Read())
P.S. Why do your function names not follow the Python coding standard?
Original issue reported on code.google.com by [email protected]
on 1 Feb 2009 at 4:46
There is a library 'libv4l' which is intended to convert between pixel formats.
http://hansdegoede.livejournal.com/3636.html
This could/should be use to support all (at present) unsupported formats by
converting them to RGB before passing to PIL image.
Mungewell.
Original issue reported on code.google.com by [email protected]
on 20 Mar 2009 at 3:21
# ./streampics.py -d /dev/video0 -i 0 -p BGR3 -x 640 -y 480 -o testpics
Traceback (most recent call last):
File "./streampics.py", line 94, in <module>
Run()
File "./streampics.py", line 56, in Run
d.SetStandard( d.standards['NTSC'] )
File "/root/python_motion/python-video4linux2-read-only/pyv4l2.py", line 466, in
SetStandard
lib.Error()
TypeError: %d format: a number is required, not str
What version of the product are you using? On what operating system?
Running svn revision 15
on 2.6.28-13-server #45-Ubuntu SMP Ubuntu Jaunty
Original issue reported on code.google.com by [email protected]
on 18 Jul 2009 at 12:48
./recordpics.py
Traceback (most recent call last):
File "./recordpics.py", line 94, in <module>
Run()
File "./recordpics.py", line 52, in Run
d.SetStandard( d.standards['NTSC'] )
File "/home/novalis/c/ff/ve/python-video4linux2-read-only/pyv4l2.py",
line 467, in SetStandard
lib.Error()
TypeError: int argument required
This is because your format string says %i for the name of the standard --
it should be:
raise Exception('Could not set standard %s:\t%i: %s' %
Original issue reported on code.google.com by [email protected]
on 1 Feb 2009 at 1:01
[deleted issue]
Testing with a couple of Logotech webcams; the code at present fails,
primarily due to not be able to set 'NTSC' (or other) standard.
With attached patch Camera now reports
--
simon@bourne:~/pyv4l/python-video4linux2-local-changes$ ./pyv4l2.py
Available devices: ['/dev/video0']
/dev/video0
Driver: uvcvideo
Card: UVC Camera (046d:08c3)
Bus Info: 0000:00:1d.1
Capabilities:
Capture
Streaming
Input 0:
Name: Camera 1
Type: camera
Standards: []
Status: []
Pixel formats:
MJPG MJPEG
Resolutions:
320x240
640x480
--
There are also some other quirks, attached below is a set of patches that
get the code talking to the camera capturing to buffer.
I have not done the required changes to SaveJPEG yet... I just placed a
temporary 'return' at start of function to get the whole thing running.
--
simon@bourne:~/pyv4l/python-video4linux2-local-changes$ ./streampics.py -d
/dev/video0 -p MJPG -x 320 -y 240
Trying to create directory pics
Could not create directory [Errno 17] File exists: 'pics'
Recording /dev/video0:0 with format MJPG at (320, 240)
................................................................................
..........
Keyboard interrupt caught. Quitting...
Saved 90 pictures in 6.15 seconds: 14.63 fps
--
Cheers,
Mungewell
Original issue reported on code.google.com by [email protected]
on 2 Feb 2009 at 7:10
Attachments:
guessing the driver does not support d.SetInput().
sudo make load (loads vga2usb, see #1 USB2VGA http://chipy.org/V4l2forPyCon)
[ 220.039113] VGA2USB is now attached to vga2usb-192
(somehow that means /dev/video1
juser@dhcp186:~/vga2usb/py/python-video4linux2-trunk$ ./recordpics.py -d
/dev/video1
{'height': '600', 'width': '800', 'pixelformat': 'RGB4', 'device':
'/dev/video1', 'input': '0', 'outputdir': ''}
RGB4
Traceback (most recent call last):
File "./recordpics.py", line 87, in <module>
Run()
File "./recordpics.py", line 43, in Run
d.SetInput( int(options.input) )
File "/home/juser/vga2usb/py/python-video4linux2-trunk/pyv4l2.py", line
418, in SetInput
(input, lib.Errno(), lib.Error())
Exception: Could not set input 0: 515: Unknown error 515
Original issue reported on code.google.com by [email protected]
on 28 Oct 2008 at 9:43
modprobe vivi
[ 52.702938] vivi: V4L2 device registered as /dev/video0
./recordpics.py /dev/video0 0 RGB4 800 600 test
(stack dump)
Program received signal SIGABRT, Aborted.
Original issue reported on code.google.com by [email protected]
on 28 Oct 2008 at 4:24
StreamOn is called twice in SetupStreaming in pyv4l2.py, on lines 682 and 692.
Solution: Remove pyv4l2.py:682.
Original issue reported on code.google.com by [email protected]
on 27 Feb 2009 at 9:59
It's good that each file contains a copyright and license notice, but
writing just three letters instead of giving the full name, author and URL
of the license is not enough.
# Released under the GPL v3 by Jackson Yee ([email protected])
# Copyright 2008
Solution: The copyright holder should change the notice. This is the text
recommended by the GNU General Public License:
# <one line to give the program's name and a brief idea of what it does.>
# Copyright (C) <year> <name of author>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
The recommended text unlike the current notice also allows future versions
of the GNU GPL to be used. The copyright holder may change the text to
continue to allow only GPLv3, but I recommend allowing future versions.
Original issue reported on code.google.com by [email protected]
on 27 Feb 2009 at 10:13
What steps will reproduce the problem?
1. Use Debian Etch
2. Run pyv4l2.py
3.
What is the expected output? What do you see instead?
It should just run, but instead complains about missing ctypes package
What version of the product are you using? On what operating system?
Etch on 386. 2.6.26 kernel.
Please provide any additional information below.
apt-get python-ctypes fixes it. Also note, once this is done, both the
test programs run well using Kodicom 4400 hardware. Nice work!
Original issue reported on code.google.com by [email protected]
on 7 Nov 2008 at 10:20
The call to 'StartStreaming' is blocking, that is it does not return until
the CallBackFunction returns false.
Should (in my opinion) be a threaded system where 'StartStreaming' creates
a task/thread/process which handle the capture of the image from the
hardware into a buffer.
You would also need a 'StopStreaming' method to enable interrupting it
without doing it in the CallBackFunction.
Original issue reported on code.google.com by [email protected]
on 6 Feb 2009 at 4:29
The strings in the 'pixelformats' tuple are only valid for little-endian
systems. The code should implement the same functionality as the C-macro
used in the V4L2 headers:
#define v4l2_fourcc(a,b,c,d)\
(((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)
(d)<<24))
...
#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R','G','B','4') /* 32
RGB-8-8-8-8 */
...
Original issue reported on code.google.com by [email protected]
on 21 Apr 2009 at 6:48
juser@dhcp186:~/python-video4linux2$ sudo modprobe vivi
>>> import pyv4l2
>>> d=pyv4l2.Device('/dev/video0')
>>> d.GetResolutions()
[]
>>> quit()
Program received signal SIGSEGV, Segmentation fault.
Original issue reported on code.google.com by [email protected]
on 30 Oct 2008 at 10:20
The PVR-150 asserts with invalid number of buffers
--
simon@myth:~/python-video4linux2-fps$ ./streampics.py -p MH12
Trying to create directory pics
Could not create directory [Errno 17] File exists: 'pics'
Recording /dev/video0:0 with format MPEG at (640, 480 )
Traceback (most recent call last):
File "./streampics.py", line 109, in <module>
Run()
File "./streampics.py", line 93, in Run
d.SetupStreaming(5, StreamCallback)
File "/home/simon/python-video4linux2-fps/pyv4l2.py", line 757, in
SetupStreaming
self.MapBuffers( self.RequestBuffers(numbuffers) )
File "/home/simon/python-video4linux2-fps/pyv4l2.py", line 664, in
RequestBuffers
lib.Error()
Exception: Could not request 5 buffers: 22: Invalid argument
--
Original issue reported on code.google.com by [email protected]
on 7 Feb 2009 at 3:30
I replaced all the sys.argv[] stuff with OptionParser stuff, so now things
look like:
parser.add_option("-d", "--device", dest="device",
help="video device", default="/dev/video0" )
d = pyv4l2.Device(options.device)
and I don't have to type /dev/video0 ever again :)
It needs a little work, the --help doesn't show the defaults - pretty sure
there is a way to turn that on. but it's good enough, and maybe someone
else can make it better.
Original issue reported on code.google.com by [email protected]
on 28 Oct 2008 at 9:30
Attachments:
Since there is no where else to put it, here it is.
Fairly basic app with it's own problems, most significantly it is affected
by the 'blocking issue'
(http://code.google.com/p/python-video4linux2/issues/detail?id=14) where
GTK app is unresponsive whilst streaming and you have to Ctrl-C on terminal
to stop video.
You will need the patches found in this Issue:
http://code.google.com/p/python-video4linux2/issues/detail?id=13
Original issue reported on code.google.com by [email protected]
on 6 Feb 2009 at 4:34
Attachments:
SetStandard isn't supported by webcams. Catch the exception and check the
error number. If it's 22, print a notice that the device does not support
setting standard, otherwise re-raise exception.
SVN r15
recordpics.py:52: d.SetStandard( d.standards['NTSC'] )
streampics.py:56: d.SetStandard( d.standards['NTSC'] )
Original issue reported on code.google.com by [email protected]
on 27 Feb 2009 at 9:45
PVR-150 can only output in MH12 and MPEG. Neither of which are recognised
by PIL.
--
simon@myth:~/python-video4linux2-fps$ ./recordpics.py -p HM12
Trying to create directory test
Could not create directory [Errno 17] File exists: 'test'
Recording /dev/video0:0 with format MPEG at (640, 480)
Traceback (most recent call last):
File "./recordpics.py", line 94, in <module>
Run()
File "./recordpics.py", line 77, in Run
d.SaveJPEG(filename, 70)
File "/home/simon/python-video4linux2-fps/pyv4l2.py", line 877, in SaveJPEG
img = self.CaptureImage(buffer)
File "/home/simon/python-video4linux2-fps/pyv4l2.py", line 860, in
CaptureImage
1)
File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 1806, in
frombuffer
return apply(fromstring, (mode, size, data, decoder_name, args))
File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 1745, in
fromstring
im.fromstring(data, decoder_name, args)
File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 571, in fromstring
d = _getdecoder(self.mode, decoder_name, args)
File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 374, in
_getdecoder
return apply(decoder, (mode,) + args + extra)
ValueError: unknown raw mode
--
Original issue reported on code.google.com by [email protected]
on 7 Feb 2009 at 3:33
plug in ID 046d:092c Logitech, Inc. QuickCam Chat
$ ./recordpics.py -d /dev/video2
*** glibc detected *** python: malloc(): memory corruption: 0x08f1dee8 ***
Original issue reported on code.google.com by [email protected]
on 28 Oct 2008 at 9:37
Despite posting several Issues/Patches and attempting to contact the
developers with email, I have not been able to make contact.
I hope that they are just on a Caribbian Cruse rather than having been
abducted by aliens, but how long does/should one have to wait....?
I note that it is perfectly legal to fork this project (as it's GPL V3),
but I would prefer to work with the developers and keep some consistancy
with their vision.
Mungewell.
Original issue reported on code.google.com by [email protected]
on 17 Feb 2009 at 5:50
juser@dhcp186:~/python-video4linux2$ ./recordpics.py -d /dev/video1
*** glibc detected *** python: malloc(): memory corruption: 0x08445588 ***
(stackdump)
Original issue reported on code.google.com by [email protected]
on 30 Oct 2008 at 10:33
sudo modprobe vivi
juser@dhcp186:~/vga2usb/py/python-video4linux2-trunk$ dmesg | grep vivi
[ 1811.915266] vivi: V4L2 device registered as /dev/video0
>>> import pyv4l2
>>> d=pyv4l2.Device('/dev/video0')
>>> x=d.GetResolutions()
Program received signal SIGSEGV, Segmentation fault.
Original issue reported on code.google.com by [email protected]
on 29 Oct 2008 at 1:55
What steps will reproduce the problem?
1. d = pyv4l2.Device("/dev/video1")
2. d.Close()
3. # crash NameError: global name 'fd' is not defined
What is the expected output? What do you see instead?
crash NameError: global name 'fd' is not defined
What version of the product are you using? On what operating system?
* SVN r25, Ubuntu 10.O4
Please provide any additional information below.
patch file in attachement
Original issue reported on code.google.com by [email protected]
on 23 Nov 2011 at 2:30
Attachments:
>>> import pyv4l2
>>> d=pyv4l2.Device('/dev/video1')
>>> x=d.GetResolutions()
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7e488c0 (LWP 5943)]
0xb7eb4ff9 in malloc_consolidate (av=0xb7f89140) at malloc.c:4860
4860 malloc.c: No such file or directory.
in malloc.c
Original issue reported on code.google.com by [email protected]
on 31 Oct 2008 at 1:32
Unexplained crash when running with fast machine.
--
ubuntu@ubuntu:~/pyDataMatrixScanner$ ./streamgtk.py -p MJPG -g -b -l
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.5/threading.py", line 486, in __bootstrap_inner
self.run()
File "./streamgtk.py", line 108, in run
self.device.SetupStreaming(5, self.callback)
File "/home/ubuntu/pyDataMatrixScanner/pyv4l2.py", line 773, in
SetupStreaming
string_at( self.buffers[b.index][1], self.buffers[b.index][2] )
File "./streamgtk.py", line 247, in StreamCallback
if not self.videodevice.StreamCallback(capture, buffer_num, pointer):
File "./streamgtk.py", line 60, in StreamCallback
image = capture.CaptureImage(pointer)
File "/home/ubuntu/pyDataMatrixScanner/pyv4l2.py", line 837, in CaptureImage
fakefile = StringIO(self.InsertHuffman(buffer))
TypeError: expected read buffer, bool found
--
Original issue reported on code.google.com by [email protected]
on 26 Mar 2009 at 1:30
This In function StreamOn:
pyv4l2.py:633: if lib.StreamOn(self.fd) == -1:
In function StreamOff:
pyv4l2.py:642: if lib.StreamOff(self.fd) == -1:
pyv4lconnector.c:140: int StreamOn(int fd, int type)
pyv4lconnector.c:146: int StreamOn(int fd, int type)
----
Solution: Remove argument 'type'.
int StreamOn(int fd)
{
int type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
return ioctl(fd, VIDIOC_STREAMON, &type);
}
int StreamOff(int fd)
{
int type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
return ioctl(fd, VIDIOC_STREAMOFF, &type);
}
Original issue reported on code.google.com by [email protected]
on 27 Feb 2009 at 10:04
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.