Skip to content

Pygame camera can't read from non-default v4l2 video inputs (183) #198

Open
@GalacticEmperor1

Description

@GalacticEmperor1

Issue №183 opened by illume at 2013-11-03 20:54:40

Originally reported by: Anonymous


The camera module in pygame can read from /dev/videoN but only from the default input number 0, with the default norm.

Some video capture devices (like this one) must be given an input number and norm in order to work properly.

For example, to read input 1 as NTSC (not PAL) on that Kworld USB2800D device, you do this in mplayer:

mplayer tv:// -tv device=/dev/video1:input=1:norm=NTSC

In pygame there is no way to specify the equivalent of "input=1:norm=NTSC".

The neccesary details are specified [here](http://www.linuxtv.org/downloads/legacy/video4linux/API/V4L2_API/spec-single/v4l2.html# video)(linuxtv.org).

[Thanks to 'nrp' for explaining this to me on IRC.]


Related Docs: https://www.pygame.org/docs/ref/camera.html


Comments

# # illume commented at 2014-01-23 12:01:56

Original comment by René Dudfield (Bitbucket: illume, GitHub: illume):


For norm... it looks like the VIDIOC_S_STD is to be set. http://linuxtv.org/downloads/v4l-dvb-apis/vidioc-g-std.html

With a std_id type from here:
http://linuxtv.org/downloads/v4l-dvb-apis/vidioc-enumstd.html# v4l2-std-id

The code to set it will be something like:

# !C
v4l2_std_id std_id;
if (-1 == v4l2_xioctl (fd, VIDIOC_S_STD, std_id)) {
// error handling. "Error selecting %d VIDIOC_S_STD", std_id);
}

Then of course you will have to extend the Camera object to take in optional arguments.

src/camera_v4l2.c is where this all lives in the pygame source.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions