[MEncoder-users] Cannot go above 640x480 with v4l2 webcam capture

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Fri Nov 21 19:27:54 CET 2008


Hello,
On Wed, Nov 19, 2008 at 05:27:22PM +0100, Kovacs Peter Tamas wrote:
> I'm trying to capture a video stream from a Logitech Quickcam Pro for
> Notebooks webcam.
> I'm using the latest uvcvideo kernel module (from SVN), latest libwebcam
> (from SVN), and mencoder (from SVN).

This is not exactly a mencoder problem since it probably happens with
MPlayer, too. You should really always try with MPlayer, too, because
that narrows the problem down and the MPlayer-users list probably has
more readers.
Anyway, please try attached patch (and I'd be happy if you could try
playing around with it in general, not just the one thing you want to
work).

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: stream/tvi_v4l2.c
===================================================================
--- stream/tvi_v4l2.c	(revision 27961)
+++ stream/tvi_v4l2.c	(working copy)
@@ -710,6 +710,7 @@
 {
     struct v4l2_control control;
     struct v4l2_frequency frequency;
+    struct v4l2_format tmpformat;
 
     switch(cmd) {
     case TVI_CONTROL_IS_VIDEO:
@@ -775,7 +776,8 @@
         priv->format.fmt.pix.width = *(int *)arg;
         mp_msg(MSGT_TV, MSGL_V, "%s: set width: %d\n", info.short_name,
                *(int *)arg);
-        if (ioctl(priv->video_fd, VIDIOC_S_FMT, &priv->format) < 0) {
+        tmpformat = priv->format;
+        if (ioctl(priv->video_fd, VIDIOC_S_FMT, &tmpformat) < 0) {
             mp_msg(MSGT_TV, MSGL_ERR, "%s: ioctl set width failed: %s\n",
                    info.short_name, strerror(errno));
             return TVI_CONTROL_FALSE;
@@ -795,7 +797,8 @@
         priv->format.fmt.pix.field = V4L2_FIELD_ANY;
         mp_msg(MSGT_TV, MSGL_V, "%s: set height: %d\n", info.short_name,
                *(int *)arg);
-        if (ioctl(priv->video_fd, VIDIOC_S_FMT, &priv->format) < 0) {
+        tmpformat = priv->format;
+        if (ioctl(priv->video_fd, VIDIOC_S_FMT, &tmpformat) < 0) {
             mp_msg(MSGT_TV, MSGL_ERR, "%s: ioctl set height failed: %s\n",
                    info.short_name, strerror(errno));
             return TVI_CONTROL_FALSE;


More information about the MEncoder-users mailing list