PlayTool page top home home contact page

OpenFX Filters

Last updated: October 7, 2014

PixelPatcher hot pixel fixer

Hot pixels suck!

They're called hot pixels, stuck pixels, or a whole string of cuss words. I've had white ones, purple ones, and red ones. I hate them all. Let's just go with hot pixels. Most people call them that. They're an endless annoyance on my Canon 7D. I've been using Sony Vegas to edit together a video and I'm very picky about image quality. There are various editor hacks you can use to try to hide hot pixels. But I wanted an easy way to fix the ultimate in hot pixels: the Purple Blob of Death. So I wrote an OpenFX filter for Vegas called PixelPatcher. I've also used it with Blackmagic Resolve. It may work with other programs which support OpenFX plugins but I've only tested Vegas and Resolve.

The image above is an example of my 7D trying to drive me crazy. I grabbed this frame from a video and I've circled the two visible hot pixels. You might say that these aren't that bad. But this is near the beginning of the shot so the sensor's not very hot yet. The hot pixels get uglier later in the shot. And after a couple of minutes, a couple more hot pixels start becoming visible. They might not look that bad in a still but they stick out like a sore thumb in the video. Everything moves as I pan around except the hot pixels. So your eye tends to latch onto them. Did I mention that I hate them? Especially the Purple Blob of Death. It doesn't even look that bad here because it's in front of a purple pillar. You can easily see it on the back screen on the 7D. And that's without zooming in. That's why all the hate. I should have called my filter TheExterminator or something worse.

So this is what the patched frame looks like after ConsignHotPixelsToEternalDamnation PixelPatcher takes care of them. Even the Purple Blob of Death is invisible at the end of a long duration shot. Take that, hot pixels.

One way to handle hot pixels is to make a copy of the video clip and run a blur or median filter on it. Then you make a mask for the hot pixels and rig your compositing so the hot pixels in the video clip are covered by the same pixels from the blurred clip. It takes a couple of steps but it does a pretty good job of fixing smallish hot pixels. But you need to run a filter with a pretty large radius to take care of something the size of the Purple Blob of Death. And a large filter radius means that the fixed pixels often aren't a good match for the pixels immediately surrounding the bad area. Plus the hot pixel color is mixed in with the colors of the surrounding pixels during the blurring and that can cause problems when you have a big bright patch of hot pixels.

PixelPatcher is simpler than the blur and mask approach. You create an image file which shows where the hot pixels are. It's called a patch file. Hot pixels usually don't change very often so you only have to update the patch file once and a while. You hook PixelPatcher to the video like any other effect filter and then point it at your patch file. PixelPatcher fills in the hot pixels from neighboring good pixels. The incorrect colors in the hot pixels are discarded and have no effect on the colors used to fill the bad areas. And since the hot pixels are filled in from immediate neighbors rather than from a wider filtered area, the fixed pixels match their neighbors well even for fairly large bad areas.

PixelPatcher is very effective but you still have to be realistic about what it can do. It can clean those little buggers out of moving video. If you just sit down and watch the fixed video like everyone else then the hot pixels are gone. But if you stare at one frame in your video editor and look exactly where the hot pixel used to be then you can sometimes see a problem. This thing can't always generate perfect stills. PixelPatcher fills in bad pixels with the closest good pixels. That works fine for video but can come up short on individual frames if you know where to look. But if all you want is not to be distracted by hot pixels in video then PixelPatcher will do the job.

PixelPatcher filter installation and system requirements

