PDA

View Full Version : v4l2src unavailable


Xinef
27th June 2007, 09:58 AM
Hello,

I have been trying to get my uvc webcam with v4l2 on gstreamer.
It works fine with ekiga.
But in the Multimedia System selector (gstreamer-properties) only v4l (v4lsrc pipeline) appears and even entering v4l2src in custom doesn't fix it (no element *** error message).
Doing some research I found that v4l2src was supposed to be included in gstreamer-pluggin-good or bad, I installed everything anyways and rebooted and couldn't get it yet. (used livna rep)
Is the v4l2src missing ?
If anyone could share some experience on that I'd really appreciate.
Cheers,

Quentin

Xinef
30th June 2007, 02:19 AM
bump
No info at all about this ?

ik486
30th June 2007, 05:09 AM
[QUOTE=Xinef]Hello,d


i want to connect my pctv video tunner to my laptop

and i installed gstreamer-plugin-good-0.10.6 for v4l2src plugin element.
and i failed to install and my fedora 7 is giving following error message

configure: *** checking feature: Video 4 Linux 2 ***
configure: *** for plug-ins: v4l2src ***
configure: WARNING: *** v4l2src pre-configured not to be built
configure: *** These plugins will not be built: v4l2src
checking for X... libraries , headers

i tried with
./configure --prefix=/usr --with-PACKAGE=v4l2src

still i am getting same error message


pl help me

Ignatius Kunjumon

Xinef
30th June 2007, 07:01 AM
Yum doesn't give me any rpm about gstreamer-plugin-good-0.10.6 and I don't have v4l2src from the 0.10.5 either. Looks like we need some expert of the project to give us some light on this...

ik486
7th July 2007, 07:17 AM
I have solved the problem, now i am getting video, but no sound
I am still trying

I have written a small c program to solve it. I am using v4l, you use v4l2 also
This is my code
#include <Python.h>
#include <fcntl.h>
#include <linux/videodev.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <math.h>


void ikCapability(int fd) {
int maxChannels;
int i, val;
struct video_channel channel;
struct video_capability vc;
val = ioctl(fd, VIDIOCGCAP, &vc);
printf("\n==================================\n");
printf("Capability\n");
if (val < 0) printf("FAILED");
printf("----------------------------------\n");
printf("Name : %s\n",vc.name);
printf("type : %d\n",vc.type);
printf("No of Channels : %d\n",vc.channels);
printf("No of Audio Devices : %d\n",vc.audios);
printf("Max Width : %d\n",vc.maxwidth);
printf("Max Height : %d\n",vc.maxheight);
printf("Min Width : %d\n",vc.minwidth);
printf("Min Height : %d\n",vc.minheight);
printf("..................................\n");
maxChannels = vc.channels;
for (i = 0; i < maxChannels; i++)
{
channel.channel = i;
ioctl(fd, VIDIOCGCHAN, &channel);
printf("\tNo %d\n",i);

if (channel.flags & 1) printf("\tVIDEO_VC_TUNER (Channel has a tuner)\n");
if (channel.flags & 2) printf("\tVIDEO_VC_AUDIO (Channel has audio)\n");
printf("\tflags : %d\n", channel.flags);

printf("\tChannel Name : %s\n", channel.name);
if (channel.type == 1) printf("\tType : VIDEO_TYPE_TV\n");
else if (channel.type == 2) printf("\tType : VIDEO_TYPE_CAMERA\n");
else printf("\tType : ?\n");
printf("\n");
}
printf("==================================\n");
}



void ikGetTuner(int fd) {
int val;
struct video_tuner vt;
val = ioctl(fd, VIDIOCGTUNER, &vt);
printf("\n==================================\n");
printf("Tuner Info\n");
if (val < 0) printf("FAILED");
printf("----------------------------------\n");
printf("Tuner : %d\n", vt.tuner);
printf("Name : %s\n", vt.name);
printf("Range Low : %lu\n", vt.rangelow);
printf("Range Heigh : %lu\n", vt.rangehigh);
}

static PyObject * IKTelevision_Open(PyObject *self, PyObject *args) {
int fd;
int val;
char *file;
struct video_channel vch;
struct video_tuner vt;

PyArg_ParseTuple(args, "s", &file);

fd = open(file, O_RDWR);

if (fd == -1) {
Py_INCREF(Py_None);
return Py_None;
}

ikCapability(fd);

vch.channel = 0;
val = ioctl(fd, VIDIOCSCHAN, &vch);
if (val < 0) {
close(fd);
Py_INCREF(Py_None);
return Py_None;
}

val = ioctl(fd, VIDIOCGCHAN, &vch);
if (val < 0) {
close(fd);
Py_INCREF(Py_None);
return Py_None;
}


printf("----------------------------------\n");
printf("Channel : %d\n",vch.channel);
printf("Name : %s\n",vch.name);
printf("Tuners : %d\n",vch.tuners);

vt.tuner = 0;
vt.flags = VIDEO_TUNER_PAL;
vt.mode = VIDEO_MODE_PAL;
val = ioctl(fd, VIDIOCSTUNER, &vt);
if (val < 0) {
close(fd);
Py_INCREF(Py_None);
return Py_None;
}

ikGetTuner(fd);
return Py_BuildValue("i", fd);
}


