Latest film restoration tricks

johnmeyer wrote on 1/27/2012, 2:31 PM
The following short before/after clip shows some new tricks I've developed for film restoration. These same tricks apply to video.

This 8mm film was taken in 1954, and the camera (not the projector) malfunctioned and didn't bring the film to rest before opening the shutter. As a result, not only were the frames jumping up and down, but many of those which jumped were blurred. I went through by hand (thousands of frames) and marked each jump frame. I then developed software which deleted the jump frame and then used motion estimation software (similar to Twixtor which is used for synthesizing slow motion) to create a brand new synthesized frame which I then inserted in place of the damaged frame. So, on the right-side "after" version of the clip, about 50% of those frames are computer-generated.

I have used this same technique -- although thankfully on a much smaller number of frames -- to remove frames where a photographer's flash ruined the frame, or where there was a dropout or, on older analog video, where there was a glitch or dropout.




Comments

WillemT wrote on 1/27/2012, 3:11 PM
Wow. Absolutely amazing. Hats off to you.

Willem.
amendegw wrote on 1/27/2012, 3:12 PM
Quite amazing!

...Jerry

System Model: Alienware Area-51m R2
System: Windows 11 Home
Processor: Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz, 3792 Mhz, 8 Core(s), 16 Logical Processor(s)
Installed Memory: 64.0 GB
Display Adapter: NVIDIA GeForce RTX 2070 Super (8GB), Nvidia Studio Driver 527.56 Dec 2022)
Overclock Off

Display: 1920x1080 144 hertz
Storage (12TB Total):
OS Drive: PM981a NVMe SAMSUNG 2048GB
Data Drive1: Samsung SSD 970 EVO Plus 2TB
Data Drive2: Samsung SSD 870 QVO 8TB

USB: Thunderbolt 3 (USB Type-C) port Supports USB 3.2 Gen 2, DisplayPort 1.2, Thunderbolt 3

Cameras:
Canon R5
Canon R3
Sony A9

vtxrocketeer wrote on 1/27/2012, 3:50 PM
But now it doesn't have that vintage look. Maybe you can add an FX for that...or write one.

Seriously, that must have taken a LOT of work. A tip of the hat...
GerryLeacock wrote on 1/27/2012, 4:14 PM
Are you going to make this software available, either as a freebie of a paid download?
paul_w wrote on 1/27/2012, 4:17 PM
Awesome job John, thats a lot of work.

Paul.
farss wrote on 1/27/2012, 4:35 PM
Once again I take my hat off to you sir.
My only concern is how you'll ever get a financial return on your time.

As I'm sure you know years ago I was in the same business and still hanker to be back playing with sprockets. I had thought of buying one of the boxes from S&W but no way was anyone going to pay enough to cover the investment.
I thought of investing less money and way more of my time to develop a bespoke solution but even then no one would pay enough to even cover my meagre financial investment. I found it unusual to get so much as a sincere Thank You for all our hard work.
Good luck with your endeavours, perhaps we have to wait for our just rewards in the next life.

Bob.
xberk wrote on 1/27/2012, 4:38 PM
Terrific job. I would have told you that clip was a lost cause.

Paul B .. PCI Express Video Card: EVGA VCX 10G-P5-3885-KL GeForce RTX 3080 XC3 ULTRA ,,  Intel Core i9-11900K Desktop Processor ,,  MSI Z590-A PRO Desktop Motherboard LGA-1200 ,, 64GB (2X32GB) XPG GAMMIX D45 DDR4 3200MHz 288-Pin SDRAM PC4-25600 Memory .. Seasonic Power Supply SSR-1000FX Focus Plus 1000W ,, Arctic Liquid Freezer II – 360MM .. Fractal Design case ,, Samsung Solid State Drive MZ-V8P1T0B/AM 980 PRO 1TB PCI Express 4 NVMe M.2 ,, Wundiws 10 .. Vegas Pro 19 Edit

johnmeyer wrote on 1/27/2012, 5:18 PM
My only concern is how you'll ever get a financial return on your time.Bob,

As you well know -- and as you stated above -- you can't make money at this. Even basic transfer, at $0.15/foot, is very difficult to justify economically. What makes it even more difficult is that Costco (a huge discount USA retailer) is now offering film transfer services:

