[FFmpeg-user] Adjusting libavdevice/v4l2.c to support V4L2 controls

Goetz Dapp goetz.dapp at googlemail.com
Tue May 22 02:37:02 CEST 2012

Hi everybody,

in order to keep things a little easier to follow I have decided to
start a new thread and apologize for this doubling up. I also apologize
that I keep bringing this up, but I think it would be a very beneficial
feature for ffmpeg; VLC allows these controls but ffmpeg is far more useful.

I am still trying to find a way to control the V4L2 control IDs (eg.
http://v4l2spec.bytesex.org/spec/x802.htm particularly Section 1.9.6,
and http://linuxtv.org/downloads/v4l-dvb-apis/control.html, and
http://linuxtv.org/downloads/v4l-dvb-apis/extended-controls.html). I am
facing the problem that I am using two webcams with an autofocus and an
auto-white-balance, which regularly screws up the image, and makes
post-processing very difficult as both streams need to be almost identical.

In my previous email (subject: Re: [FFmpeg-user] Question about v4l2
controls and ffmpeg, also dts muxer problems) I got the following reply:

>>I am curious though if there is any way of controlling the v4l2
control ids through ffmpeg,
> No, but I believe it should be straight-forward to implement, see
v4l2_set_parameters() and
> options[] in libavdevice/v4l2.c

I am primarily interested in the autofocus and white balance features -
i.e. if I could just give ffmpeg the right integer value for my recording.

I am using the following command (for each camera):

ffmpeg -f video4linux2 -framerate 30 -video_size hd720 -input_format mjpeg -fflags igndts -an -i /dev/video0 -c:v copy -an /HDD2/test1.mjpeg

Ideally, I think, this could be something like a -v4l2_ctl_id flag or so.

I am not a programmer and thus at a loss as to how to get that into
libavdevice/v4l2.c as suggested. Could you help me out with that or
provide me with further pointers?

Thank you very much - I think you guys are doing a great job!

More information about the ffmpeg-user mailing list