PixelPatcher is an OpenFX plugin designed for Vegas. I believe I obeyed the OpenFX specification closely enough that it might work on other Windows programs which are compatible with OpenFX plugins. But OpenFX implementations vary a bit from one program to the next. Vegas' implementation of OpenFX had a number of bugs and peculiarities which I had to dodge and the same may be true of other OpenFX programs. I've used it extensively on Vegas so there it should work. I've also tested PixelPatcher on Blackmagic DaVinci Resolve. I haven't used it very much on Resolve but it seems to work properly now that I've patched around Resolve's OpenFX bugs. I have yet to run into a truly conforming implementation of an OpenFX compatible program. Normally it doesn't work on the first attempt. But after I dodge a few of their bugs I've gotten it to work anyway. So at this point PixelPatcher has been used a lot on Vegas and a little on Resolve. I can't guarantee it will work on other programs even if they claim to be OpenFX compatible. OpenFX is a pretty big specification. New OpenFX implementations tend to have some bugs.

OpenFX plugin support wasn't added until Vegas 10 so it doesn't work with Vegas 9 and earlier. And only the Pro version of Vegas 10 supports OpenFX plugins so it won't work with the non-pro versions of 10. All versions of Vegas 11 (movie studio, platinum, pro) support OpenFX plugins so PixelPatcher should work with them and later versions. If you're running Vegas 10 Pro then I'd advise running 10e. That's the last update of 10 Pro they shipped. There's some OpenFX bugs in earlier versions which can give PixelPatcher problems. Generally speaking, it's always a good idea to run the latest update of Vegas if you're using OpenFX plugins. Their original implementation of OpenFX was (ahem) a bit flakey and OpenFX bugs were still being fixed as late as Vegas 11. Vegas OpenFX: a work in progress. Resolve added OpenFX support in version 10 so PixelPatcher won't work on earlier versions.

To install PixelPatcher, download this program (MD5=5D99CAA3FF50A88B575D70F511811D99). If you're currently running an older version of PixelPatcher then uninstall it using the uninstall link in the start menu under PlayTool/PixelPatcher. Then run the installer. This program installs both the 32 bit and 64 bit versions. OpenFX programs will pick the correct version automatically the next time they start up so it's easiest to just install both. The installer program will create an entry in the Windows Start menu called PlayTool. PixelPatcher is within PlayTool and includes uninstall and documentation links.

PixelPatcher versions
Version What's in it
1.0 Initial release.
1.1 Fixed an installer bug which prevented PixelPatcher from showing up on some computers.
1.2 Made changes to handle Resolve 10 OpenFX bugs.
1.3 Made changes to handle Resolve 11 changes which broke my Resolve 10 bug fixes.

PixelPatcher is now at version 1.3. The core filter of PixelPatcher hasn't changed so installing a newer version does not introduce any incompatibilites with projects created with older versions. Old projects will work fine with newer versions of PixelPatcher.

PixelPatcher is freeware and cannot be sold commercially. For the record, this program is provided on an "as-is" basis with no warranties of any kind and the author shall not be held liable for any damage of any kind, yada, yada, yada. All I can say is that I've used it extensively and it works fine for me. Hopefully, it will also work for you. But it's not a commercial program and I've only tested it on software I have. Basically, I've run it a lot with Vegas 10 pro and a little with Resolve 10.

Using PixelPatcher step 1: create the patch file

First you need to create the patch file. It's just an image file which tells PixelPatcher which pixels to fix. It fixes the white pixels and leaves the black ones alone. If a pixel in the patch file is white then PixelPatcher fixes the pixel at that position in the video. It fixes the pixel by copying the colors from good neighboring pixels and can optionally do a little blurring. If a pixel in the patch file is black then the pixel doesn't need fixing and the corresponding pixel the in video is unchanged.

There's a couple of ways to create the patch file. The easiest way to make the patch file is to record a video with the lens cap on the camera. That gives a nice dark background to see the hot pixels. It's most accurate if recorded at the same resolution as the video you need to fix. You should record long enough to heat up the sensor so they become visible. If you're not sure how long that takes then just record as long as your longest shot. Some hot pixels on my 7D show up very quickly. But some of the dimmer ones can take a good fifteen minutes before they're very bright. Load the video up in your video editor, go to the end of the video, and grab a frame where they're brightest. In Vegas you can do that with the Save Snapshot to File command on the preview window. The button for that command looks like a floppy disk. I'd advise saving it in .PNG format rather than .JPG format so .JPG doesn't introduce any compression artifacts.

