yuvadjust

NAME

yuvadjust − adjust luminance and white balance of a
YUV4MPEG stream

SYNOPSIS

yuvadjust [-l] [-w|-W]
[-h] [-bframes] [-H]
[-c] [-v] [-d]

DESCRIPTION

Automatically adjust luminance level, contrast and white
balance of a YUV4MPEG stream. The input stream is read from
the standard input and the adjusted stream is written to the
standard output. The stream is adjusted according to the
gray world assumption.

This tool can be used to quickly enhance video which is
too dark or which is blueish or reddish. A typical example
would be a video recorded in a dimly lighted room. However,
because the gray world assumption is not valid for all
content, the result might also be worse, especially when
applied to high quality input. It is a good idea to
experiment and to compare the result to the original (see
also the -H option).

OPTIONS

−l

Adjust luminance level and contrast. The luminance
values of a frame are adjusted by calculating the average
luminance of the surrounding frames and then applying a
quadratic transformation which preserves nominal black and
white values while mapping the current average luminance
value to 50% gray. Notice that the resulting average
luminance is not necessarily 50% gray.

−w

Adjust white balance. The Cb/Cr values of a frame are
adjusted independently by calculating the average Cb/Cr
values of the surrounding frames and then shifting the Cb/Cr
values by constant amount so that the resulting stream is
gray on average. Conflicts with -W.

−W

Adjust white balance and color contrast. The Cb/Cr
values of a frame are adjusted independently by calculating
the average Cb/Cr values of the surrounding frames and then
applying a quadratic transformation which preserves nominal
minimum and maximum values while mapping the current average
color to gray. Notice that the resulting average color is
not necessarily gray. Conflicts with -w.

−h

Print brief usage information and exit immediately.

−bframes

Use information from up to frames buffered
surrounding frames to adjust a frame. Default is 30
frames.

−H

Adjust only the top half of each frame. This makes it
easy to compare the resulting video to the original. More
detailed analysis can be done using yuvinfo(1) with
the -H option to display YUV histograms of the original and
resulting streams.

−c

Clip output YUV values to their nominal range (16 to 235
for Y, 16 to 240 for U and V). This does not affect the way
adjustments are done, clipping is performed as a
post-processing step. Default is to use the full 8-bit
range.

−v

Be more verbose (writes extra information to standard
error).

−d

Enables debug output (writes debug information to
standard error). Use this option to see the exact
adjustments done for each frame. Implies -v.

SEE ALSO

mjpegtools(1), yuv4mpeg(5)

BUGS

yuvadjust depends fully on the gray world
assumption and there is no logic which would prevent it from
overshooting corrections. This is sometimes desirable when
processing really poor quality video material but it causes
surprises when applying this tool to higher quality
material.

AUTHOR

yuvadjust was implemented by Johannes Lehtinen.
For input and output it uses the mjpegutils library
provided by the mjpegtools(1) package.