Removing dust on the lens

Discussion in 'Tutorials' started by williarob, Jan 23, 2019.

  1. williarob

    williarob Administrator Staff Member

    I've been pondering this problem for over a year now and finally thought of a good way to do it. In 2015, I rented a number of trailers from a collector, had them scanned, received my 1080p Mp4 versions from the scanner which I posted on my blog sites, and moved on to other things. Long after the reels had been returned to the scanner, I finally got the raw 4K scans and quickly spotted that there was a lot of dust on the camera lens when the prints were scanned. Every time there was a dark scene, there was this ugly layer of dust just sitting on the top. Of course I was busy with Star Wars at the time, so there wasn't much I could do about it, and I didn't want to rent the reels again just to get them rescanned.

    Over the last few weeks I have been going back to my trailer scans and re-rendering them at higher quality, and with better color correction and stabilization (applying some of the new techniques I learned while working on 4K77).

    Unfortunately, I had already done my color correction, stabilized the frames using the sprocket holes and rendered out all the trailers on this reel before I watched the results and was reminded about the dust problem. And now the dust isn't so static. Because of the picture stabilization, the layer of dust now dances around!

    So something had to be done about the dust, but I wanted to find a way that would allow me to keep all of my color corrections and stabilization. The easiest way to do that is simply to clean the source files, and then use the "replace footage" option in After Effects to swap out the dusty versions with the clean versions, so no problem there, but how to remove that dust?

    I couldn't just run it through Phoenix DVO dust or PF Clean's Dustbust/Auto Dirt Clean, because the dust is on every frame and would therefore just be ignored. Also, trailers have so much action and quick cuts that any automated cleanup was bound to introduce other artifacts.

    So, I figured I needed a dirt map. This is something I had figured out how to do three years ago* so I used a similar technique: I took a black frame from the film and used Photoshop to generate a dirt map by using the Threshold effect (I could have done this in AE as well, but since I only needed a single static frame I figured this was easier), and used it to create a dirt map.

    Phoenix 2018 has a new DVO dirtmap effect which works pretty well on a real IR dirtmap, but it ignored mine completely, presumably because the dust was too small. No amount of tweaking the settings would get it to see the 1 pixel dust particles (and I tried them all), so it was back to PF Clean. PF Clean accepted my dirt map and cleaned the frames beautifully... But it was agonizingly slow. It started rendering at 7 frames per minute, and just got slower and slower until after 48 hours it was rendering 1 frame every 6 minutes! My trailer reel is about 38,000 frames, so - assuming it could keep up that pace without bogging down the computer and crashing - it was going to take at least 158 days to render!

    Time for a plan B. Fortunately, the next solution I came up with was trivially easy to implement and works really well: I used my dirt map to create the transparency I needed in After Effects, then put a second copy of the original, dusty footage underneath, and simply nudged it a couple of pixels to the right and a couple of pixels down. Boom! Dust is gone, no apparent artifacting (there are probably a few miscolored pixels here and there, but they are not nearly so distracting as the static layer of dust). And that's it. It's re-rendering now, and when it completes I will just use the "Replace Footage" option to swap out my dusty footage with the clean footage, and then I can re-render the trailers.

    This is (hopefully) a very unique set of circumstances - if you were shooting footage or scanning film yourself you would hopefully spot the problem early on, and go back and do it again without the dust, but I guess it can slip through unnoticed. If your best take was the one with the dust, this might be what you need...

    Here is a tutorial documenting my struggles:

    Note: Since this video was made, spoRv helped me make some improvements: Instead of just adding the same file underneath and shifting it a few pixels (which can obviously create some pixels of the wrong color on some frames), what I’m doing now is creating a new comp, scaling the whole thing down to 720p (which filters out the dust), and then using that comp as the repair layer – scaled back up to 4K. The downscale/upscale process removes the dust but keeps the right pixel colors. The detail loss doesn’t matter, because the “windows” created by my dirt map are so tiny.

    * Here is the original video I made on creating a dirt map (audio quality is terrible, but it's the same sort of idea).
    Last edited: Jan 23, 2019
    oohteedee, age, LuketheNerd and 2 others like this.
  2. williarob

    williarob Administrator Staff Member

    It works! Here's a quick before and after (zoomed to show detail):

  3. camroncamera

    camroncamera Jedi Knight

    Reminds me of my early DSLR that would result in similar noise for very long night exposures (e.g. 30 seconds and longer). The RAW image would have a large number of pretty badly blown pixels that don't ordinarily show up for typical exposures of a fraction of a second. The good news for me was that Lightroom would easily and instantly handle those hot pixels - even at a very low NR setting - and I was able to rescue many shots that otherwise may have seemed ruined. This was done on a single-frame process that is not limited to a temporal succession of stills, no complicated masks or composites needed. I simply turned up the noise reduction slider to just a bit above zero, and poof - the FPN would be cancelled out.

    I know that we have a DNR/NoDNR split with these releases, but in the future a small amount of DNR might be appropriate for certain troublesome shots - not as a film grain scrubber, just as a sensor noise reducer.
    williarob likes this.
  4. rogue1

    rogue1 Jedi Master Staff Member

    I'm glad you found a faster method.
    It seemed painful to go through the old way, and who wants to wait
    months for 1 trailer.


Share This Page