You can accomplish the same thing by manually creating the patch file in an image editor. Start with an all black image and then set pixels which need to be fixed to white. You can figure out exactly where to put the white pixels by grabbing frames from the video which shows the problem and bringing those frames into the image editor. It's takes a bit more work than shooting some video with the lens cap on but it accomplishes the same thing. Your goal is just to build a patch file which tells PixelPatcher which pixels to fix.

PixelPatcher loads the patch file up, converts it to gray scale, and then treats every pixel with a brightness of at least 5% as a pixel which must be fixed. It works this way so that people who shot a video with the lens cap on can just grab a frame and use it directly. 5% is low enough to catch dim hot pixels and high enough to ignore sensor noise on most cameras. If you manually constructed your own image file then the 5% will work fine because black pixels are 0% and white pixels are 100% so it will fix only the white ones. You can check the actual mask which PixelPatcher constructs from your patch file using the Mask only display mode shown below . If 5% doesn't work for your hot pixel image then load it up in an image editor and adjust the dark and light parts to suit your needs. I used PhotoShop to adjust the patch image shown above so the hot pixels are white and everything else is black. You can also use the HotThreshold .INI file parameter to change it from the default 5%.

The patch file doesn't actually have to be the same resolution as the video on which you're working. It doesn't even have to match the video's aspect ratio. PixelPatcher stretches the patch file to fit the frame in your video editor. Stretching the file does make it a little less accurate but it will still give a good result. But if you want to control exactly which pixels are fixed then you need to create a patch file which matches the project resolution in your video editor.

I don't know if there's such a thing as a black hot pixel. Would that be a cold pixel? I've only seen white, red, and purple. If you see a stationary black spot in your video then you can grab a frame and add the bad pixels to your patch file. PixelPatcher fixes bad pixels independent of their color. You just need to put them at the appropriate positions in the patch file so PixelPatcher knows where they are.

Hot pixels can actually change over time. In my case the Purple Blob of Death eventually disappeared. For the most part you can just use one patch file. But you may need to make a new one from time to time as old hot pixels go away and new ones show up. My current project has videos shot over a period of a year and a half and I use three patch files depending on when the video was shot. If you're not that picky then you can create one patch file which includes all of the bad pixels that your sensor has had.

Using PixelPatcher step 2: add the filter to the video which needs fixing

I'm only going to show you how to use PixelPatcher in Vegas. I don't know Resolve very well but once you get the filter loaded it's pretty much the same as Vegas. OpenFX filters work the same way whatever program is using them. In Vegas, PixelPatcher is added to your video event just like any other filter. You click the little Event FX gizmo on a clip which brings up the Plug-In Chooser dialog box. There's also menu options which do the same thing. Then you select PixelPatcher and it creates a copy which applies just to that clip. It's just like a contrast or saturation filter except this filter fixes bad pixels. You apply the PixelPatcher filter to any clip which has pixels which need fixing.

When Vegas creates the PixelPatcher filter, it's added to the end of the effects chain. It will be to the right of the Pan/Crop entry in the chain as shown in the left side of the image above. That means that any pan/crop will work on the video frame before PixelPatcher. If you use pan/crop to resize the frame then PixelPatcher will try to fix the pixels in the resized frame rather than in the original frame. PixelPatcher will fix the wrong pixels. I always drag PixelPatcher to the left of pan/crop as soon as I create it in case I use pan/crop later. That's what you see in the right side of the image above. That makes PixelPatcher run before pan/crop. It saves me the trouble of having to figure out why the hot pixels have reappeared. If PixelPatcher doesn't appear to be working it's a good idea to check if it's being run after a pan/crop has resized the image.

Using PixelPatcher Step 3: select the patch file