static PyObject * IKTelevision_Frequency(PyObject *self, PyObject *args) {
int no;
int fd;
int val;
unsigned long freq[63] = {879, 991, 1100, 1212, 1327, 1440, 1548, 1678, 1788,
1902, 2011, 2124, 2240, 2349, 2461, 2572, 2685, 2798, 2908, 3022, 3132, 3248,
3468, 3692, 3804, 3916, 4028, 4144, 4254, 4364, 4477, 4589, 4703, 4847, 4972,
5101, 5231, 5359, 5486, 5615, 5743, 5868, 5996, 6125, 6255, 6381, 6509, 6638,
6769, 7658, 7917, 8043, 9071, 9196, 9324, 9453, 9577, 9706, 9836, 9963, 10093,
10219, 10476};
PyArg_ParseTuple(args, "ii", &fd, &no);
if (no > 62) {
no = 62;
}
val = ioctl(fd, VIDIOCSFREQ, &freq[no]);
if (val < 0) {
Py_INCREF(Py_None);
return Py_None;
}
return Py_BuildValue("l", freq[no]);
}




static PyObject * IKTelevision_Read(PyObject *self, PyObject *args) {
int fd;
unsigned char *buffer = PyMem_New(unsigned char, 720*576*2);
int len, val;
PyObject *res;
PyArg_ParseTuple(args, "i", &fd);
len = 720*576*2;
val = read (fd, buffer, len);
if (val < len) {
Py_INCREF(Py_None);
return Py_None;
}
res = Py_BuildValue("s#", buffer, val);
PyMem_Free(buffer);
return res;
}

static PyObject * IKTelevision_Close(PyObject *self, PyObject *args) {
int fd;
PyArg_ParseTuple(args, "i", &fd);
close(fd);
Py_INCREF(Py_None);
return Py_None;
}

static PyMethodDef IkTelevisionMethods[] = {
{"open", IKTelevision_Open, METH_VARARGS, "Open video /dev/video"},
{"channel", IKTelevision_Frequency, METH_VARARGS, "Set Channel 0 -> 62"},
{"read", IKTelevision_Read, METH_VARARGS, "Read Video Image"},
{"close", IKTelevision_Close, METH_VARARGS, "Close video /dev/video"},
{NULL, NULL, 0, NULL}
};


PyMODINIT_FUNC
initIKTV(void)
{
(void) Py_InitModule("IKTV", IkTelevisionMethods);
}

jdeslip
3rd September 2007, 08:57 AM
Hi Xinef,

I have the exact same problem with my new uvc-video webcam - cheese, a nice new gstreamer app, seems to give the following error

** Message: test pipeline for v4l2src failed:
[v4l2src ! fakesink]: no element "v4l2src"

and then it says no webcam found. If works fine (but slow and bad quality) with my old gspca v4l1 cam. Have you fixed it? I am not sure whether lk486 comments are relevant or not... Have you worked out this problem?

Xinef
3rd September 2007, 11:32 AM
Hello,

Well I am afraid the problem is about v4l2.
Or more like a missing module in gstreamer to handle v4l2.
So I would expect it to be fixed in the near future with a gstreamer update.
After checking I was actually amazed seeing how few the applications supporting v4l2 were.
Let us just pray that someone is actually working on that.
Thanks for your message and sorry for not being of any help :(
Cheers

jdeslip
3rd September 2007, 07:44 PM
Hmm, but if you look here: http://live.gnome.org/Cheese - you see that they "highly recommend" V4l2 cameras. This must mean v4l2 support for gstreamer is available in principle... Perhaps it is a bug in the fedora packages?

-Jack

Xinef
4th September 2007, 02:00 AM
Ok, little update.
I tried the gstreamer-plugins-good rpm available in the test repository (0.10.6 version as an update of the 0.10.5 I was using).
And guess what ? Now an option magically appeared in the drop list menu: v4l2 !
My webcam is still not working due to some other hardware issues, but maybe this will be enough to solve your issue.
The explanation was about the v4l2 plugin that was supposed to be in gstremer-plugins-bad (which was not available in fedora, and with a messed up package in livna... anyways didn't work) and which has now been switched to gstreamer-plugins-good.
If you don't wanna risk the test repository, you can wait a couple more days as we can expect it to be available in the update rep very soon now. :)

jdeslip
4th September 2007, 05:12 AM
I tried the the package in the test repo - but my linux-uvc webcame still doesn't seem to be found in cheese. What program gave you this drops down menu with v4l2? Do I need to select something in gstreamer?

Xinef
4th September 2007, 05:16 AM
Yes, you need to get into the gstreamer properties (in a terminal you can type gstreamer-properties) and then in the video tab select your video source.
You should be able to select v4l2 instead of v4l. If it still doesn't work, that means you have, like me, another problem...

jdeslip
5th September 2007, 08:29 PM
So, I did what you suggested. When I select v4l2 as my video source in gstreamer-properties and click on test I get: Video for Linux 2 (v4l2): Could not get buffers from device '/dev/video0' - and Cheese still does not work... Any idease? My webcam does work in other applications like amsn/ekiga/luvcview.

jdeslip
11th September 2007, 07:12 AM
I discovered this bug report today at gnome: http://bugzilla.gnome.org/show_bug.cgi?id=467214

Looks like our issue will be solved soon...

Xinef
11th September 2007, 11:21 AM
That is great news, thank you for forwarding it.
Looking forward to the update even more :)

Valencia - Dallas - Beira -