13

Looking at the documentation about filters there seems to be a curve filter to manipulate color with the following presets:

  • color_negative
  • cross_process
  • darker
  • increase_contrast
  • lighter
  • linear_contrast
  • medium_contrast
  • negative
  • strong_contrast
  • vintage

Unfortunately the documentation doesn't mention what these presets do or what their parameters are. I'm looking for a simple option to take a video and auto level colors for all the frames. Does any of these presets do that?

1 Answer 1

9
+100

Here's the details on what the presets do:

[PRESET_COLOR_NEGATIVE] = {
    "0/1 0.129/1 0.466/0.498 0.725/0 1/0",
    "0/1 0.109/1 0.301/0.498 0.517/0 1/0",
    "0/1 0.098/1 0.235/0.498 0.423/0 1/0",
},
[PRESET_CROSS_PROCESS] = {
    "0.25/0.156 0.501/0.501 0.686/0.745",
    "0.25/0.188 0.38/0.501 0.745/0.815 1/0.815",
    "0.231/0.094 0.709/0.874",
},
[PRESET_DARKER]             = { .master = "0.5/0.4" },
[PRESET_INCREASE_CONTRAST]  = { .master = "0.149/0.066 0.831/0.905 0.905/0.98" },
[PRESET_LIGHTER]            = { .master = "0.4/0.5" },
[PRESET_LINEAR_CONTRAST]    = { .master = "0.305/0.286 0.694/0.713" },
[PRESET_MEDIUM_CONTRAST]    = { .master = "0.286/0.219 0.639/0.643" },
[PRESET_NEGATIVE]           = { .master = "0/1 1/0" },
[PRESET_STRONG_CONTRAST]    = { .master = "0.301/0.196 0.592/0.6 0.686/0.737" },
[PRESET_VINTAGE] = {
    "0/0.11 0.42/0.51 1/0.95",
    "0.50/0.48",
    "0/0.22 0.49/0.44 1/0.8",
}

For each preset, each x/y pair maps input x to output y, where the range is 0-1. If not set, the filter automatically sets 0/0 and 1/1 i.e. input black = output black and input white = output white. Whereas 0/1 would mean set input black pixels to white in output. Where you have multiple pairs in quotes, separated by commas, the sequence is "R","G","B" mapping. The interpolation between the points is natural cubic spline.


For auto leveling, a crude method would be use the autolevels subfilter of the pp filter.

ffmpeg -i input.mp4 -vf pp=al output.mp4

What this does is stretch luminance to full range.


To check levels before (and after) any adjustment you do, you can generate a RGB parade for a frame like so

ffmpeg -i input.mp4 -vf "format=rgb24,waveform=c=7:d=parade,scale=1200x512" -vframes 1 frame1parade.png

For a specific frame, use

ffmpeg -ss 12.4 -i input.mp4 -vf "format=rgb24,waveform=c=7:d=parade,scale=1200x512" -vframes 1 frameNparade.png
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.