» AviSynth is a powerful video FrameServer for Win32.

AviSynth Links:
»Learn to script
»Discussion fora
»Project page
»External filters

» You can add pages to this website immediately. No login required.
Edit this document

» AboutAviSynth




( Diese Seite in flag-germany.gif Deutsch )

Subtract(clip1 clip, clip2 clip)

Subtract produces an output clip in which every pixel is set according to the difference between the corresponding pixels in clip1 and clip2. More specifically, it sets each pixel to (50% grey) + (clip1 pixel) - (clip2 pixel). You can use Levels afterwards if you want to increase the contrast.


# make the differences between clip1 and clip2 blatantly obvious:
Subtract(clip1, clip2).Levels(127, 1, 129, 0, 255)

If you want to see the deltas between adjacent frames in a single clip, you can do it like this:

Subtract(clip.Trim(1, 0), clip)

About offset of luma range:

For YUV formats the valid Y range is from 16 to 235 inclusive and subtract takes this into account. This means that the following script

Subtract(any_clip, any_clip)

will result in a grey clip with luma = 126. For those that require a subtract function for pc_range YUV data use Overlay:

#Overlay(any_clip, any_clip, mode="Subtract", pc_range=true) # grey clip with luma = 128
Overlay(clip1, clip2, mode="Subtract", pc_range=true)

SourceForge Logo


Edit this document | View document history
Document last modified Mon, 21 Mar 2005 17:34:10