[MPlayer-users] Mplayer resets v4l2 webcam settings

Kovacs Peter Tamas p.kovacs at holografika.com
Tue Dec 9 16:10:26 CET 2008


Dear All,

let me answer my own question here for further reference for others 
bumping into the same problem later on.

So from the command line you can see that the v4l2 webcam capture is 
implemented through the TV interface:
./mplayer -tv driver=v4l2:width=640:height=480:device=/dev/video -vo xv 
tv://
This is also visible from the name of the file implementing v4l2 
support: stream/tvi_v4l2.c, which (among other things) does a mapping 
between TVI controls and V4L2 controls in functions control and set_control.
Now the file stream_tv.c contains default values for various settings 
for TV interfaces (stream_tv_defaults), including brightness, contrast, 
hue and saturation, and these default values are then set in tv.c 
demux_open_tv() in these lines:

    tv_set_color_options(tvh, TV_COLOR_BRIGHTNESS, 
tvh->tv_param->brightness);
    tv_set_color_options(tvh, TV_COLOR_HUE, tvh->tv_param->hue);
    tv_set_color_options(tvh, TV_COLOR_SATURATION, 
tvh->tv_param->saturation);
    tv_set_color_options(tvh, TV_COLOR_CONTRAST, tvh->tv_param->contrast);

I've found no way to disable this behavior from the command line, but at 
least I can modify the values that are set on startup, like:
./mplayer -tv 
driver=v4l2:width=640:height=480:brightness=100:device=/dev/video -vo xv 
tv://


Now back to the original problem:
It's fine that I can now set these parameters from the mplayer/mencoder 
command line, but the webcam does have several other parameters like 
Exposure, Auto Exposure, Focus, White balance temperature, etc that are 
not covered by the TVI options, nor mapped between mplayer and the v4l2 
interface by tvi_v4l2. Which means that if I want to have full control 
over all the parameters, I need to set some of them from uvcdynctrl, and 
set others from the mplayer command line.
To solve this, I can see two ways:
1. include all other webcam specific settings in these modules and map 
them to v4l2
2. disable setting defaults on startup permanently or via a command line 
option.
Solution 1 seems to be strange (for me at least), to have a TV interface 
with focus and exposure controls (plus a number of other options which 
are specific to a camera, like pan/tilt controls).
Solution 2 can be done locally by just commenting these lines out, but 
I'd like to have a non-temporary solution, like a command line switch to 
disable this (disabling it altogether would cause problems for others 
relying on this feature).
Which one do you think would be more practical, and mplayer-style? (so 
that I can submit it as a proposed patch later)

Thanks,
Peter

> Dear All,
>
> I'm trying to display / capture the video stream coming from my Logitech 
> Quickam pro for notebooks (via v4l2, using latest uvcvideo kernel 
> module, latest libwebcam and mplayer/mencoder all from SVN), my webcam 
> settings (brightess, contrast, autofocus, gain, etc) are all reset.
>
> If I set webcam params using uvcdynctrl 
> (http://www.quickcamteam.net/software/libwebcam), then start 
> mplayer/mencoder, it starts capturing with default webcam settings.
> If I start capturing, and then set the params during the capture with 
> uvcdynctrl, I can see them changing, but then it's too late.
>
> How can I ask mplayer to keep the settings as they are? Alternatively, 
> how can I pass webcam params on the command line to mplayer so that it 
> sets the requested params before starting to capture?
>
> Thanks for your help,
> Peter
> _______________________________________________
> MPlayer-users mailing list
> MPlayer-users at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/mplayer-users
>   




More information about the MPlayer-users mailing list