1. pygame
  2. pygame
  3. pygame
  4. Issues

Issues

Issue #183 new

Pygame camera can't read from non-default v4l2 video inputs

Anonymous created an issue

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(linuxtv.org).

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

Comments (1)

  1. René Dudfield

    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:

    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.

  2. Log in to comment