Now you need to connect the patch file you created in step 1 to this copy of PixelPatcher. Press the Browse for file button. That brings up a dialog box which allows you to select the file. PixelPatcher will read the patch file and convert it into the bad pixels mask. Each copy of PixelPatcher has its own patch file. You can use the same patch file for all of them or give each one its own patch file. You can have video from separate cameras with hot pixels in the same project. When you add the PixelPatcher filter to a clip you just select the patch file which goes with the camera which shot that video.

In Vegas, you can speed up reusing the same patch file in separate copies of the filter by setting the file up once and then saving it as a preset. Then when you create another copy of PixelPatcher which uses the same patch file you just select the appropriate preset. If you're using more than one patch file then you can have a preset for each one. It's quick and convenient.

PixelPatcher reads from the patch file and creates its own copy of which pixels need to be fixed. After that it does not access the file again. So you don't need to leave the patch file around because PixelPatcher only accesses it once. When you load a preset it doesn't access the patch file either. It just uses a copy of the original bad pixel mask.

You can see the actual pixels which PixelPatcher will fix by selecting Mask only in the Display mode drop down list. The white pixels will get fixed and the black pixels are left alone. The Bad pixels: white and Bad pixels: black entries in the drop down list can help you see whether the mask is aligned properly with the actual hot pixels. Bad pixels: white displays the original frame except with the pixels to be fixed set to white. Bad pixels: black displays the pixels to be fixed set to black. You can also toggle PixelPatcher on and off using the check box in its entry in the event chain to make sure the mask is fixing the correct pixels. Set Display mode to Mask only and then use the event chain check box to flip back and forth between the unpatched frame and the mask. That makes it easy to check the alignment.

Optional step 4 (for extremely picky people only): fiddle with blur parameters.

Unless you're extremely picky you can ignore the Blur radius and Blend radius parameters. Just leave them at their defaults. The original version of PixelPatcher didn't have these parameters. It fixed hot pixels successfully in video. But when I checked some individual frames and knew where to look I could still sometimes see some problems. I knew it wasn't really necessary but I just wanted to see if a little blurring could make the problems completely invisible even when pixel-peeping individual frames. Using a little blur can make most individual frames look correct. But it's not really necessary for most moving video.

PixelPatcher can blur the area of a group of hot pixels and feather the edges of that area into the surrounding pixels. The Blur radius parameter is the radius in pixels of the blur operation. It defaults to one pixel. The Blend radius is the maximum distance in pixels outside of the hot pixel area where the feathering takes place. This also defaults to one pixel. For a really large clump of hot pixels you may see a small benefit in increasing the radius parameters. But generally the default values will work just fine. You can disable the blurring by setting either of the parameters to 0.

.INI file parameters

PixelPatcher has some parameters which are stored in a .INI file. These parameters are loaded up when your program initializes the OpenFX plugins. Normally you leave these alone. But there's a couple in there you may want to fiddle with under some circumstances.

Where to find the .INI file
Operating system .INI file path
Windows 7 C:\ProgramData\PlayTool\PixelPatcher\OpenFX.ini
Windows Vista C:\ProgramData\PlayTool\PixelPatcher\OpenFX.ini
Windows XP C:\Documents and Settings\All Users\Application Data\PlayTool\PixelPatcher\OpenFX.ini

The file is called OpenFX.ini. The table above shows where you can find the .INI file for the various operating systems. I'm not 100% sure about the Windows XP path because I don't run XP anymore. OpenFX.ini is a text file which you can edit in notepad.

        //User accessible switches. Consult the documentation before changing.
        VegasBGR=0;              //[0,1] controls Vegas BGR mode
                                 //  0=use standard OpenFX RGB mode in all
                                 //    programs
                                 //  1=use Vegas BGR mode only in Vegas and
                                 //    use OpenFX RGB mode in other programs
        ForceFielding=0;         //[0..2] fix for Vegas OpenFX video fielding bug
                                 //  0=use fielding reported by the program
                                 //  1=ignore fielding reported by the program
                                 //    and assume progressive video
                                 //  2=ignore fielding reported by the program
                                 //    and assume interlaced video
        HotThreshold=13;         //[0..255] hot pixel image file threshold
                                 //  the hot pixel image file is converted to gray
                                 //  scale in the range [0..255]. if the pixel is
                                 //  >= this threshold then that pixel is fixed. if <
                                 //  this threshold then that pixel is left alone
        HotPixelsLimit=25000;    //[1..1000000000] hot pixel count per file limit
                                 //  max number of hot pixels which PixelPatcher will
                                 //  handle. if the patch file has more hot pixels
                                 //  than this limit then the rest of the hot pixels
                                 //  are ignored