Costco Movie Film to DVD Transfer Service

I haven't talked to anyone that has used Costco for film transfer, but they offer some level of digital restoration and are charging $0.11/foot. I don't know how you can even pay someone to mount and spool the film for that amount of money. If their transfer is as good as their photo printing service (which is excellent), it will be impossible to beat.

So, I do most of my film transfers for free. This particular job is for someone I knew in college who ten months ago was diagnosed with Stage 4 melanoma. He had experimental therapy and is now, miraculously, in remission. A few months after he started getting better, his wife came across his dad's old film (70 reels, 8,000 feet) and thought it would be a great idea to have them transferred. It turns out that lots of the film is like what you saw, and I had to, by hand, identify all these jumps.

Which brings me to the question above:

Are you going to make this software available, either as a freebie of a paid download?All the software I used is already available for free (well, you need Vegas). The short version of how this was done is as follows.

1. I captured the film and timed it to playback at 16 fps. I set my Vegas project properties to 16 fps progressive.

2. I zoomed in on the timeline and then walked, one frame at a time, through problem footage. Wherever I found a jump frame, I pressed a shortcut key that invoked a Vegas script I wrote which replaces the bad frame with an exact duplicate of the previous frame (I've used this in the past as a quick-and-dirty way to eliminate still photographer's flashes). This replacement with a duplicate accomplishes two things. First, I can play back the footage at normal speed and instantly detect if I missed any bad frames. The motion is pretty jerky because of all the duplicates, but there should be no jumps. Any remaining jumps stick out like a sore thumb.

3. I use MVTools2 (free motion estimation software) within an AVISynth script I developed. The script is only about one or two pages long. AVISynth can easily detect the complete absence of motion that results when you have an exact duplicate of the previous frame. When it detects that, it replaces that frame with a motion estimated frame that uses information from the previous and next frames to construct a synthesized new frame. 99% of the time the resulting new frame is absolutely perfect: it is actually quite stunning how good the motion estimation can be. However, if someone is close to the camera and is waving their hand back and forth, you will definitely see a one-frame artifact (it looks like their hand "breaks"). However, compared to the violently shaking, unwatchable film that is being replaced, this is pretty minor, especially since all the other synthesized frames look so good.

Like so much of what I do, I didn't invent any of this: I just figured out how to apply it in somewhat unusual ways.


larry-peter wrote on 1/27/2012, 5:37 PM
Very impressive. I'm envious of this type of creative thinking.
amendegw wrote on 1/27/2012, 5:57 PM
"I haven't talked to anyone that has used Costco for film transfer, but they offer some level of digital restoration and are charging $0.11/foot. I don't know how you can even pay someone to mount and spool the film for that amount of money. If their transfer is as good as their photo printing service (which is excellent), it will be impossible to beat. "Well, I was less than impressed with Costco's service. Years ago I used a VHS camcorder to & a ground glass transfer box to digitize my father's 16mm home movies. Costco has an introductory offer for their service, so I experimented with a reel. You can see that from the following screen captures that Costco was actually worse than the original DIY transfer.




...Jerry

PS: If there were a Nobel Prize for film restoration, I'd nominate johnmeyer

System Model: Alienware Area-51m R2
System: Windows 11 Home
Processor: Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz, 3792 Mhz, 8 Core(s), 16 Logical Processor(s)
Installed Memory: 64.0 GB
Display Adapter: NVIDIA GeForce RTX 2070 Super (8GB), Nvidia Studio Driver 527.56 Dec 2022)
Overclock Off

Display: 1920x1080 144 hertz
Storage (12TB Total):
OS Drive: PM981a NVMe SAMSUNG 2048GB
Data Drive1: Samsung SSD 970 EVO Plus 2TB
Data Drive2: Samsung SSD 870 QVO 8TB

USB: Thunderbolt 3 (USB Type-C) port Supports USB 3.2 Gen 2, DisplayPort 1.2, Thunderbolt 3

Cameras:
Canon R5
Canon R3
Sony A9

