blog of the software engineering student and occasional tweeter

ODROID-U2 running Gentoo Linux

Wednesday, January 30th, 2013

It’s finally here! The replacement for my Raspberry Pi which has caused many issues with its poorly-written USB drivers!

ODROID-U2

ODROID-U2


video4linux2: changing video input resolution

Wednesday, November 23rd, 2011

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.