The text above is a copy of the user-alterable parameters in the .INI file. It's best to leave the rest of the parameters in the file alone. The format for each parameter is: the parameter name, an "=", the value, and then a semi-colon. "//" turns the rest of the line into a comment. To change a parameter just modify the number and leave everything else alone. If you mess up OpenFX.ini, then delete the file and PixelPatcher will create a new file with default values the next time your program starts up.

.INI file parameters
Parameter Description
VegasBGR OpenFX stores pixel values in memory in Red, Green, Blue order. Vegas uses Blue, Green, Red order. So if you use OpenFX order then Vegas has to convert back and forth between its internal order and the OpenFX order. That slows things down a bit in Vegas. If VegasBGR is 0 then PixelPatcher uses the default OpenFX order for all programs including Vegas. I defaulted to 0 because I wanted PixelPatcher to obey the OpenFX specification by default. But if VegasBGR is 1 then when you're running Vegas it will use BGR mode and when you're running any other program it will still use RGB mode. If you're not using many other effects then it can speed things up quite a bit. But it's not standard OpenFX so I only enabled it when you change a switch.
ForceFielding Vegas 10 has a bug where it sometimes misreports to OpenFX filters whether the video is interlaced or progressive. Technically, if you're patching pixels in interlaced video then bad pixels in even frames should only be copied from good pixels in even frames. And likewise for odd frames. But if you don't do it that way then you probably won't notice the difference. I stuck this parameter in to test that PixelPatcher was working properly on both kinds of video because I couldn't depend on Vegas to report the correct value. But you can use ForceFielding to tell PixelPatcher which kind of video it is and override what Vegas is reporting. The default value is 0 which tells PixelPatcher to use the value reported by the program. 1 tells PixelPatcher to ignore the program and assume progressive video and 2 tells it to assume interlaced.
HotThreshold You tell PixelPatcher which pixels to patch by giving it a patch file. It converts that file to gray scale and then any pixel which is bright enough is treated as a hot pixel which needs to be fixed. HotThreshold defines how bright the pixel must be to be considered a hot pixel. This is a value between 0 and 255. If the pixel is greater than or equal to HotThreshold then it's a hot pixel. This defaults to 13 which is 5% brightness. I can't see any reason you'd need to change this value but it's here if you feel the urge.
HotPixelsLimit Normally there's not very many hot pixels on a sensor so PixelPatcher runs pretty quickly. At least it's pretty quick if you run in VegasBGR mode. But I found out the hard way that Vegas grinds to a halt if you accidently give PixelPatcher a patch file with a couple hundred thousand bad pixels. I think Vegas tries to disable OpenFX filters if the frame rate gets too slow. Or maybe it's another Vegas bug. Whatever is going on, previewing video in Vegas can be difficult if you have an extremely slow plugin running. So for safety's sake I included a limit to the number of hot pixels Vegas would allow in a patch file. Once the number of hot pixels exceeds the limit it ignores the rest of them. This keeps Vegas from becoming unresponsive if you select the wrong file. The default hot pixel limit is 25000. I've tested it with about 100000 hot pixels and it's very sluggish. You can increase the limit if you have to but if you really have that many hot pixels I'd suggest getting your camera repaired.

Video card information
Power supply information
Useful technical information
Random stuff

Copyright © 2005 - 2014 by Mark Allen