Posted on November 23rd, 2011 by Milos Ivanovic Filed under Gentoo, Linux

Okay so I got myself a Logitech C910 HD webcam (on eBay, brand new for $59USD) which has native support for the linux UVC driver, meaning it’ll work on any linux distribution if you compile it with v4l2 support. That was great and all, but it took me far too long to find out how to actually change the output resolution for the webcam to be 1920×1080. So, for anyone who is on the same boat, here is what I did.

As I use Gentoo, I had to install the media-tv/v4l-utils package (other distributions should have a similar name). Once installed I played around with the binary files and found v4l2-ctl which is used to configure the webcam once it has been plugged in (only lasts per USB session).

Running v4l2-ctl –help yielded a truckload of output which was unpleasant at first, but the solution was found nevertheless. The important parameter is:

-v, --set-fmt-video=width=<w>,height=<h>,pixelformat=<f>
                     set the video capture format [VIDIOC_S_FMT]
                     pixelformat is either the format index as reported by
                     --list-formats, or the fourcc value as a string

which will send a control to the webcam to tell it to output in the given format and resolution. For 1080p I used -vwidth=1920,height=1080,pixelformat=YUYV

Once set, it was all kittens. Open the video device (/dev/video0 for me) with your desired program and it will use the format and resolution set in the above step.

Do note that the webcam does not remember these settings so when unplugging and plugging in again, you’ll have to repeat this command.


2 responses to “video4linux2: changing video input resolution”

  1. You should blog about your IRC bot!

  2. I should 😉 I’m releasing it on GitHub soon, in fact. Too many people want to see the sauce 😀

Leave a Reply