rs170a wrote on 1/27/2012, 6:11 PM
Add me as another less than satisfied Costco user.
I recommended them to someone I work with as their prices were very reasonable.
I looked at the transfer and almost got sick because it was so bad :(
I will never recommend them again.

edit: I agree about how talented John is. He's bailed me out more than once and I am very grateful for his assistance and ongoing contributions to this forum.

Mike
RalphM wrote on 1/27/2012, 7:42 PM
That's truly a remarkable restoration technique. Finding all those jump frames manually has definitely got to be a labor of friendship...

Thanks for the posting of the Costco comments. I've wondered what their work was like. I think the way one makes $$ doing film transfers is that many people do not want to send irreplaceable family memories to some large unknown shop hundreds of miles away.

johnmeyer wrote on 1/27/2012, 10:43 PM
Years ago I used a VHS camcorder to & a ground glass transfer box to digitize my father's 16mm home movies. Ha! That's how I started, back in the 1980s, with an RCA Vidicon camera pointed into the rear view mirror that my dad saved from his dad's 1954 Cadillac.

If you ever want me to take a stab at a few of your reels, I'd be happy to do them in return for all the help you've given me on stabilizing with Mercalli and encoding for YouTube.

BTW, I just had a question from a documentary film maker, whose getting some of my marathon video, about how I managed to hold my camera so steady. I had to admit that I used Mercalli with the "Rock Steady" setting. I bought that product specifically for this feature after I saw what you were able to do with your pet peacock.

Oh, and on the Costco transfers, YIKES that is truly horrible.

[edit] And one thing I forgot to mention in the original post. If you go back a few weeks, you will find that I made reference to a project with sixteen hours of footage on the timeline, cut into 14,000 events. I got to that number because of all these jump frames where, after duplicating the frame, I ended up with three events where previously there was one. After I placed the fixed footage on the timeline, I had to delete all these events because, while Vegas 7.0d (bless it's heart) didn't crash, it started to complain about undo buffers.
Grazie wrote on 1/28/2012, 1:58 AM
Wow John that is truly amazing work. As always I AM a total JM-Fanboy!!

Cheers

G

LoTN wrote on 1/28/2012, 3:25 AM
John, I am always impressed by the results you get using Avisynth and I have to admit I never had a though about using MVFlowInter() this way.

That's really amazing ! Bravo :)
amendegw wrote on 1/28/2012, 4:54 AM
"If you ever want me to take a stab at a few of your reels, I'd be happy to do them in return for all the help you've given me on stabilizing with Mercalli and encoding for YouTube."

John, At some point in time, I just might take you up on that. In the meantime, I've still got this project http://www.sonycreativesoftware.com/forums/ShowMessage.asp?ForumID=4&MessageID=764290WOT: Keystone A-82 16mm Projector[/link] on the back burner. One of these days I'm going to revive it. If I'm unsuccessful, I'll probably be back to you for advice (or send you a reel or two).

Oh, and I want to say... "I'm glad to help you wherever I can." You've already given me far more help than vica-versa. I'm still very much in your debt (for that matter, I would surmise that statement applies to nearly everyone in this forum).

"BTW, I just had a question from a documentary film maker, whose getting some of my marathon video, about how I managed to hold my camera so steady. I had to admit that I used Mercalli with the "Rock Steady" setting. I bought that product specifically for this feature after I saw what you were able to do with your pet peacock."

Ha! The proDAD folks ought to be sending me a marketing fee [grin]. Mercalli V2 can be truly amazing, once you get by its idiosyncrasies.

...Jerry

System Model: Alienware Area-51m R2
System: Windows 11 Home
Processor: Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz, 3792 Mhz, 8 Core(s), 16 Logical Processor(s)
Installed Memory: 64.0 GB
Display Adapter: NVIDIA GeForce RTX 2070 Super (8GB), Nvidia Studio Driver 527.56 Dec 2022)
Overclock Off

Display: 1920x1080 144 hertz
Storage (12TB Total):
OS Drive: PM981a NVMe SAMSUNG 2048GB
Data Drive1: Samsung SSD 970 EVO Plus 2TB
Data Drive2: Samsung SSD 870 QVO 8TB

USB: Thunderbolt 3 (USB Type-C) port Supports USB 3.2 Gen 2, DisplayPort 1.2, Thunderbolt 3

Cameras:
Canon R5
Canon R3
Sony A9

Richard Jones wrote on 1/28/2012, 5:58 AM
John

That is truly incredible.

Richard
JJKizak wrote on 1/28/2012, 6:46 AM
Outstanding!
JJK
4110 wrote on 1/28/2012, 5:19 PM
Excellent!

I have a lot of old 8mm film with that same jerky motion and I would really appreciate the scripts that you wrote. Would you be able to share them somehow?

Thanks,

David
johnmeyer wrote on 1/28/2012, 6:23 PM
I have a lot of old 8mm film with that same jerky motion and I would really appreciate the scripts that you wrote.First, you need to make sure the problem is really the same thing as what I was trying to correct. To determine whether your film has the same problem, you must have a film-to-video transfer that is "frame accurate" so that you get precisely one frame of film onto each frame of video. Then, put that video from the film transfer on the Vegas timeline and look at each successive frame, one after the other. In my film, I usually got a jump, followed by a good frame. Sometimes I got several good frames in a row.

Also, you should put the film in a projector, turn down the bulb strength (so as not to burn the film) and look at one frame at a time. You need to do this to make sure the problem is really on the film itself, and is not simply due to bad sprocket holes. If you have torn sprocket holes, you may be able to have the film repaired and then transferred. Also, some scanning services (that use a Cintel) may be able to get good results, even with bad sprockets.

As for the scripts, I use two scripts. The first one is actually very useful even if you don't do film transfer. You simply advance the Vegas cursor until you see a bad frame in the preview. This "bad frame" can be due to a photo flash, dropout, or any number of other mishaps. The following script will replace that bad frame with a duplicate of the previous frame. The audio track is not affected. The single duplicate frame is grouped with the events on either side so you can still move the video around without losing that little tiny event.

So, just to be clear, the following is a Vegas script.

/** 
* PURPOSE OF THIS SCRIPT:
*
* Fix a bad video frame by deleting bad frame and replacing with previous frame.
*
* A video track must be selected. If an audio track is selected, nothing happens.
*
* To use, select the event that contains the bad frame. Position the cursor so you can
* see the bad frame in the preview window. Then, run the script.
*
* Copyright © John Meyer 2006
* Written: June 23, 2006
*
**/

import System;
import System.IO;
import System.Windows.Forms;
import Sony.Vegas;


try {

//Global declarations
var dStart : Double;
var dLength : Double;
var dCursor : Double;
var trackEnum : Enumerator;
var evnt : VideoEvent;
var evnt2 : VideoEvent;
var one_frame = Timecode.FromFrames(1);

var track = FindSelectedTrack(); // Use this function to find the first selected track.

if (track.IsVideo()) { // Proceed only if selected track is video track.
var one_frame = Timecode.FromFrames(1);
var eventEnum = new Enumerator(track.Events);
dCursor = Vegas.Cursor.ToMilliseconds(); // Remember the cursor position.

//Go through each event on the track.
while (!eventEnum.atEnd()) {
evnt = (eventEnum.item());

// Get the event's start and length timecode, in milliseconds.
dStart = evnt.Start.ToMilliseconds();
dLength = evnt.Length.ToMilliseconds();

// If the cursor timecode is between the beginning and end of the
// event timecodes, then split the event, delete first frame from event to right of split.
// Copy last frame from event to left of split and put into the one-frame gap.

if ( (dCursor > dStart) && ( dCursor <= (dLength + dStart) ) ) {
var patch_frame : VideoEvent = VideoEvent(evnt.Copy(VideoTrack(track),Vegas.Cursor));

// Make first frame of new event equal frame to left of cursor (for all takes)
for (var i=patch_frame.Takes.Count - 1; i >= 0; i--) {
patch_frame.Takes.Offset = patch_frame.Takes[i].Offset + Vegas.Cursor - one_frame - evnt.Start; // Make change for ALL takes.


Once you have replaced bad frames, you then need to use an AVISynth script to detect these duplicates and replace them with a motion-estimated replacement frame. The following is an [i]AVISynth script (i.e., NOT a Vegas script) that accomplishes this.

Installing and using AVISynth is an exercise left up to the user ...

#This script finds exact duplicate frames and then interpolates a new frame in place of the duplicate.
#It works on interlaced video.

loadplugin("C:\Program Files\AviSynth 2.5\plugins\MVTools\mvtools2.dll")

setMTMode(5)
source=AVISource("e:\frameserver.avi").ConvertToYV12.killaudio()
setMTMode(2,0)

output=filldropsI(source)
#stackvertical(source,output)
return source

#-------------------
function filldropsI (clip c)
{
even = c.SeparateFields().SelectEven()
super_even=MSuper(even,pel=2)
vfe=manalyse(super_even,truemotion=true,isb=false,delta=1)
vbe=manalyse(super_even,truemotion=true,isb=true,delta=1)
filldrops_e = mflowinter(even,super_even,vbe,vfe,time=50)

odd = c.SeparateFields().SelectOdd()
super_odd=MSuper(odd,pel=2)
vfo=manalyse(super_odd,truemotion=true,isb=false,delta=1)
vbo=manalyse(super_odd,truemotion=true,isb=true,delta=1)
filldrops_o = mflowinter(odd,super_odd,vbo,vfo,time=50)

evenfixed = ConditionalFilter(even, filldrops_e, even, "YDifferenceFromPrevious()", "lessthan", "0.1")
oddfixed = ConditionalFilter(odd, filldrops_o, odd, "YDifferenceFromPrevious()", "lessthan", "0.1")

Interleave(evenfixed,oddfixed)
Weave()
}


I originally designed this script for interlaced video, but it works just fine on progressive video, including film captures. The "YDifferenceFromPrevious" comparisons can actually be set to 0.0 instead of 0.1 in this case because the two frames are in fact exactly identical. However, I used a number slightly larger than zero just because I've learned over the years in programming that things often don't quite equal zero, even when they should. A normal YDifferenceFromPrevious (the difference in brightness from frame-to-frame) is usually 1.0 or greater, so 0.1 represents a very tiny difference.

So, as is often the case in computer programming, it doesn't take a lot of code to do really good stuff.
Steve Mann wrote on 1/28/2012, 8:31 PM
John, thanks for reminding us what this forum is for.
I have a couple of thousand feet of my fathers 8mm films. (I note that in the 1950's it cost him $8 to $10 to process a 50-ft reel - a fortune then).

Unfortunately, when he and my mom moved to Hawaii, they stored the film in the attic for about ten years. Now it's so dry and brittle that it comes off the reel in crumbs.

I've thought about taking these crumbs and finding complete frames to make at least a slide show. But the curve of the film made that idea not work. I will next experiment with doind an extreme lens-correction in Photoshop. Any tips would be appreciated.
NicolSD wrote on 1/28/2012, 8:50 PM
John,

I just can't believe you managed to do such a fantastic job. I am truly impressed. I bow to you and scrape the ground with my bearded face. You are amazing!
johnmeyer wrote on 1/28/2012, 10:03 PM
they stored the film in the attic for about ten years. Now it's so dry and brittle that it comes off the reel in crumbs.Oh, that's a horrible shame!

A few thoughts ...

First, does the film have any smell? You need to know your chemical smells, but if it smells like vinegar (it's actually acetic acid) then the crumbling is due to "vinegar syndrome" (you can Google this and find out more), then there is nothing you can do.

If it smells like camphor (moth balls), that's OK. If it is musty, that's OK. You just don't want the smell of vinegar.

Now, if it passes the smell test AND if the film is intact until touched it MIGHT be possible to "rehydrate" the film. You'll have to do your own research on this. My use of the word "rehydrate" is probably incorrect because you won't be using water, but I think you can sometimes get brittle film to regain some of it pliability. Do a search on "filmrenew." It is a product that is designed to get film to move more fluidly through the projector. However, it is designed for film that is still basically intact. I just did a quick search using "filmrenew" and "film preservation" as search terms, and came up with quite a bit.

(If Bob Grant is reading this, he may have a few ideas).

Finally, many people that have horribly degenerated film have indeed been able to scan a few frames on a flatbed scanner. You will have to have a scanner with at least 1200 dpi and also one that has a transparency adapter. My ancient HP Scanjet 7400c has those characteristics.

Hop this helps!

musicvid10 wrote on 1/28/2012, 10:25 PM
John, this is a big deal. Rather than give it away, you should brand, package, and pitch it to the likes of the Library of Congress and MPAA. Seriously.
m