Basic info
In MPlatform it's possible to use some of the native FFMPEG video filters with MPlatform objects.
With them, you can implement some scenarios that we don't have in the SDK. Like, create a histogram or swap U and V plane.
To implement video filters to your MPlamplatform object you should use the PropsSet method.
m_objMPPlaylist.PropsSet("object::vfilter", "[name_of_the_video_filter]");
For the quick test, you can open a Playlist Sample,
"C:\Program Files (x86)\Medialooks\MPlatform SDK\Sample x64 Playlist.lnk"
add a video file, make a double click on the file name, go to the bottom of the available properties list and add new property "object::vfilter".
Now you can manage the vildeo filter of the open file with the value of the "object::vfilter" property.
Note: Video filter will increase the load of your CPU. For example, i7-4770, Playlist Sample, video file 1080 30p,playback without conversion-CPU load - 14-16%. With "colorbalance=rs=.3" CPU load 22-24%.
List of availible video filters
Name | Description | Additional parametres |
---|---|---|
avgblur |
Apply average blur filter. avgblur=sizeX=10:sizeY=4 |
|
ciescope |
Display CIE color diagram with pixels overlaid onto it. |
The filter accepts the following options:
|
Modify intensity of primary colors (red, green and blue) of input frames. colorbalance=rs=.3 |
The filter allows an input frame to be adjusted in the shadows, midtones or highlights regions for the red-cyan, green-magenta or blue-yellow balance. A positive adjustment value shifts the balance towards the primary color, a negative value towards the complementary color. The filter accepts the following options:
|
|
Adjust video input frames using levels. colorlevels=romin=0.5:gomin=0.5:bomin=0.5 |
The filter accepts the following options:
|
|
Adjust video input frames by re-mixing color channels. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3 |
This filter modifies a color channel by adding the values associated to the other channels of the same pixels. For example if the value to modify is red, the output value will be: red=red*rr + blue*rb + green*rg + alpha*ra The filter accepts the following options:
|
|
|
Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements. convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 |
The filter accepts the following options:
|
crop |
Crop the input video to given dimensions. crop=1000:1000 |
Crop the input video to given dimensions. It accepts the following parameters:
The out_w, out_h, x, y parameters are expressions containing the following constants:
The expression for out_w may depend on the value of out_h, and the expression for out_h may depend on out_w, but they cannot depend on x and y, as x and y are evaluated after out_w and out_h. The x and y parameters specify the expressions for the position of the top-left corner of the output (non-cropped) area. They are evaluated for each frame. If the evaluated value is not valid, it is approximated to the nearest valid value. The expression for x may depend on y, and the expression for y may depend on x. |
curves |
Apply color adjustments using curves. Vintage effect: curves=r='0/0.11 .42/.51 1/0.95':g='0/0 |
This filter is similar to the Adobe Photoshop and GIMP curves tools. Each component (red, green and blue) has its values defined by N key points tied from each other using a smooth curve. The x-axis represents the pixel values from the input frame, and the y-axis the new pixel values to be set for the output frame. By default, a component curve is defined by the two points (0;0) and (1;1). This creates a straight line where each original pixel value is "adjusted" to its own value, which means no change to the image. The filter allows you to redefine these two points and add some more. A new curve (using a natural cubic spline interpolation) will be define to pass smoothly through all these new coordinates. The new defined points needs to be strictly increasing over the x-axis, and their x and y values must be in the [0;1] interval. If the computed curves happened to go outside the vector spaces, the values will be clipped accordingly. The filter accepts the following options:
To avoid some filtergraph syntax conflicts, each key points list need to be defined using the following syntax: |
fade |
Apply a fade-in/out effect to the input video. fade=in:0:30 |
It accepts the following parameters:
|
gblur |
Apply Gaussian blur filter. gblur=sigma='4' |
The filter accepts the following options:
|
hflip |
Flips the video horizontally
|
|
histogram |
Compute and draw a color distribution histogram for the video. |
The computed histogram is a representation of the color component distribution in an image. Standard histogram displays the color components distribution in an image. Displays color graph for each color component. Shows distribution of the Y, U, V, A or R, G, B components, depending on input format, in the current frame. Below each graph a color component scale meter is shown. The filter accepts the following options:
|
hue |
Modify the hue and/or the saturation of the video. hue=H=PI/2:s=1 hue=h=90:s=1:b=-2 |
It accepts the following parameters:
h and H are mutually exclusive, and can’t be specified at the same time. The b, h, H and s option values are expressions containing the following constants:
|
negate |
Negate the video. |
It accepts the following option:
|
showpalette |
Displays the 256 colors palette of each frame. This filter is only relevant for pal8 pixel format frames.
|
It accepts the following option:
|
swapuv |
Swap U and V plane. |
|
vectorscope |
Display 2 color component values in the two-dimensional graph (which is called a vectorscope). (all parameters are default): vectorscope=m=color5:g=color:l=0.5
|
This filter accepts the following options: mode, m : Set vectorscope mode. The mode parameter accepts the following values: gray : Gray values are displayed on graph, higher brightness means more pixels have same component color value on location in graph. This is the default mode. color : Gray values are displayed on graph. Surrounding pixels values which are not present in video frame are drawn in gradient of 2 color components which are set by option x and y. The 3rd color component is static. color2 : Actual color components values present in video frame are displayed on graph. color3 : Similar as color2 but higher frequency of same values x and y on graph increases value of another color component, which is luminance by default values of x and y. color4 : Actual colors present in video frame are displayed on graph. If two different colors map to same position on graph then color with higher value of component not present in graph is picked. color5 : Gray values are displayed on graph. Similar to color but with 3rd color component picked from radial gradient. x : Set which color component will be represented on X-axis. Default is 1. y : Set which color component will be represented on Y-axis. Default is 2. intensity, i : Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness of color component which represents frequency of (X, Y) location in graph. envelope, e : The envelope. The envelope parameter accepts the following values: none : No envelope, this is default. instant : Instant envelope, even darkest single pixel will be clearly highlighted. peak : Hold maximum and minimum values presented in graph over time. This way you can still spot out of range values without constantly looking at vectorscope. peak+instant : Peak and instant envelope combined together. graticule, g : Set what kind of graticule to draw. The graticule parameter accepts the following values: none : No graticule. green : Green graticule. color : Color graticule. opacity, o : Set graticule opacity in [0,1] range. flags, f : Set graticule flags. The graticule flags parameter accepts the following values: white : Draw graticule for the white point. black : Draw graticule for the black point. name : Draw color points short names. bgopacity, b: Set background opacity in [0,1] range. lthreshold, l : Set low threshold for color component not represented on X or Y axis. Values lower than this value will be ignored. Default is 0. Note this value is multiplied with actual max possible value one pixel component can have. So for 8-bit input and low threshold value of 0.1 actual threshold is 0.1 * 255 = 25. hthreshold, h : Set high threshold for color component not represented on X or Y axis. Values higher than this value will be ignored. Default is 1. Note this value is multiplied with actual max possible value one pixel component can have. So for 8-bit input and high threshold value of 0.9 actual threshold is 0.9 * 255 = 230. colorspace, c : Set what kind of colorspace to use when drawing graticule. The colorspace parameter accepts the following values: auto : Detect colorspace automatically. This is a default value. 601 : Set 601 colorspace. 709 : Set 709 colorspace. |
waveform |
Video waveform monitor.
|
|
vflip |
Flip the input video vertically.
|
|
yadif | Deinterlace the input video ("yadif" means "yet another deinterlacing filter"). |