This webpage is about restoring the "Cliff Hanger" laserdisc video that is used with the Daphne emulator. The goal is to restore great image quality and convert it to progressive frames. I am starting out with a downloaded laserdisc capture in mpeg format. This laserdisc capture will be used as my main reference until I get something better to work from.
I've heard back from a few people that have played my "Cliff Hanger 2009 Restoration" and so far the feedback has been overwhelmingly positive! But it's been mostly informal. I'd like to organize a more thorough testing effort, so I am appealing to the "Cliff Hanger" experts out there.
I am only able to play the game to a certain point. And I only have certain hardware. I need some testers who can play the game all the way through. Additionally, I'd like somebody to try the 30i version on a real arcade monitor. And I am curious how the 24p version plays on an arcade monitor as well.
So far I've been taking it on faith that this restoration plays perfectly, since it matches the laserdisc mpeg so perfectly. I want to make sure this is the definitive restoration, so this testing effort is necessary.
Please contact me if you are interested in being a tester. And let me know what kind of hardware you can test it on. And it'd be nice if you can complete the game.
Upon close examination of the laserdisc capture, it really isn't very good quality at all. It's sort of dark and washed out looking. And the fields sort of blend from frame to frame, which suggests heavy use of a temporal filter. It makes me wonder if this capture was made by aiming a camcorder at the screen and playing the laserdisc. I'd like to try my own hand at capturing the laserdisc. I think I can get a better capture. If you have an actual "Cliff Hanger" laserdisc and would like to loan it to me, please contact me.
Here are some frames from the original laserdisc mpeg.
I tried my hand at reversing the pulldown pattern (sometimes called inverse telecining). Since there is so much blending from frame to frame, I am having a difficult time with it. I am not sure it's going to be possible. It almost resembles a PAL conversion. This project might be over before it really gets started.
I have read recently that the animation came from some Japanese anime. I might be able to improve things if I can find that.
Recently I downloaded a torrent of "Cliff Hanger Restored Edition". It looked great and played well in Daphne. It was quite the improvement over the laserdisc capture I had. I examined the video frame by frame and discovered that although it was progressive, it had been done with blended fields - a real nono. But the info file gives me the information I need. The animation came from a Japanese film called "Lupin III". Only one thing left to do... I need to get that "Lupin III" DVD.
Here are the same frames from the Restored Edition after resizing.
Turns out it's at least two Lupin III DVDs. One is called "The Secret of Mamo", and the other is "The Castle of Cagliostro". I have them now. "The Secret of Mamo" is anamorphic and "The Castle of Cagliostro" is letterboxed. The quality is even better than "Restored Edition"! But I am going to have to get all the scenes out of the movies and re-edit them into a new video that I can use in place of the laserdisc capture.
Here are the same frames from the Lupin III DVDs after resizing.
You probably noticed the frame seems to "shrink" on my DVD captures. The end goal is an anamorphic 16x9 widescreen version, but in the meantime I will be making a letterboxed version so that I can just swap the new video in place of the old one. I also like that there is more image in the frame on the left and right sides. Maybe I'll also make a "cliffboxed" version which is sligtly cropped, zoomed in, and maybe vertically stretched a little.
My first challenge was to recreate the opening title. I did this by bringing the laserdisc frame into Illustrator and vector-tracing it. I then superimposed it on the DVD capture. I also had to write a function to put the generic text in the frame. This text function will also be useful for other screens. I matched the font as closely as I could, which looks like "Swis721 Md BT". I got the font from my Corel Draw CD, which is loaded with great fonts. Corel Draw is worth having if for no other reason than for the fonts.
Here is how it turned out
You might also have noticed the title is not placed in exactly the same place. It's close, but not perfect. I am centering it for the most part, but the main reason it doesn't line up to the laserdisc is because the laserdisc has the frame cropped more on the left side than the right. That would not make sence for my letterboxed version, so I centered it within the new frame.
I made a "cliffboxed" function in my script. It simply crops a little more on the sides and vertically stretches a little bit to more closely match the laserdisc. It's impossible to get it perfect because the laserdisc actually has more frame data at the top and bottom than the DVD. But the DVD has more on the left and right sides.
Here is a comparision. The original laserdisc is on the left, my "cliffboxed" frame is on the right.
So far I have the opening "attract mode". It's quite tedious, matching frame for frame. I am writing an AviSynth script which makes all the cuts and assembles the scenes properly. At least working with the DVD, it's already progressive, so I don't have to reverse the pulldown pattern.
The casino robbery and car chase is done. This stuff was originally edited using video equipment, not computers. I find it amazing this amount of editing with this many frame-accurate cuts was possible. There are of course an ocassional error - a frame (or field) out of place. I am doing my best to acheive the original goals of the game producers. And so, the error frames are being cleaned up, and/or skipped.
Here are some screen caps of the casino robbery and car chase sequence.
There was one scene I could not find in either movie. It was a scene with yellow star-shaped explosions. After examining it closely, I reasoned that the scene does not exist and that it was custom drawn for the video game. And so, I vector traced it in Illustrator frame by frame. Since the sequence is animated at 30fps, I decided to let AviSynth convert it to 24fps by blending frames. In the laserdisc, the scene is not letterboxed like the rest of the scenes, but I letterboxed mine to match. This is one of many artistic decisions I will be forced to make.
And here are the explosion comparisons. The laserdisc is on the left. My redrawn sequence is on the right.
The mountain road car chase is done. I haven't mentioned it before, but each sequence also has a number of "death sequences" to be played when your character is killed because you made a wrong move in the game. These are also done.
Here are some screen caps of the mountain road car chase.
The helicopter/car chase is finished. One particular scene confuses me a little. The label on the wine bottle is missing. I wonder why they did that? Anyways, a manual frame-by-frame edit will have to be done. I basically need to get that bottle's label copied from the laserdisc, cleaned up, and positioned into the clean DVD's frame. Here is an example of what I am working with here. The laserdisc is on the left, the DVD on the right.
Here are some screen caps of the helicopter/car chase.
I finally have the ninja fight completed. What a chore! There were so many cuts. But wow! Look at all the detail! The laserdisc was so dark and muddy.
Here are some screen caps from the ninja fight.
I am acquiring the hi-def source of these films, so soon I will be working on a 720p version. My plan is to make the 720p movies match up frame-for-frame to my current DVD sources. Once I do that, all my cuts will be in the exact same place and I can just use the same script. I will have to modify my functions that deal with placing the text and titles on the screen, but I won't have to redraw them because they are already vectors.
I now have the 1280x720p version of "The Secret of Mamo". It looks spectacular! And lucky me, the wine bottle's label has returned. This means I will not have to hand edit those frames after all. Yippy! I am still curious why they chose to edit the bottle's label in the first place. For this webpage, my screen captures will remain letterboxed (720x480), but trust me, they are spectacular 720p. Now I need to sync it up with the DVD.
I now have the 720p "Secret of Mamo" synced up to the DVD. Now all my cuts work exactly the same and I can simply substitute in the 720 source in place of the DVD source. All my screen captures from here on out should reflect the better quality source now. Notice the more accurate colors in the 720p source. It's even better than the DVD. And the detail is better than the DVD even when downsized and letterboxed. Impressive!
Here is a sample frame for comparison. First is the laserdisc, followed by the "Restored Edition", the DVD, and finally the 720p source.
All functions in my script have been adjusted for HD 720p source. I even adjusted the title for 720p. I made it so that all I have to do is set a flag (HD=true) and everything rescales. Here is the title in glorious 720p.
The getaway after the ninja fight is done now. It was a pretty short scene. The death sequences took most of the time.
Here are screen captures from getaway sequence.
Working on the frogman sequence at the moment. But I am stalled on it because the DVD goes interlaced for several intermitant frames. I could fix it manually fairly easily, but I think I am going to wait for the 720p of "Castle of Cagliostro" to arrive before continuing work on this sequence.
In the mean time, I got the idea of working on a fullscreen version. I would basically crop it to full screen. It would be a very manual process though since I would be editing scene by scene to make sure none of the critical action is being cropped.
Looks like the fullscreen version will have to wait. The 720p version of "The Castle of Cagliostro" arrived today. I've been examining it frame by frame and it looks amazing! Way better than the letterboxed DVD I had previously. I'll try to post some screen caps soon. But first I want to set about snycing it up to my DVD source so that all my edits will line up.
I finally worked the 720p source into the Cliff Hanger restoration script. It was difficult for this movie mainly because of the flawed DVD I had previously. What a mess! I pretty much had to redo all my editing points. But I am caught up now and moving forward.
Here are screen captures from the frogman sequence using the HD 720p source.
The detail is so good that I might have to make some frame edits during the trap door scene. Cliff Hanger does some tricks to make that sequence which involves using a pices of video out of order. If you look closely, you can see Cliff in the distance swimming down the tunnel. You couldn't see it on the laserdisc because of the resolution and because it was so dark. But neither condition is present on the 720p source. So I might have to hand edit Cliff out of the scene.
Here is a comparison of the DVD vs the 720p HD source. Even downsized the difference in detail is staggering! And the DVD was way better than the laserdisc.
Finally, here are some 720p captures just to show how good it looks.
I've done a lot in the last couple of days. Now I am finished with the frogman sequence, the rooftop sequence, and the finale sequence. The finale is long and there are a lot of cuts, 39 to be exact! And it had a couple of fades that I had to match up. But it's done now and it turned out great. So that means I am done with the edits. Now it's time to encode it.
Here are some screen caps from the last three segments.
Now that I am done with all the edits, I need to decide what to do with this video. I expect I will have to mpeg2 encode it in order to play it, but I have questions about what type of encode Daphne expects. I will definitely make a letterboxed, anamorphic, and 720p version, even if they cannot be played right now. I am confident Daphne will evolve enough in the future to allow these types of files to be played.
Woo Hoo! I made a 640x480 mpeg2 encode and I just played it. It was great! Now I am going to do some more tests. This first test was what I knew would work. Now I am going to try some more stuff out such as 24 fps, anamorphic widescreen, and different resolutions.
Here are the mpeg encoding results:
640x480, 29.97fps cliffboxed Works perfectly and is very playable. Setting '-vertical_stretch 24' in the command line makes it play perfectly on my widescreen monitor, and it fills the screen nicely. Still I know that because it's not true 23.976 progressive, some jerkiness in the motion might be noticable to some due to doubling every fourth frame. True progressive 23.976 video should be the way to go. But for now, this might be the best option.
720x480 23.976fps anamorphic I went for the gusto and tried the best one. It did not work. I got blank video. But I am going to keep this mpeg file just in case. I'd like to see Daphne support it someday.
640x480 23.976fps cliffboxed I was actually surprised that this did not work. I am assuming it's because of the framerate. That's a shame really. I can understand the other frame sizes because of difficulty making the overlay graphics work, but I don't understand why different frame rates can't be used. I am hoping this is one area Daphne improves on in upcoming versions.
640x480 29.97fps anamorphic This works, but the game covers it with black boxes (letterboxing). Setting '-vertical_stretch 24' in the command line stretches the screen and crops those boxes, but the video is also stretched (more) and cropped. Clearly this one will not work.
In making the progressive Cliff Hanger mpeg, decisions had to be made at every scene change. Most scenes began and ended on an odd/unmatched field. This meant that the frame was interlaced with half of two different frames. So I had to choose to either black out the frame, show the whole frame of one or the other field, or blend the two together. I chose one of the frames based on how it lined up in timing. Realizing that this is not exactly perfect, I decided when I was done, I would make a perfect field-accurate restoration for the purist.
To make this field-accurate restoration. I will have to tweak a few things to get it just right. The plan for this one is to exactly match EVERY frame, even matching the interlacing fields and pulldown patterns perfectly. Naturally, this will be much more difficult, but it needs to be done for proper restoration. Also planned is to recreate the same errors present in the LD. One common error is the frame right before the yellow explosions.
One thing that makes this type of restoration hard is the difficulty in distinguishing between an interlaced frame and a frame with previous frame data showing. The laserdisc image I am working with (and possibly the original laserdisc) has a heavy dose of a temporal filter. This makes each frame blend with the previous frame. And the fields bleed into each other as well.
Here are a few example frames perfectly matched up, interlaced fields and all. These frames were selected specifically to highlight the interlaced frames. The interlacing/pulldown pattern matches frame-for-frame with the laserdisc. Note, the laserdisc capture has been brightened considerably so I could pick out the details in the dark areas.
So far I have completed up to mid-way through the death sequences following the helicopter/car chase. I also improved my "cliffboxed" function to be more accurate compared to the laserdisc.
I am now working on the ninja fight. These dark scenes are the worst! It is so hard to discern any information in these frames. Dark detail shows up about a frame late, bright detail (if there is any) shows up faintly at first, and sometimes the bottom 1/4th of the frame shows up a frame early. Plus as I have already written, field data bleeds from the adjacent field.
Here is a classic example of a frame showing blended data from the previous frame plus field bleeding. Here you can see the bright details of the arm from the previous frame. Also notice the dark details have yet to come into view. It typically comes a frame late. And finally notice the field bleeding of Cliff swinging down with his weapon (the green shape is his jacket, the black blob with the red circle is his face).
I have finished the ninja fight and getaway. I am halfway done. I went back and corrected some explosion sequences. There were some frames in there that were very similar, but I had them wrong. It's perfect now. I am also discovering a few errors in the 720p source. Now and then a frame will be out of place. I have written a custom function just for putting frames where I want them so I can match the laserdisc perfectly. I just hope I am catching all the errors.
I have also decided that I will write a function that runs at the end which will correct all the errors present in my recreation of the laserdisc. That way I can still make a faithful reproduction of the laserdisc image, but I can also make a proper remastering job which means correcting obvious errors. I can just set a flag 'fix=TRUE' to make the function run.
I am up the the finale sequence now. Almost finished (again)! It's a good thing too because I am running out of gas with this project.
Finished! Now the question is should I encode it BFF (bottom field first) like the laserdisc mpeg or TFF (top field first) like it ought to be? I am leaning towards TFF. Although BFF can work fine, it's not the usual way of doing video. Either way Daphne ought to be able to handle it.
I fiddled around with the placement of text. I think I got it pretty close. I also tinkered with my "cliffboxed" function to get closer to the laserdisc with regards to aspect. Here is the title screen. Notice the aspect is the same as the laserdisc and the placement of the title and text better match the laserdisc.
In case anyone is interested, my main AviSynth script is 1080 lines long. And I have three helping scripts which are 638, 102 and 102 lines.
After doing the field-perfect remastering for the purist, I modified my script to automatically generate a 24p (actually 23.976) progressive file. So now it does an even better job at generating a 24p mpeg file than I did manually in my first go-round. And I finally have the 24p file working in Daphne too! The key was not checking the box that said "3:2 pulldown on playback".
I think next I will fiddle around with VBR bitrates and see if I can get this filesize down a bit. It currently is 1.9MB. After that, I am going to encode the 720p Hi-Def version. If I can figure out how to get Daphne to letterbox a widescreen video, then I'll make a 1280x720p version, otherwise, I may have to go with 1280x960 with the black bars in the video.
VBR mpegs only seem to work with 'opengl' video mode. And I figured out I need to investigate h264 for the 720p Hi-Def encoding.
Looking back, I think the clues have been pointing to the same thing. It's not VBR that is failing in YUV mode, it's the 720x480 resolution. The one that threw me off was the one 720x480 file that had the wrong header in it somehow and Daphne thought it was 640x480. However, since 720x480 needs opengl mode, there is no reason I shouldn't go ahead and re-encode all the 720x480 videos using VBR. Then I will test the 640x480 videos using VBR. Lastly, I just discovered that filenames cannot have spaces in them.
It's been a while since my last update, so I'll try to fill everybody in on where this project is at. At this point, I have all the encoding gotcha's figured out and I have made several mpegs for various situations. I broke them down into three sets, as follows:
standard 640x480 version: 640x480_30i, 640x480_24p, 640x480_24p_letterbox.
special 720x480 version: 720x480_30i, 720x480_24p, 720x480_24p_letterbox.
widescreen collection: 640x480_24p_letterbox, 720x480_24p_letterbox, 640x480_30i_letterbox, 720x480_30i_letterbox, 640x480_24p_anamorphic, 720x480_24p_anamorphic.
The widescreen set includes the same letterbox versions that are in the 640x480 and 720x480 sets. It also includes two anamorphic versions which at the moment don't play exactly right in Daphne. The hope is that, in the future, Daphne will have more options for handling anamorphic video - for example letterboxing on 4x3 monitors or different zoom options. When/if those options become available, these videos will be here.
I still have not made any hi-def encodes. I want to make a set consisting of 1280x720_24p, 1440x1080_30i, 1280x960_24p. I am fairly certain that Daphne doesn't yet support HD stuff. However, I seem to remember reading posts about people playing Dragon's Lair in HD. Still, it looks like h264 is the encoding standard to strive for, so I will need to learn how to encode my video h264.
When I first attempted to encode an mpeg at 1280x960 (or 1280x720), TmpegEnc choked. But then there was the freeware HC Encoder, which was one that I had tried in the past. HC seemed to encode mpegs ok, but my proplenm with it was that I could not accurately predict the encoded file size. Thankfully, HC has improved considerably since then. And it encoded 1280x960 and 1280x720 perfectly. I haven't yet tried it in Daphne though. But it's good for archival, and I know I can encode h264 from this if Daphne ever supports it (doubtful).
I just got the MAME version of the laserdisc rip. It was a massive CHD (compressed harddrive) file. Using a chd utility, I was able to rip the avi file out of the chd.
It didn't take long to realize that the audio and video quality in the chd is a massive improvement over the Daphne mpeg that's been floating around. The audio is free from the glitches that plague the Daphne mpeg. The video is much clearer too. It does not suffer from many of the problems of the mpeg I had before, such as being too dark and showing compression blocking artifacts. Still, it can only as good as the original laserdisc is, which isn't that good. But at least it's as good as it can get for a laserdisc capture. This will be used as my reference from now on.
This is what I was hoping to accomplish by borrowing somebody's orginal laserdisc. Thank you MAME team for saving me the trouble. It would have been nice to have been able to work from this instead of the mpegs I had, but oh well.
My first order of business was to make a Daphne mpeg file from this new source material. This goal came with a few challenges.
Interestingly, the MAME team chose to capture the entire frame from the laserdisc, including information that is never visible in the frame. Since this info can't be used and will never be visible in Daphne, I cropped it off.
Next, I discovered a few visual errors in the chd video. I corrected them by writing some special functions into my AviSynth script. I made use of every bit of image detail which was present in the frame. What I could not use, I borrowed from the previous frame (which was no different than the current frame).
The audio in the MAME chd is 48 KHz. I have to fault the MAME Team here. I know they are all about accuracy, and in this case they got it wrong. Laserdisc audio is 44.1KHz, so they captured the audio at the wrong bitrate. I doubt our ears will ever hear the difference though. 48KHz is a higher bitrate, but it is not a bit-accurate LD rip. I wonder if they got the audio off the disc through analog capture or digital copy through S/PDIF? Not every LD player has S/PDIF (mine does). Daphne did not recognize or play the 48KHz audio, so I had to resample it to 44.1KHz and encode a new ogg file.
Finally, the MAME chd "Cliff Hanger" video started 10 frames sooner than the Daphne mpeg. To play the mpeg from the MAME chd is easy enough I just modified the frame file from '6' to '-4'. Thankfully, Daphne did not choke on the negative number. And the chd mpeg played very well! At the very least, I recommend that this mpeg be a new replacement for the crummy mpeg for "Cliff Hanger" which has been floating around the internet for way too long.
Ideally, I'd like to see Daphne modify their code to reflect the more accurate start of the disc. But I want to research this some more. I know the Daphne website shows some frame numbers in the video, which preseumably were displayed by the LD player. I haven't yet compared the MAME chd with those frame numbers yet.
Now my challenge is to add in those ten frames to my restoration work. It won't be an easy task since all my source files (the BluRay rips) are no longer on my harddrive. And I'll have to make sure after adding those frames that my restoration script still works. A nd then I'll have to make all new encodes for all the different modes.